From 0f2be67bbfb03748e5bb3a02475afa8d7ec9aaa3 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Thu, 1 Sep 2011 19:53:14 +0000 Subject: BGE: Undoing r39729 and applying a simpler fix (ensuring that the viewport is correct for PostRenderScene()). This way both 2d filters and post_draw callbacks with with multiple viewports. --- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 878232f7a50..ca67333166c 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -886,8 +886,6 @@ void KX_KetsjiEngine::Render() { if((*it)->GetViewport()) { - // Change the active camera so Python scripts can figure out what viewport they're in - scene->SetActiveCamera(*it); if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); @@ -899,10 +897,6 @@ void KX_KetsjiEngine::Render() it++; } - - // Now change the camera back - scene->SetActiveCamera(cam); - PostRenderScene(scene); } @@ -1322,10 +1316,6 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) if (scene->GetPhysicsEnvironment()) scene->GetPhysicsEnvironment()->debugDrawWorld(); - -#ifdef WITH_PYTHON - scene->RunDrawingCallbacks(scene->GetPostDrawCB()); -#endif } void KX_KetsjiEngine::RenderFonts(KX_Scene* scene) @@ -1345,8 +1335,14 @@ To run once per scene */ void KX_KetsjiEngine::PostRenderScene(KX_Scene* scene) { + // We need to first make sure our viewport is correct (enabling multiple viewports can mess this up) + m_canvas->SetViewPort(0, 0, m_canvas->GetWidth(), m_canvas->GetHeight()); + m_rendertools->MotionBlur(m_rasterizer); scene->Render2DFilters(m_canvas); +#ifdef WITH_PYTHON + scene->RunDrawingCallbacks(scene->GetPostDrawCB()); +#endif m_rasterizer->FlushDebugLines(); } -- cgit v1.2.3 From 99d5fa70de605f1541aa035389a3c701c48a33c8 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Thu, 1 Sep 2011 21:47:46 +0000 Subject: BGE animations: This is an attempt to help smooth out some more compatibility issues with the new action actuator. It now has a similar pulse behavior to the old actuator. This has worked well in most of my tests, but YoFrankie still has problems, and it appears to have gotten a little worse. --- source/gameengine/Converter/BL_ActionActuator.cpp | 106 +++++++++++++++++----- source/gameengine/Converter/BL_ActionActuator.h | 4 +- 2 files changed, 85 insertions(+), 25 deletions(-) diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 50afac6992e..50e887a21a8 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -129,6 +129,50 @@ void BL_ActionActuator::SetBlendTime (float newtime){ m_blendframe = newtime; } +void BL_ActionActuator::SetLocalTime(float curtime) +{ + float dt = (curtime-m_starttime)*KX_KetsjiEngine::GetAnimFrameRate(); + + if (m_endframe < m_startframe) + dt = -dt; + + m_localtime = m_startframe + dt; + + // Handle wrap around + if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe)) + { + switch(m_playtype) + { + case ACT_ACTION_PLAY: + // Clamp + m_localtime = m_endframe; + break; + case ACT_ACTION_LOOP_END: + // Put the time back to the beginning + m_localtime = m_startframe; + m_starttime = curtime; + break; + case ACT_ACTION_PINGPONG: + // Swap the start and end frames + float temp = m_startframe; + m_startframe = m_endframe; + m_endframe = temp; + + m_starttime = curtime; + + break; + } + } +} + +void BL_ActionActuator::ResetStartTime(float curtime) +{ + float dt = m_localtime - m_startframe; + + m_starttime = curtime - dt / (KX_KetsjiEngine::GetAnimFrameRate()); + //SetLocalTime(curtime); +} + CValue* BL_ActionActuator::GetReplica() { BL_ActionActuator* replica = new BL_ActionActuator(*this);//m_float,GetName()); replica->ProcessReplica(); @@ -194,11 +238,46 @@ bool BL_ActionActuator::Update(double curtime, bool frame) RemoveAllEvents(); } + if (m_flag & ACT_FLAG_ATTEMPT_PLAY) + SetLocalTime(curtime); + if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE)) + { m_localtime = obj->GetActionFrame(m_layer); + ResetStartTime(curtime); + } + + // Handle a frame property if it's defined + if ((m_flag & ACT_FLAG_ACTIVE) && m_framepropname[0] != 0) + { + CValue* oldprop = obj->GetProperty(m_framepropname); + CValue* newval = new CFloatValue(obj->GetActionFrame(m_layer)); + if (oldprop) + oldprop->SetValue(newval); + else + obj->SetProperty(m_framepropname, newval); + + newval->Release(); + } + + // Handle a finished animation + if ((m_flag & ACT_FLAG_PLAY_END) && obj->IsActionDone(m_layer)) + { + m_flag &= ~ACT_FLAG_ACTIVE; + m_flag &= ~ACT_FLAG_ATTEMPT_PLAY; + obj->StopAction(m_layer); + return false; + } - if (bPositiveEvent) + // If a different action is playing, we've been overruled and are no longer active + if (obj->GetCurrentAction(m_layer) != m_action) + m_flag &= ~ACT_FLAG_ACTIVE; + + if (bPositiveEvent || (m_flag & ACT_FLAG_ATTEMPT_PLAY && !(m_flag & ACT_FLAG_ACTIVE))) { + if (bPositiveEvent) + ResetStartTime(curtime); + if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, playtype, m_layer_weight, m_ipo_flags)) { m_flag |= ACT_FLAG_ACTIVE; @@ -210,11 +289,11 @@ bool BL_ActionActuator::Update(double curtime, bool frame) else m_flag &= ~ACT_FLAG_PLAY_END; } - else - return false; + m_flag |= ACT_FLAG_ATTEMPT_PLAY; } else if ((m_flag & ACT_FLAG_ACTIVE) && bNegativeEvent) { + m_flag &= ~ACT_FLAG_ATTEMPT_PLAY; bAction *curr_action = obj->GetCurrentAction(m_layer); if (curr_action && curr_action != m_action) { @@ -259,27 +338,6 @@ bool BL_ActionActuator::Update(double curtime, bool frame) } } - // Handle a frame property if it's defined - if ((m_flag & ACT_FLAG_ACTIVE) && m_framepropname[0] != 0) - { - CValue* oldprop = obj->GetProperty(m_framepropname); - CValue* newval = new CFloatValue(obj->GetActionFrame(m_layer)); - if (oldprop) - oldprop->SetValue(newval); - else - obj->SetProperty(m_framepropname, newval); - - newval->Release(); - } - - // Handle a finished animation - if ((m_flag & ACT_FLAG_PLAY_END) && obj->IsActionDone(m_layer)) - { - m_flag &= ~ACT_FLAG_ACTIVE; - obj->StopAction(m_layer); - return false; - } - return true; } diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h index 5324cb10885..357c2b4a05e 100644 --- a/source/gameengine/Converter/BL_ActionActuator.h +++ b/source/gameengine/Converter/BL_ActionActuator.h @@ -64,6 +64,8 @@ public: virtual void ProcessReplica(); void SetBlendTime (float newtime); + void SetLocalTime (float curtime); + void ResetStartTime (float curtime); bAction* GetAction() { return m_action; } void SetAction(bAction* act) { m_action= act; } @@ -150,7 +152,7 @@ enum { ACT_FLAG_ACTIVE = 1<<3, ACT_FLAG_CONTINUE = 1<<4, ACT_FLAG_PLAY_END = 1<<5, - + ACT_FLAG_ATTEMPT_PLAY = 1<<6, }; #endif -- cgit v1.2.3 From 1f7b41775bcc8832355c13785c299156a870c749 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 2 Sep 2011 03:32:57 +0000 Subject: minor warning fixes, also correct some float -> double promotions in shadeoutput.c --- source/blender/blenkernel/intern/nla.c | 4 +++- source/blender/blenkernel/intern/sound.c | 2 ++ source/blender/render/intern/source/shadeoutput.c | 28 +++++++++++------------ source/tests/check_deprecated.py | 2 +- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 25f824bba19..53ccd55bde8 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -341,7 +341,7 @@ NlaStrip *add_nlastrip_to_stack (AnimData *adt, bAction *act) } /* Add a NLA Strip referencing the given speaker's sound */ -NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker) +NlaStrip *add_nla_soundstrip (Scene *UNUSED(scene), Speaker *speaker) { NlaStrip *strip = MEM_callocN(sizeof(NlaStrip), "NlaSoundStrip"); @@ -359,6 +359,8 @@ NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker) #endif { strip->end = 10.0f; + /* quiet compiler warnings */ + (void)speaker; } /* general settings */ diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 50a7b4a7a73..74f4830b86c 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -39,8 +39,10 @@ #include "BKE_sequencer.h" #include "BKE_scene.h" +#ifdef WITH_AUDASPACE // evil global ;-) static int sound_cfra; +#endif struct bSound* sound_new_file(struct Main *bmain, const char *filename) { diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 7f921d21041..30632586b04 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -282,10 +282,10 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) else if(ok1==0 || ok2==0) return; /* at least 1 visible interesction point */ - if(t1<0.0f && t2<0.0f) return; + if(t1<0.0 && t2<0.0) return; - if(t1<0.0f) t1= 0.0f; - if(t2<0.0f) t2= 0.0f; + if(t1<0.0) t1= 0.0; + if(t2<0.0) t2= 0.0; if(t1==t2) return; @@ -423,8 +423,8 @@ float fresnel_fac(float *view, float *vn, float grad, float fac) static double saacos_d(double fac) { - if(fac<= -1.0f) return M_PI; - else if(fac>=1.0f) return 0.0; + if(fac<= -1.0) return M_PI; + else if(fac>=1.0) return 0.0; else return acos(fac); } @@ -590,7 +590,7 @@ static float CookTorr_Spec(float *n, float *l, float *v, int hard, int tangent) i= spec(nh, hard); - i= i/(0.1+nv); + i= i/(0.1f+nv); return i; } @@ -896,7 +896,7 @@ static void ramp_diffuse_result(float *diff, ShadeInput *shi) if(ma->ramp_col) { if(ma->rampin_col==MA_RAMP_IN_RESULT) { - fac= 0.3*diff[0] + 0.58*diff[1] + 0.12*diff[2]; + fac= 0.3f*diff[0] + 0.58f*diff[1] + 0.12f*diff[2]; do_colorband(ma->ramp_col, fac, col); /* blending method */ @@ -926,7 +926,7 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa /* input */ switch(ma->rampin_col) { case MA_RAMP_IN_ENERGY: - fac= 0.3*r + 0.58*g + 0.12*b; + fac= 0.3f*r + 0.58f*g + 0.12f*b; break; case MA_RAMP_IN_SHADER: fac= is; @@ -966,7 +966,7 @@ static void ramp_spec_result(float *specr, float *specg, float *specb, ShadeInpu float fac; if(ma->ramp_spec && (ma->rampin_spec==MA_RAMP_IN_RESULT)) { - fac= 0.3*(*specr) + 0.58*(*specg) + 0.12*(*specb); + fac= 0.3f*(*specr) + 0.58f*(*specg) + 0.12f*(*specb); do_colorband(ma->ramp_spec, fac, col); /* blending method */ @@ -1213,7 +1213,7 @@ float lamp_get_visibility(LampRen *lar, float *co, float *lv, float *dist) } } } - if (visifac <= 0.001) visifac = 0.0f; + if (visifac <= 0.001f) visifac = 0.0f; return visifac; } } @@ -1231,7 +1231,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int view= shi->view; - if (lar->energy == 0.0) return; + if (lar->energy == 0.0f) return; /* only shadow lamps shouldn't affect shadow-less materials at all */ if ((lar->mode & LA_ONLYSHADOW) && (!(ma->mode & MA_SHADOW) || !(R.r.mode & R_SHADOW))) return; @@ -1359,7 +1359,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int /* 'is' is diffuse */ if((ma->shade_flag & MA_CUBIC) && is>0.0f && is<1.0f) - is= 3.0*is*is - 2.0*is*is*is; // nicer termination of shades + is= 3.0f*is*is - 2.0f*is*is*is; // nicer termination of shades i= is*phongcorr; @@ -1388,7 +1388,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int lamp_get_shadow(lar, shi, inp, shadfac, shi->depth); /* warning, here it skips the loop */ - if((lar->mode & LA_ONLYSHADOW) && i>0.0) { + if((lar->mode & LA_ONLYSHADOW) && i>0.0f) { shadfac[3]= i*lar->energy*(1.0f-shadfac[3]); shr->shad[0] -= shadfac[3]*shi->r*(1.0f-lashdw[0]); @@ -1448,7 +1448,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int t= vn[0]*lv[0]+vn[1]*lv[1]+vn[2]*lv[2]; if(lar->type==LA_HEMI) { - t= 0.5*t+0.5; + t= 0.5f*t+0.5f; } t= shadfac[3]*shi->spec*spec(t, shi->har); diff --git a/source/tests/check_deprecated.py b/source/tests/check_deprecated.py index 856e1f6d272..34b07518162 100644 --- a/source/tests/check_deprecated.py +++ b/source/tests/check_deprecated.py @@ -130,7 +130,7 @@ def deprecations(): def main(): import datetime - now = datetime.datetime.now()\ + now = datetime.datetime.now() deps = deprecations() -- cgit v1.2.3 From dc463db6c27242af464140582bc6708802d601e8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 2 Sep 2011 03:42:16 +0000 Subject: Credits generator which cross references with the patch tracker to credit the original authors. the script has a unix-name <> real-name mapping which is not totally complete since I couldn't find everyones real names. In this case the commit name is credited. Also added a link to the credits page in the splash. --- source/blender/windowmanager/intern/wm_operators.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index a4efa8fff84..c053022681b 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1259,11 +1259,12 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar split = uiLayoutSplit(layout, 0, 0); col = uiLayoutColumn(split, 0); uiItemL(col, "Links", ICON_NONE); - uiItemStringO(col, "Donations", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment/"); - uiItemStringO(col, "Release Log", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-259/"); + uiItemStringO(col, "Donations", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment"); + uiItemStringO(col, "Credits", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits"); + uiItemStringO(col, "Release Log", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-259"); uiItemStringO(col, "Manual", ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual"); - uiItemStringO(col, "Blender Website", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/"); - uiItemStringO(col, "User Community", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community/"); // + uiItemStringO(col, "Blender Website", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org"); + uiItemStringO(col, "User Community", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community"); if(strcmp(STRINGIFY(BLENDER_VERSION_CYCLE), "release")==0) { BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d" STRINGIFY(BLENDER_VERSION_CHAR) "_release", BLENDER_VERSION/100, BLENDER_VERSION%100); } -- cgit v1.2.3 From 4280e0a04fa06de82ba419ff7bc9436c3b190b3f Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Fri, 2 Sep 2011 03:57:37 +0000 Subject: BGE animations: adding a missing comma. --- doc/python_api/rst/bge.types.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/python_api/rst/bge.types.rst b/doc/python_api/rst/bge.types.rst index d9a93a945ed..b1277df4c90 100644 --- a/doc/python_api/rst/bge.types.rst +++ b/doc/python_api/rst/bge.types.rst @@ -1539,7 +1539,7 @@ Game Types (bge.types) Return the value matching key, or the default value if its not found. :return: The key value or a default. - .. method:: playAction(name, start_frame, end_frame, layer=0, priority=0 blendin=0, play_mode=ACT_MODE_PLAY, layer_weight=0.0, ipo_flags=0, speed=1.0) + .. method:: playAction(name, start_frame, end_frame, layer=0, priority=0, blendin=0, play_mode=ACT_MODE_PLAY, layer_weight=0.0, ipo_flags=0, speed=1.0) Plays an action. -- cgit v1.2.3 From dc7f56455c8a6e045a7a8ab683376ccc91ab8b93 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 2 Sep 2011 04:34:58 +0000 Subject: fix for error in recent commit, when audaspace is enabled --- source/blender/blenkernel/intern/nla.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 53ccd55bde8..6ce80342dd6 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -341,7 +341,7 @@ NlaStrip *add_nlastrip_to_stack (AnimData *adt, bAction *act) } /* Add a NLA Strip referencing the given speaker's sound */ -NlaStrip *add_nla_soundstrip (Scene *UNUSED(scene), Speaker *speaker) +NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker) { NlaStrip *strip = MEM_callocN(sizeof(NlaStrip), "NlaSoundStrip"); @@ -360,6 +360,7 @@ NlaStrip *add_nla_soundstrip (Scene *UNUSED(scene), Speaker *speaker) { strip->end = 10.0f; /* quiet compiler warnings */ + (void)scene; (void)speaker; } -- cgit v1.2.3 From e6ff3df5b980ebda24f14d0d211bb0739aa64f12 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 2 Sep 2011 07:51:19 +0000 Subject: fix for keymap search, was using uninitialized memory when the keymaps operator couldn't be found. --- source/blender/makesrna/intern/rna_wm.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 93adf808f83..4c07a89a42f 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -680,20 +680,14 @@ static void rna_wmKeyMapItem_name_get(PointerRNA *ptr, char *value) { wmKeyMapItem *kmi= ptr->data; wmOperatorType *ot= WM_operatortype_find(kmi->idname, 1); - - if (ot) - strcpy(value, ot->name); + strcpy(value, ot ? ot->name : kmi->idname); } static int rna_wmKeyMapItem_name_length(PointerRNA *ptr) { wmKeyMapItem *kmi= ptr->data; wmOperatorType *ot= WM_operatortype_find(kmi->idname, 1); - - if (ot) - return strlen(ot->name); - else - return 0; + return strlen(ot ? ot->name : kmi->idname); } static int rna_KeyMapItem_userdefined_get(PointerRNA *ptr) @@ -1652,7 +1646,9 @@ static void rna_def_keyconfig(BlenderRNA *brna) RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_idname_get", "rna_wmKeyMapItem_idname_length", "rna_wmKeyMapItem_idname_set"); RNA_def_struct_name_property(srna, prop); RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); - + + /* this is infact the operator name, but if the operator can't be found we + * fallback on the operator ID */ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Name", "Name of operator to call on input event"); -- cgit v1.2.3 From 1d9ddcd319908f6442b02623f7782413ecefa40a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 2 Sep 2011 08:01:01 +0000 Subject: tweak to WM_operatortype_find to perform better when called with empty strings (as the keymap editor does a lot) --- source/blender/windowmanager/intern/wm_operators.c | 25 ++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index c053022681b..0e0203543a4 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -108,21 +108,28 @@ static GHash *global_ops_hash= NULL; wmOperatorType *WM_operatortype_find(const char *idname, int quiet) { - wmOperatorType *ot; - - char idname_bl[OP_MAX_TYPENAME]; // XXX, needed to support python style names without the _OT_ syntax - WM_operator_bl_idname(idname_bl, idname); + if(idname[0]) { + wmOperatorType *ot; + + /* needed to support python style names without the _OT_ syntax */ + char idname_bl[OP_MAX_TYPENAME]; + WM_operator_bl_idname(idname_bl, idname); - if (idname_bl[0]) { ot= BLI_ghash_lookup(global_ops_hash, idname_bl); if(ot) { return ot; } + + if(!quiet) { + printf("search for unknown operator '%s', '%s'\n", idname_bl, idname); + } } - - if(!quiet) - printf("search for unknown operator %s, %s\n", idname_bl, idname); - + else { + if(!quiet) { + printf("search for empty operator\n"); + } + } + return NULL; } -- cgit v1.2.3 From 8276989f63267c906fcf933dcf557bc35fa1cb8c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 2 Sep 2011 08:20:30 +0000 Subject: fix [#28460] SEGFAULT when trying to make empty display as image --- source/blender/editors/animation/anim_filter.c | 47 ++++++++++++++------------ 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 8010a41ccb3..bb710a32794 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1177,29 +1177,34 @@ static size_t animfilter_nla (bAnimContext *UNUSED(ac), ListBase *anim_data, bDo /* determine what animation data from AnimData block should get displayed */ static size_t animfilter_block_data (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *id, int filter_mode) { - IdAdtTemplate *iat = (IdAdtTemplate*)id; AnimData *adt = BKE_animdata_from_id(id); size_t items = 0; - - /* NOTE: this macro is used instead of inlining the logic here, since this sort of filtering is still needed - * in a few places in he rest of the code still - notably for the few cases where special mode-based - * different types of data expanders are required. - */ - ANIMDATA_FILTER_CASES(iat, - { /* AnimData */ - /* specifically filter animdata block */ - ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_ANIMDATA, id); - }, - { /* NLA */ - items += animfilter_nla(ac, anim_data, ads, adt, filter_mode, id); - }, - { /* Drivers */ - items += animfilter_fcurves(anim_data, ads, adt->drivers.first, NULL, filter_mode, id); - }, - { /* Keyframes */ - items += animfilter_action(ac, anim_data, ads, adt->action, filter_mode, id); - }); - + + /* image object datablocks have no anim-data so check for NULL */ + if(adt) { + IdAdtTemplate *iat = (IdAdtTemplate*)id; + + /* NOTE: this macro is used instead of inlining the logic here, since this sort of filtering is still needed + * in a few places in he rest of the code still - notably for the few cases where special mode-based + * different types of data expanders are required. + */ + ANIMDATA_FILTER_CASES(iat, + { /* AnimData */ + /* specifically filter animdata block */ + ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_ANIMDATA, id); + }, + { /* NLA */ + items += animfilter_nla(ac, anim_data, ads, adt, filter_mode, id); + }, + { /* Drivers */ + items += animfilter_fcurves(anim_data, ads, adt->drivers.first, NULL, filter_mode, id); + }, + { /* Keyframes */ + items += animfilter_action(ac, anim_data, ads, adt->action, filter_mode, id); + } + ); + } + return items; } -- cgit v1.2.3 From 612e2d4dbe0e8dfe5b4d4fee49040ec38107ada3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 2 Sep 2011 08:35:46 +0000 Subject: patch [#28473] Outliner Simple Todo from Julien DUROURE (julien) --- * right click --> rename, as proposed on http://wiki.blender.org/index.php/Dev:2.5/Source/Development/Todo/Simple_Todos * implementation of Toggle visibility/rendarability/selectability on right click on Groups ( was in menu, but not implemented ) --- .../blender/editors/space_outliner/outliner_draw.c | 2 +- .../blender/editors/space_outliner/outliner_edit.c | 64 ++++++++++++++++------ .../editors/space_outliner/outliner_intern.h | 8 +++ .../editors/space_outliner/outliner_tools.c | 42 ++++++++++++-- 4 files changed, 94 insertions(+), 22 deletions(-) diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 0cb05fa2115..95a315272b9 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -236,7 +236,7 @@ static int group_select_flag(Group *gr) return 0; } -static void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag) +void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag) { Scene *scene = (Scene *)poin; GroupObject *gob; diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index fbd5281b1d9..2b451a48748 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -218,6 +218,34 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot) /* Rename --------------------------------------------------- */ +void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports) +{ + /* can't rename rna datablocks entries */ + if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) + ; + else if(ELEM10(tselem->type, TSE_ANIM_DATA, 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)) + BKE_report(reports, RPT_WARNING, "Cannot edit builtin name"); + else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) + BKE_report(reports, RPT_WARNING, "Cannot edit sequence name"); + else if(tselem->id->lib) { + // XXX error_libdata(); + } + else if(te->idcode == ID_LI && te->parent) { + BKE_report(reports, RPT_WARNING, "Cannot edit the path of an indirectly linked library"); + } + else { + tselem->flag |= TSE_TEXTBUT; + ED_region_tag_redraw(ar); + } +} + +void item_rename_cb(bContext *C, Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) +{ + ARegion *ar= CTX_wm_region(C); + ReportList *reports= CTX_wm_reports(C); // XXX + do_item_rename(ar, te, tselem, reports) ; +} + static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, TreeElement *te, const float mval[2]) { ReportList *reports= CTX_wm_reports(C); // XXX @@ -228,23 +256,7 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T /* name and first icon */ if(mval[0]>te->xs+UI_UNIT_X && mval[0]xend) { - /* can't rename rna datablocks entries */ - if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) - ; - else if(ELEM10(tselem->type, TSE_ANIM_DATA, 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)) - BKE_report(reports, RPT_WARNING, "Cannot edit builtin name"); - else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) - BKE_report(reports, RPT_WARNING, "Cannot edit sequence name"); - else if(tselem->id->lib) { - // XXX error_libdata(); - } - else if(te->idcode == ID_LI && te->parent) { - BKE_report(reports, RPT_WARNING, "Cannot edit the path of an indirectly linked library"); - } - else { - tselem->flag |= TSE_TEXTBUT; - ED_region_tag_redraw(ar); - } + do_item_rename(ar, te, tselem, reports) ; } return 1; } @@ -377,6 +389,12 @@ void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, Tre } } +void group_toggle_visibility_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) +{ + Group *group= (Group *)tselem->id; + restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_VIEW); +} + static int outliner_toggle_visibility_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); @@ -417,6 +435,12 @@ void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme } } +void group_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) +{ + Group *group= (Group *)tselem->id; + restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_SELECT); +} + static int outliner_toggle_selectability_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); @@ -457,6 +481,12 @@ void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme } } +void group_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) +{ + Group *group= (Group *)tselem->id; + restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_RENDER); +} + static int outliner_toggle_renderability_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 9da09144125..2ddb5707623 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -139,6 +139,7 @@ void outliner_build_tree(struct Main *mainvar, struct Scene *scene, struct Space /* outliner_draw.c ---------------------------------------------- */ void draw_outliner(const struct bContext *C); +void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag); /* outliner_select.c -------------------------------------------- */ int tree_element_type_active(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set); @@ -158,6 +159,13 @@ void object_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeEl void object_toggle_selectability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem); void object_toggle_renderability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem); + +void group_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem); +void group_toggle_selectability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem); +void group_toggle_renderability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem); + +void item_rename_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem); + /* ...................................................... */ void OUTLINER_OT_item_activate(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 3ae158bd275..70dfbfe3830 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -510,6 +510,7 @@ static EnumPropertyItem prop_object_op_types[] = { {6, "TOGVIS", 0, "Toggle Visible", ""}, {7, "TOGSEL", 0, "Toggle Selectable", ""}, {8, "TOGREN", 0, "Toggle Renderable", ""}, + {9, "RENAME", 0, "Rename", ""}, {0, NULL, 0, NULL, NULL} }; @@ -567,6 +568,10 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) str= "Toggle Renderability"; WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, scene); } + else if(event==9) { + outliner_do_object_operation(C, scene, soops, &soops->tree, item_rename_cb); + str= "Rename Object"; + } ED_undo_push(C, str); @@ -600,6 +605,7 @@ static EnumPropertyItem prop_group_op_types[] = { {4, "TOGVIS", 0, "Toggle Visible", ""}, {5, "TOGSEL", 0, "Toggle Selectable", ""}, {6, "TOGREN", 0, "Toggle Renderable", ""}, + {7, "RENAME", 0, "Rename", ""}, {0, NULL, 0, NULL, NULL} }; @@ -608,6 +614,7 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); SpaceOops *soops= CTX_wm_space_outliner(C); int event; + const char *str= NULL; /* check for invalid states */ if (soops == NULL) @@ -617,18 +624,35 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op) if(event==1) { outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb); - ED_undo_push(C, "Unlink group"); + str= "Unlink group"; } else if(event==2) { outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb); - ED_undo_push(C, "Localized Data"); + str= "Localized Data"; } else if(event==3) { outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb); - ED_undo_push(C, "Link Group Objects to Scene"); + str= "Link Group Objects to Scene"; + } + else if(event==4) { + outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_visibility_cb); + str= "Toggle Visibility"; + } + else if(event==5) { + outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_selectability_cb); + str= "Toggle Selectability"; + } + else if(event==6) { + outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_renderability_cb); + str= "Toggle Renderability"; + } + else if(event==7) { + outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb); + str= "Rename"; } + ED_undo_push(C, str); WM_event_add_notifier(C, NC_GROUP, NULL); return OPERATOR_FINISHED; @@ -662,7 +686,8 @@ typedef enum eOutlinerIdOpTypes { OUTLINER_IDOP_SINGLE, OUTLINER_IDOP_FAKE_ADD, - OUTLINER_IDOP_FAKE_CLEAR + OUTLINER_IDOP_FAKE_CLEAR, + OUTLINER_IDOP_RENAME } eOutlinerIdOpTypes; // TODO: implement support for changing the ID-block used @@ -672,6 +697,7 @@ static EnumPropertyItem prop_id_op_types[] = { {OUTLINER_IDOP_SINGLE, "SINGLE", 0, "Make Single User", ""}, {OUTLINER_IDOP_FAKE_ADD, "ADD_FAKE", 0, "Add Fake User", "Ensure datablock gets saved even if it isn't in use (e.g. for motion and material libraries)"}, {OUTLINER_IDOP_FAKE_CLEAR, "CLEAR_FAKE", 0, "Clear Fake User", ""}, + {OUTLINER_IDOP_RENAME, "RENAME", 0, "Rename", ""}, {0, NULL, 0, NULL, NULL} }; @@ -765,6 +791,14 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) ED_undo_push(C, "Clear Fake User"); } break; + case OUTLINER_IDOP_RENAME: + /* rename */ + outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb); + + WM_event_add_notifier(C, NC_ID|NA_EDITED, NULL); + ED_undo_push(C, "Rename"); + + break; default: // invalid - unhandled -- cgit v1.2.3 From 7a496bfbcf3c5a25d4101cf427ca980327ed3e8a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 2 Sep 2011 09:39:21 +0000 Subject: Partial fix for #28441: Tab width in texteditor ignored if used tabs as spaces Scroll to cursor when displaying text datablock was changed. This behavior was lost in 2.5x. --- source/blender/editors/space_text/space_text.c | 5 +++++ source/blender/editors/space_text/text_draw.c | 19 +++++++++++++------ source/blender/editors/space_text/text_intern.h | 1 + source/blender/makesrna/intern/rna_space.c | 3 ++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index c7d4d78422e..47f051e1ec4 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -154,6 +154,11 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn) case NA_REMOVED: ED_area_tag_redraw(sa); break; + case NA_SELECTED: + if(st->text && st->text == wmn->reference) + text_scroll_to_cursor(st, sa); + + break; } break; diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 28230b7a48b..066404f23ba 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1821,12 +1821,10 @@ void text_update_character_width(SpaceText *st) /* Moves the view to the cursor location, also used to make sure the view isnt outside the file */ -void text_update_cursor_moved(bContext *C) +void text_scroll_to_cursor(SpaceText *st, ScrArea *sa) { - ScrArea *sa= CTX_wm_area(C); - SpaceText *st= CTX_wm_space_text(C); Text *text; - ARegion *ar; + ARegion *ar= NULL; int i, x, winx= 0; if(ELEM3(NULL, st, st->text, st->text->curl)) return; @@ -1834,8 +1832,10 @@ void text_update_cursor_moved(bContext *C) text= st->text; for(ar=sa->regionbase.first; ar; ar= ar->next) - if(ar->regiontype==RGN_TYPE_WINDOW) + if(ar->regiontype==RGN_TYPE_WINDOW) { winx= ar->winx; + break; + } winx -= TXT_SCROLL_WIDTH; @@ -1844,7 +1844,7 @@ void text_update_cursor_moved(bContext *C) i= txt_get_span(text->lines.first, text->sell); if(st->wordwrap) { int offl, offc; - wrap_offset(st, CTX_wm_region(C), text->sell, text->selc, &offl, &offc); + wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); i+= offl; } @@ -1865,3 +1865,10 @@ void text_update_cursor_moved(bContext *C) if(st->left <0) st->left= 0; } +void text_update_cursor_moved(bContext *C) +{ + ScrArea *sa= CTX_wm_area(C); + SpaceText *st= CTX_wm_space_text(C); + + text_scroll_to_cursor(st, sa); +} diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index cb55f41acb5..b34c7815f35 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -55,6 +55,7 @@ int text_font_width(struct SpaceText *st, const char *str); void text_update_line_edited(struct TextLine *line); void text_update_edited(struct Text *text); void text_update_character_width(struct SpaceText *st); +void text_scroll_to_cursor(struct SpaceText *st, struct ScrArea *sa); void text_update_cursor_moved(struct bContext *C); /* TXT_OFFSET used to be 35 when the scrollbar was on the left... */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 8f3097e5589..7a7debe1bf5 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -591,7 +591,8 @@ static void rna_SpaceTextEditor_text_set(PointerRNA *ptr, PointerRNA value) SpaceText *st= (SpaceText*)(ptr->data); st->text= value.data; - st->top= 0; + + WM_main_add_notifier(NC_TEXT|NA_SELECTED, st->text); } static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) -- cgit v1.2.3 From 15afd240e04ef3f220b6133cc920d964dbcfcf85 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 2 Sep 2011 10:43:51 +0000 Subject: paranoid check that RNA string functions set the string, would have helped solve keymap search bug. disabled in release mode. --- source/blender/makesrna/intern/rna_access.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 0d4e31cdaf2..ad79771416d 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2216,8 +2216,17 @@ char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fi else buf= MEM_mallocN(sizeof(char)*(length+1), "RNA_string_get_alloc"); +#ifndef NDEBUG + /* safety check to ensure the string is actually set */ + buf[length]= 255; +#endif + RNA_property_string_get(ptr, prop, buf); +#ifndef NDEBUG + BLI_assert(buf[length] == '\0'); +#endif + return buf; } -- cgit v1.2.3 From 3386563368f1e489a40e86671933af385e4073f9 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 2 Sep 2011 12:26:57 +0000 Subject: Bugfix [#28435] Key Visual transform and Parenting not working After reviewing this code, it seems that this case can work after all. However, several things needed to be tweaked: 1) Removed check which stopped parented objects from getting the visual keying coordinates determined. This actually wasn't doing anything, given that this case would never occur as... 2) Tweaked the visualkey_can_use() function to also consider parenting as a cause for visual-keying to be necessary. --- source/blender/editors/animation/keyframing.c | 73 ++++++++++++++------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 4e87409b7fd..53c9fc4d82c 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -530,6 +530,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop) { bConstraint *con= NULL; short searchtype= VISUALKEY_NONE; + short has_parent = FALSE; char *identifier= NULL; /* validate data */ @@ -548,6 +549,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop) con= ob->constraints.first; identifier= (char *)RNA_property_identifier(prop); + has_parent= (ob->parent != NULL); } else if (ptr->type == &RNA_PoseBone) { /* Pose Channel */ @@ -555,10 +557,11 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop) con= pchan->constraints.first; identifier= (char *)RNA_property_identifier(prop); + has_parent= (pchan->parent != NULL); } /* check if any data to search using */ - if (ELEM(NULL, con, identifier)) + if (ELEM(NULL, con, identifier) && (has_parent == FALSE)) return 0; /* location or rotation identifiers only... */ @@ -573,7 +576,12 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop) /* only search if a searchtype and initial constraint are available */ - if (searchtype && con) { + if (searchtype) { + /* parent is always matching */ + if (has_parent) + return 1; + + /* constraints */ for (; con; con= con->next) { /* only consider constraint if it is not disabled, and has influence */ if (con->flag & CONSTRAINT_DISABLE) continue; @@ -645,39 +653,34 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_ if (ptr->type == &RNA_Object) { Object *ob= (Object *)ptr->data; - /* parented objects are not supported, as the effects of the parent - * are included in the matrix, which kindof beats the point - */ - if (ob->parent == NULL) { - /* only Location or Rotation keyframes are supported now */ - if (strstr(identifier, "location")) { - return ob->obmat[3][array_index]; - } - else if (strstr(identifier, "rotation_euler")) { - float eul[3]; - - mat4_to_eulO(eul, ob->rotmode, ob->obmat); - return eul[array_index]; - } - else if (strstr(identifier, "rotation_quaternion")) { - float trimat[3][3], quat[4]; - - copy_m3_m4(trimat, ob->obmat); - mat3_to_quat_is_ok(quat, trimat); - - return quat[array_index]; - } - else if (strstr(identifier, "rotation_axis_angle")) { - float axis[3], angle; - - mat4_to_axis_angle(axis, &angle, ob->obmat); - - /* w = 0, x,y,z = 1,2,3 */ - if (array_index == 0) - return angle; - else - return axis[array_index - 1]; - } + /* only Location or Rotation keyframes are supported now */ + if (strstr(identifier, "location")) { + return ob->obmat[3][array_index]; + } + else if (strstr(identifier, "rotation_euler")) { + float eul[3]; + + mat4_to_eulO(eul, ob->rotmode, ob->obmat); + return eul[array_index]; + } + else if (strstr(identifier, "rotation_quaternion")) { + float trimat[3][3], quat[4]; + + copy_m3_m4(trimat, ob->obmat); + mat3_to_quat_is_ok(quat, trimat); + + return quat[array_index]; + } + else if (strstr(identifier, "rotation_axis_angle")) { + float axis[3], angle; + + mat4_to_axis_angle(axis, &angle, ob->obmat); + + /* w = 0, x,y,z = 1,2,3 */ + if (array_index == 0) + return angle; + else + return axis[array_index - 1]; } } else if (ptr->type == &RNA_PoseBone) { -- cgit v1.2.3 From 6b4bdf621f2830ceff2c44f871523a312422a338 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 2 Sep 2011 13:23:44 +0000 Subject: Fix #28467: Crash while deleting objects in outliner too fast Cleanup tree when handling object delete from outliner. Prevents handling the same tree item twice when clicking fast. --- source/blender/editors/space_outliner/outliner_intern.h | 1 + source/blender/editors/space_outliner/outliner_tools.c | 9 +++++++++ source/blender/editors/space_outliner/outliner_tree.c | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 2ddb5707623..61507d1ffe5 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -129,6 +129,7 @@ typedef struct TreeElement { /* outliner_tree.c ----------------------------------------------- */ void outliner_free_tree(ListBase *lb); +void outliner_cleanup_tree(struct SpaceOops *soops); TreeElement *outliner_find_tse(struct SpaceOops *soops, TreeStoreElem *tse); TreeElement *outliner_find_id(struct SpaceOops *soops, ListBase *lb, struct ID *id); diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 70dfbfe3830..b3170f9cd1e 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -287,6 +287,8 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto if(base==NULL) base= object_in_scene((Object *)tselem->id, scene); if(base) { + SpaceOops *soops= CTX_wm_space_outliner(C); + // check also library later if(scene->obedit==base->object) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); @@ -294,6 +296,13 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto ED_base_object_free_and_unlink(CTX_data_main(C), scene, base); te->directdata= NULL; tselem->id= NULL; + + /* XXX: tree management normally happens from draw_outliner(), but when + you're clicking to fast on Delete object from context menu in + outliner several mouse events can be handled in one cycle without + handling notifiers/redraw which leads to deleting the same object twice. + cleanup tree here to prevent such cases. */ + outliner_cleanup_tree(soops); } } diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 0b07c824f3e..8904dcc360f 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -222,6 +222,12 @@ void outliner_free_tree(ListBase *lb) } } +void outliner_cleanup_tree(SpaceOops *soops) +{ + outliner_free_tree(&soops->tree); + outliner_storage_cleanup(soops); +} + /* Find ith item from the treestore */ static TreeElement *outliner_find_tree_element(ListBase *lb, int store_index) { -- cgit v1.2.3 From 2fb2075c5b3495fede6980b4f9247f9e89c39d39 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 2 Sep 2011 15:19:30 +0000 Subject: Fix #28280: Insert Hook wrong index Use quite easy and stupid approach like it used for shape keys: re-make editmesh (editcurve or editlattice) before creating index array for hook or storing vertex index in parenting object. Even if hook was added in "current" edit mode, it should be re-mapped on loading edit data because topology could be changed after it was created. Such kind of re-loading edit structures is the easiest way for now to update keyindexes to relevant state. Also, fixed bug with not re-mapping indices for vertex-parented objects. Really old error, not sure why it wasn't noticed yet. --- source/blender/editors/mesh/editmesh.c | 2 +- source/blender/editors/object/object_hook.c | 21 ++++++++++++++++---- source/blender/editors/object/object_relations.c | 25 ++++++++++++++++++++---- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index 4377fb03632..e371c346f36 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -1099,7 +1099,7 @@ void load_editMesh(Scene *scene, Object *obedit) int j; for (ob=G.main->object.first; ob; ob=ob->id.next) { - if (ob->parent==ob && ELEM(ob->partype, PARVERT1,PARVERT3)) { + if (ob->parent==obedit && ELEM(ob->partype, PARVERT1,PARVERT3)) { /* duplicate code from below, make it function later...? */ if (!vertMap) { diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index bb32869469a..266556773f0 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -64,6 +64,7 @@ #include "ED_curve.h" #include "ED_mesh.h" +#include "ED_lattice.h" #include "ED_screen.h" #include "WM_types.h" @@ -292,7 +293,7 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo return totvert; } -static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char *name, float *cent_r) +static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int **indexar, char *name, float *cent_r) { *indexar= NULL; *tot= 0; @@ -302,7 +303,12 @@ static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char case OB_MESH: { Mesh *me= obedit->data; - EditMesh *em = BKE_mesh_get_editmesh(me); + EditMesh *em; + + load_editMesh(scene, obedit); + make_editMesh(scene, obedit); + + em = BKE_mesh_get_editmesh(me); /* check selected vertices first */ if( return_editmesh_indexar(em, tot, indexar, cent_r)) { @@ -316,10 +322,17 @@ static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char } case OB_CURVE: case OB_SURF: + load_editNurb(obedit); + make_editNurb(obedit); + return return_editcurve_indexar(obedit, tot, indexar, cent_r); case OB_LATTICE: { Lattice *lt= obedit->data; + + load_editLatt(obedit); + make_editLatt(obedit); + return return_editlattice_indexar(lt->editlatt->latt, tot, indexar, cent_r); } default: @@ -427,7 +440,7 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o int tot, ok, *indexar; char name[32]; - ok = object_hook_index_array(obedit, &tot, &indexar, name, cent); + ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent); if (!ok) return; // XXX error("Requires selected vertices or active Vertex Group"); @@ -760,7 +773,7 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op) /* assign functionality */ - if(!object_hook_index_array(ob, &tot, &indexar, name, cent)) { + if(!object_hook_index_array(CTX_data_scene(C), ob, &tot, &indexar, name, cent)) { BKE_report(op->reports, RPT_WARNING, "Requires selected vertices or active vertex group"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index e9418ca9f9f..b9208e778c7 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -91,6 +91,8 @@ #include "ED_armature.h" #include "ED_curve.h" +#include "ED_lattice.h" +#include "ED_mesh.h" #include "ED_keyframing.h" #include "ED_object.h" #include "ED_screen.h" @@ -122,7 +124,12 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) if(obedit->type==OB_MESH) { Mesh *me= obedit->data; - EditMesh *em = BKE_mesh_get_editmesh(me); + EditMesh *em; + + load_editMesh(scene, obedit); + make_editMesh(scene, obedit); + + em = BKE_mesh_get_editmesh(me); eve= em->verts.first; while(eve) { @@ -140,7 +147,12 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) BKE_mesh_end_editmesh(me, em); } else if(ELEM(obedit->type, OB_SURF, OB_CURVE)) { - ListBase *editnurb= curve_get_editcurve(obedit); + ListBase *editnurb; + + load_editNurb(obedit); + make_editNurb(obedit); + + editnurb= curve_get_editcurve(obedit); cu= obedit->data; @@ -180,8 +192,13 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) } } else if(obedit->type==OB_LATTICE) { - Lattice *lt= obedit->data; - + Lattice *lt; + + load_editLatt(obedit); + make_editLatt(obedit); + + lt= obedit->data; + a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw; bp= lt->editlatt->latt->def; while(a--) { -- cgit v1.2.3 From 87cb3f8519c942e19b20ac2b6bbe82fd28b95b3c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 2 Sep 2011 17:58:09 +0000 Subject: Fix crash caused by recently added assert about if string was set properly. Memory Estimate is actually 31 characters length, str[31] is a null-terminator. Return length of 31 for memory estimate property. Returning proper length would lead to slowdown because of 2x iteration through vertices. --- source/blender/makesrna/intern/rna_fluidsim.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index 1ba2e32502f..ccb24d7dd9b 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -184,7 +184,11 @@ static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *v static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *ptr) { - return 32; +#ifdef DISABLE_ELBEEM + return 0; +#else + return 31; +#endif } static char *rna_FluidSettings_path(PointerRNA *ptr) -- cgit v1.2.3 From 5193526aebccceb5fb6420e6a703f9b974247078 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 2 Sep 2011 18:05:07 +0000 Subject: Add missed notifier when toggling object's force field. --- source/blender/editors/object/object_edit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 61734bc51a2..79cbfb6574b 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1411,6 +1411,8 @@ static int forcefield_toggle_exec(bContext *C, wmOperator *UNUSED(op)) else ob->pd->forcefield = 0; + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL); + return OPERATOR_FINISHED; } -- cgit v1.2.3 From 8e3d1084b2a73aaa308ceda7a2e777e3d1990690 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 2 Sep 2011 19:25:32 +0000 Subject: Fix for grid lines drawing outside of histogram widget. --- source/blender/editors/interface/interface_draw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 76ed9891b8e..2267f04aab4 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -770,7 +770,11 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) glColor4f(0.f, 0.f, 0.f, 0.3f); uiSetRoundBox(15); uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f); - + + /* need scissor test, histogram can draw outside of boundary */ + glGetIntegerv(GL_VIEWPORT, scissor); + glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1)); + glColor4f(1.f, 1.f, 1.f, 0.08f); /* draw grid lines here */ for (i=1; i<4; i++) { @@ -778,10 +782,6 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) fdrawline(rect.xmin+(i/4.f)*w, rect.ymin, rect.xmin+(i/4.f)*w, rect.ymax); } - /* need scissor test, histogram can draw outside of boundary */ - glGetIntegerv(GL_VIEWPORT, scissor); - glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1)); - if (hist->mode == HISTO_MODE_LUMA) histogram_draw_one(1.0, 1.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_luma, res); else { -- cgit v1.2.3 From 0cd5dce245762b3fb3fd195dde3bd9ddaeb48970 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 3 Sep 2011 02:15:49 +0000 Subject: whitespace edits --- source/blender/python/intern/bpy_rna.c | 300 +++++++++--------- .../BlenderRoutines/KX_BlenderInputDevice.h | 334 ++++++++++----------- source/gameengine/Converter/BL_MeshDeformer.h | 2 +- source/gameengine/Converter/BL_ShapeDeformer.h | 4 +- .../Converter/KX_BlenderSceneConverter.cpp | 2 +- .../gameengine/Converter/KX_ConvertActuators.cpp | 2 +- source/gameengine/GameLogic/SCA_2DFilterActuator.h | 22 +- source/gameengine/GameLogic/SCA_PythonController.h | 2 +- source/gameengine/GameLogic/SCA_RandomActuator.cpp | 4 +- .../GamePlayer/ghost/GPG_Application.cpp | 2 +- .../Ketsji/KXNetwork/KX_NetworkEventManager.h | 4 +- source/gameengine/Ketsji/KX_GameObject.cpp | 2 +- source/gameengine/Ketsji/KX_ObjectActuator.cpp | 6 +- .../Ketsji/KX_OrientationInterpolator.cpp | 4 +- source/gameengine/Ketsji/KX_PolygonMaterial.cpp | 2 +- source/gameengine/Ketsji/KX_TrackToActuator.h | 2 +- .../NG_LoopBackNetworkDeviceInterface.h | 4 +- .../gameengine/Network/NG_NetworkDeviceInterface.h | 2 +- .../Physics/Bullet/CcdPhysicsController.h | 12 +- .../Physics/Bullet/CcdPhysicsEnvironment.cpp | 4 +- .../Physics/Bullet/CcdPhysicsEnvironment.h | 2 +- .../gameengine/Rasterizer/RAS_2DFilterManager.cpp | 4 +- source/gameengine/Rasterizer/RAS_CameraData.h | 26 +- .../RAS_OpenGLFilters/RAS_Blur2DFilter.h | 18 +- .../RAS_OpenGLFilters/RAS_Dilation2DFilter.h | 18 +- .../RAS_OpenGLFilters/RAS_Erosion2DFilter.h | 22 +- .../RAS_OpenGLFilters/RAS_Laplacian2DFilter.h | 20 +- .../RAS_OpenGLFilters/RAS_Prewitt2DFilter.h | 26 +- .../RAS_OpenGLFilters/RAS_Sharpen2DFilter.h | 20 +- .../RAS_OpenGLFilters/RAS_Sobel2DFilter.h | 26 +- source/gameengine/SceneGraph/SG_DList.h | 130 ++++---- source/gameengine/SceneGraph/SG_IObject.h | 2 +- source/gameengine/SceneGraph/SG_QList.h | 100 +++--- source/gameengine/SceneGraph/SG_Spatial.cpp | 2 +- source/gameengine/VideoTexture/Exception.h | 10 +- source/gameengine/VideoTexture/ImageBase.cpp | 2 +- source/gameengine/VideoTexture/ImageRender.cpp | 10 +- 37 files changed, 576 insertions(+), 578 deletions(-) diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 6de3c040c18..d10c8c843e8 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -4631,28 +4631,28 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject /* note: tp_base member is set to &PyType_Type on init */ PyTypeObject pyrna_struct_meta_idprop_Type= { PyVarObject_HEAD_INIT(NULL, 0) - "bpy_struct_meta_idprop", /* tp_name */ - sizeof(PyHeapTypeObject), /* tp_basicsize */ // XXX, would be PyTypeObject, but subtypes of Type must be PyHeapTypeObject's - 0, /* tp_itemsize */ + "bpy_struct_meta_idprop", /* tp_name */ + sizeof(PyHeapTypeObject), /* tp_basicsize */ // XXX, would be PyTypeObject, but subtypes of Type must be PyHeapTypeObject's + 0, /* tp_itemsize */ /* methods */ - NULL, /* tp_dealloc */ + NULL, /* tp_dealloc */ NULL, /* printfunc tp_print; */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, /* tp_compare */ /* deprecated in python 3.0! */ - NULL, /* tp_repr */ + NULL, /* getattrfunc tp_getattr; */ + NULL, /* setattrfunc tp_setattr; */ + NULL, /* tp_compare */ /* deprecated in python 3.0! */ + NULL, /* tp_repr */ /* Method suites for standard classes */ NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ + NULL, /* PySequenceMethods *tp_as_sequence; */ + NULL, /* PyMappingMethods *tp_as_mapping; */ /* More standard operations (here for binary compatibility) */ - NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - NULL /*(getattrofunc) pyrna_struct_meta_idprop_getattro*/, /* getattrofunc tp_getattro; */ - (setattrofunc) pyrna_struct_meta_idprop_setattro, /* setattrofunc tp_setattro; */ + NULL, /* hashfunc tp_hash; */ + NULL, /* ternaryfunc tp_call; */ + NULL, /* reprfunc tp_str; */ + NULL /*(getattrofunc) pyrna_struct_meta_idprop_getattro*/, /* getattrofunc tp_getattro; */ + (setattrofunc) pyrna_struct_meta_idprop_setattro, /* setattrofunc tp_setattro; */ /* Functions to access object as input/output buffer */ NULL, /* PyBufferProcs *tp_as_buffer; */ @@ -4660,7 +4660,7 @@ PyTypeObject pyrna_struct_meta_idprop_Type= { /*** Flags to define presence of optional/expanded features ***/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ - NULL, /* char *tp_doc; Documentation string */ + NULL, /* char *tp_doc; Documentation string */ /*** Assigned meaning in release 2.0 ***/ /* call function for all accessible objects */ NULL, /* traverseproc tp_traverse; */ @@ -4670,7 +4670,7 @@ PyTypeObject pyrna_struct_meta_idprop_Type= { /*** Assigned meaning in release 2.1 ***/ /*** rich comparisons ***/ - NULL, /* richcmpfunc tp_richcompare; */ + NULL, /* richcmpfunc tp_richcompare; */ /*** weak reference enabler ***/ 0, /* long tp_weaklistoffset; */ @@ -4681,9 +4681,9 @@ PyTypeObject pyrna_struct_meta_idprop_Type= { NULL, /* iternextfunc tp_iternext; */ /*** Attribute descriptor and subclassing stuff ***/ - NULL, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMethodDef *tp_methods; */ NULL, /* struct PyMemberDef *tp_members; */ - NULL, /* struct PyGetSetDef *tp_getset; */ + NULL, /* struct PyGetSetDef *tp_getset; */ NULL, /* struct _typeobject *tp_base; */ NULL, /* PyObject *tp_dict; */ NULL, /* descrgetfunc tp_descr_get; */ @@ -4691,7 +4691,7 @@ PyTypeObject pyrna_struct_meta_idprop_Type= { 0, /* long tp_dictoffset; */ NULL, /* initproc tp_init; */ NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ + NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ @@ -4709,45 +4709,45 @@ PyTypeObject pyrna_struct_meta_idprop_Type= { /*-----------------------BPy_StructRNA method def------------------------------*/ PyTypeObject pyrna_struct_Type= { PyVarObject_HEAD_INIT(NULL, 0) - "bpy_struct", /* tp_name */ - sizeof(BPy_StructRNA), /* tp_basicsize */ - 0, /* tp_itemsize */ + "bpy_struct", /* tp_name */ + sizeof(BPy_StructRNA), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ (destructor) pyrna_struct_dealloc,/* tp_dealloc */ NULL, /* printfunc tp_print; */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ - (reprfunc) pyrna_struct_repr, /* tp_repr */ + NULL, /* getattrfunc tp_getattr; */ + NULL, /* setattrfunc tp_setattr; */ + NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ + (reprfunc) pyrna_struct_repr, /* tp_repr */ /* Method suites for standard classes */ NULL, /* PyNumberMethods *tp_as_number; */ - &pyrna_struct_as_sequence, /* PySequenceMethods *tp_as_sequence; */ - &pyrna_struct_as_mapping, /* PyMappingMethods *tp_as_mapping; */ + &pyrna_struct_as_sequence, /* PySequenceMethods *tp_as_sequence; */ + &pyrna_struct_as_mapping, /* PyMappingMethods *tp_as_mapping; */ /* More standard operations (here for binary compatibility) */ - (hashfunc) pyrna_struct_hash, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (hashfunc) pyrna_struct_hash, /* hashfunc tp_hash; */ + NULL, /* ternaryfunc tp_call; */ (reprfunc) pyrna_struct_str, /* reprfunc tp_str; */ - (getattrofunc) pyrna_struct_getattro, /* getattrofunc tp_getattro; */ - (setattrofunc) pyrna_struct_setattro, /* setattrofunc tp_setattro; */ + (getattrofunc) pyrna_struct_getattro, /* getattrofunc tp_getattro; */ + (setattrofunc) pyrna_struct_setattro, /* setattrofunc tp_setattro; */ /* Functions to access object as input/output buffer */ NULL, /* PyBufferProcs *tp_as_buffer; */ /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* long tp_flags; */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* long tp_flags; */ - NULL, /* char *tp_doc; Documentation string */ + NULL, /* char *tp_doc; Documentation string */ /*** Assigned meaning in release 2.0 ***/ /* call function for all accessible objects */ #ifdef USE_PYRNA_STRUCT_REFERENCE - (traverseproc) pyrna_struct_traverse, /* traverseproc tp_traverse; */ + (traverseproc) pyrna_struct_traverse, /* traverseproc tp_traverse; */ /* delete references to contained objects */ - (inquiry)pyrna_struct_clear, /* inquiry tp_clear; */ + (inquiry)pyrna_struct_clear, /* inquiry tp_clear; */ #else NULL, /* traverseproc tp_traverse; */ @@ -4757,11 +4757,11 @@ PyTypeObject pyrna_struct_Type= { /*** Assigned meaning in release 2.1 ***/ /*** rich comparisons ***/ - (richcmpfunc)pyrna_struct_richcmp, /* richcmpfunc tp_richcompare; */ + (richcmpfunc)pyrna_struct_richcmp, /* richcmpfunc tp_richcompare; */ /*** weak reference enabler ***/ #ifdef USE_WEAKREFS - offsetof(BPy_StructRNA, in_weakreflist), /* long tp_weaklistoffset; */ + offsetof(BPy_StructRNA, in_weakreflist), /* long tp_weaklistoffset; */ #else 0, #endif @@ -4771,9 +4771,9 @@ PyTypeObject pyrna_struct_Type= { NULL, /* iternextfunc tp_iternext; */ /*** Attribute descriptor and subclassing stuff ***/ - pyrna_struct_methods, /* struct PyMethodDef *tp_methods; */ + pyrna_struct_methods, /* struct PyMethodDef *tp_methods; */ NULL, /* struct PyMemberDef *tp_members; */ - pyrna_struct_getseters, /* struct PyGetSetDef *tp_getset; */ + pyrna_struct_getseters, /* struct PyGetSetDef *tp_getset; */ NULL, /* struct _typeobject *tp_base; */ NULL, /* PyObject *tp_dict; */ NULL, /* descrgetfunc tp_descr_get; */ @@ -4781,7 +4781,7 @@ PyTypeObject pyrna_struct_Type= { 0, /* long tp_dictoffset; */ NULL, /* initproc tp_init; */ NULL, /* allocfunc tp_alloc; */ - pyrna_struct_new, /* newfunc tp_new; */ + pyrna_struct_new, /* newfunc tp_new; */ /* Low-level free-memory routine */ NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ @@ -4798,32 +4798,32 @@ PyTypeObject pyrna_struct_Type= { /*-----------------------BPy_PropertyRNA method def------------------------------*/ PyTypeObject pyrna_prop_Type= { PyVarObject_HEAD_INIT(NULL, 0) - "bpy_prop", /* tp_name */ - sizeof(BPy_PropertyRNA), /* tp_basicsize */ - 0, /* tp_itemsize */ + "bpy_prop", /* tp_name */ + sizeof(BPy_PropertyRNA), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ (destructor) pyrna_prop_dealloc, /* tp_dealloc */ - NULL, /* printfunc tp_print; */ - NULL, /* getattrfunc tp_getattr; */ + NULL, /* printfunc tp_print; */ + NULL, /* getattrfunc tp_getattr; */ NULL, /* setattrfunc tp_setattr; */ - NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ - (reprfunc) pyrna_prop_repr, /* tp_repr */ + NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ + (reprfunc) pyrna_prop_repr, /* tp_repr */ /* Method suites for standard classes */ NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ + NULL, /* PySequenceMethods *tp_as_sequence; */ + NULL, /* PyMappingMethods *tp_as_mapping; */ /* More standard operations (here for binary compatibility) */ - (hashfunc) pyrna_prop_hash, /* hashfunc tp_hash; */ + (hashfunc) pyrna_prop_hash, /* hashfunc tp_hash; */ NULL, /* ternaryfunc tp_call; */ (reprfunc) pyrna_prop_str, /* reprfunc tp_str; */ /* will only use these if this is a subtype of a py class */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ + NULL, /* getattrofunc tp_getattro; */ + NULL, /* setattrofunc tp_setattro; */ /* Functions to access object as input/output buffer */ NULL, /* PyBufferProcs *tp_as_buffer; */ @@ -4831,7 +4831,7 @@ PyTypeObject pyrna_prop_Type= { /*** Flags to define presence of optional/expanded features ***/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ - NULL, /* char *tp_doc; Documentation string */ + NULL, /* char *tp_doc; Documentation string */ /*** Assigned meaning in release 2.0 ***/ /* call function for all accessible objects */ NULL, /* traverseproc tp_traverse; */ @@ -4852,11 +4852,11 @@ PyTypeObject pyrna_prop_Type= { /*** Added in release 2.2 ***/ /* Iterators */ - NULL, /* getiterfunc tp_iter; */ + NULL, /* getiterfunc tp_iter; */ NULL, /* iternextfunc tp_iternext; */ /*** Attribute descriptor and subclassing stuff ***/ - pyrna_prop_methods, /* struct PyMethodDef *tp_methods; */ + pyrna_prop_methods, /* struct PyMethodDef *tp_methods; */ NULL, /* struct PyMemberDef *tp_members; */ pyrna_prop_getseters, /* struct PyGetSetDef *tp_getset; */ NULL, /* struct _typeobject *tp_base; */ @@ -4866,7 +4866,7 @@ PyTypeObject pyrna_prop_Type= { 0, /* long tp_dictoffset; */ NULL, /* initproc tp_init; */ NULL, /* allocfunc tp_alloc; */ - pyrna_prop_new, /* newfunc tp_new; */ + pyrna_prop_new, /* newfunc tp_new; */ /* Low-level free-memory routine */ NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ @@ -4888,34 +4888,34 @@ PyTypeObject pyrna_prop_array_Type= { /* methods */ (destructor)pyrna_prop_array_dealloc, /* tp_dealloc */ NULL, /* printfunc tp_print; */ - NULL, /* getattrfunc tp_getattr; */ + NULL, /* getattrfunc tp_getattr; */ NULL, /* setattrfunc tp_setattr; */ - NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ + NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ NULL,/* subclassed */ /* tp_repr */ /* Method suites for standard classes */ - &pyrna_prop_array_as_number, /* PyNumberMethods *tp_as_number; */ - &pyrna_prop_array_as_sequence, /* PySequenceMethods *tp_as_sequence; */ - &pyrna_prop_array_as_mapping, /* PyMappingMethods *tp_as_mapping; */ + &pyrna_prop_array_as_number, /* PyNumberMethods *tp_as_number; */ + &pyrna_prop_array_as_sequence, /* PySequenceMethods *tp_as_sequence; */ + &pyrna_prop_array_as_mapping, /* PyMappingMethods *tp_as_mapping; */ /* More standard operations (here for binary compatibility) */ - NULL, /* hashfunc tp_hash; */ + NULL, /* hashfunc tp_hash; */ NULL, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ /* will only use these if this is a subtype of a py class */ - (getattrofunc) pyrna_prop_array_getattro, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ + (getattrofunc) pyrna_prop_array_getattro, /* getattrofunc tp_getattro; */ + NULL, /* setattrofunc tp_setattro; */ /* Functions to access object as input/output buffer */ NULL, /* PyBufferProcs *tp_as_buffer; */ /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ - NULL, /* char *tp_doc; Documentation string */ + NULL, /* char *tp_doc; Documentation string */ /*** Assigned meaning in release 2.0 ***/ /* call function for all accessible objects */ NULL, /* traverseproc tp_traverse; */ @@ -4925,7 +4925,7 @@ PyTypeObject pyrna_prop_array_Type= { /*** Assigned meaning in release 2.1 ***/ /*** rich comparisons ***/ - NULL, /* subclassed */ /* richcmpfunc tp_richcompare; */ + NULL, /* subclassed */ /* richcmpfunc tp_richcompare; */ /*** weak reference enabler ***/ #ifdef USE_WEAKREFS @@ -4939,22 +4939,22 @@ PyTypeObject pyrna_prop_array_Type= { NULL, /* iternextfunc tp_iternext; */ /*** Attribute descriptor and subclassing stuff ***/ - pyrna_prop_array_methods, /* struct PyMethodDef *tp_methods; */ + pyrna_prop_array_methods, /* struct PyMethodDef *tp_methods; */ NULL, /* struct PyMemberDef *tp_members; */ - NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */ - &pyrna_prop_Type, /* struct _typeobject *tp_base; */ + NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */ + &pyrna_prop_Type, /* struct _typeobject *tp_base; */ NULL, /* PyObject *tp_dict; */ NULL, /* descrgetfunc tp_descr_get; */ NULL, /* descrsetfunc tp_descr_set; */ 0, /* long tp_dictoffset; */ NULL, /* initproc tp_init; */ NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ + NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ + NULL, /* PyObject *tp_bases; */ /* method resolution order */ NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ @@ -4965,32 +4965,32 @@ PyTypeObject pyrna_prop_array_Type= { PyTypeObject pyrna_prop_collection_Type= { PyVarObject_HEAD_INIT(NULL, 0) - "bpy_prop_collection", /* tp_name */ - sizeof(BPy_PropertyRNA), /* tp_basicsize */ - 0, /* tp_itemsize */ + "bpy_prop_collection", /* tp_name */ + sizeof(BPy_PropertyRNA), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ (destructor)pyrna_prop_dealloc, /* tp_dealloc */ NULL, /* printfunc tp_print; */ - NULL, /* getattrfunc tp_getattr; */ + NULL, /* getattrfunc tp_getattr; */ NULL, /* setattrfunc tp_setattr; */ - NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ + NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ NULL, /* subclassed */ /* tp_repr */ /* Method suites for standard classes */ &pyrna_prop_collection_as_number, /* PyNumberMethods *tp_as_number; */ - &pyrna_prop_collection_as_sequence, /* PySequenceMethods *tp_as_sequence; */ - &pyrna_prop_collection_as_mapping, /* PyMappingMethods *tp_as_mapping; */ + &pyrna_prop_collection_as_sequence, /* PySequenceMethods *tp_as_sequence; */ + &pyrna_prop_collection_as_mapping, /* PyMappingMethods *tp_as_mapping; */ /* More standard operations (here for binary compatibility) */ - NULL, /* hashfunc tp_hash; */ + NULL, /* hashfunc tp_hash; */ NULL, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ /* will only use these if this is a subtype of a py class */ - (getattrofunc) pyrna_prop_collection_getattro, /* getattrofunc tp_getattro; */ - (setattrofunc) pyrna_prop_collection_setattro, /* setattrofunc tp_setattro; */ + (getattrofunc) pyrna_prop_collection_getattro, /* getattrofunc tp_getattro; */ + (setattrofunc) pyrna_prop_collection_setattro, /* setattrofunc tp_setattro; */ /* Functions to access object as input/output buffer */ NULL, /* PyBufferProcs *tp_as_buffer; */ @@ -4998,7 +4998,7 @@ PyTypeObject pyrna_prop_collection_Type= { /*** Flags to define presence of optional/expanded features ***/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ - NULL, /* char *tp_doc; Documentation string */ + NULL, /* char *tp_doc; Documentation string */ /*** Assigned meaning in release 2.0 ***/ /* call function for all accessible objects */ NULL, /* traverseproc tp_traverse; */ @@ -5012,33 +5012,33 @@ PyTypeObject pyrna_prop_collection_Type= { /*** weak reference enabler ***/ #ifdef USE_WEAKREFS - offsetof(BPy_PropertyRNA, in_weakreflist), /* long tp_weaklistoffset; */ + offsetof(BPy_PropertyRNA, in_weakreflist), /* long tp_weaklistoffset; */ #else 0, #endif /*** Added in release 2.2 ***/ /* Iterators */ - (getiterfunc)pyrna_prop_collection_iter, /* getiterfunc tp_iter; */ + (getiterfunc)pyrna_prop_collection_iter, /* getiterfunc tp_iter; */ NULL, /* iternextfunc tp_iternext; */ /*** Attribute descriptor and subclassing stuff ***/ - pyrna_prop_collection_methods, /* struct PyMethodDef *tp_methods; */ + pyrna_prop_collection_methods, /* struct PyMethodDef *tp_methods; */ NULL, /* struct PyMemberDef *tp_members; */ - NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */ - &pyrna_prop_Type, /* struct _typeobject *tp_base; */ + NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */ + &pyrna_prop_Type, /* struct _typeobject *tp_base; */ NULL, /* PyObject *tp_dict; */ NULL, /* descrgetfunc tp_descr_get; */ NULL, /* descrsetfunc tp_descr_set; */ 0, /* long tp_dictoffset; */ NULL, /* initproc tp_init; */ NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ + NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ + NULL, /* PyObject *tp_bases; */ /* method resolution order */ NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ @@ -5050,32 +5050,32 @@ PyTypeObject pyrna_prop_collection_Type= { /* only for add/remove/move methods */ static PyTypeObject pyrna_prop_collection_idprop_Type= { PyVarObject_HEAD_INIT(NULL, 0) - "bpy_prop_collection_idprop", /* tp_name */ - sizeof(BPy_PropertyRNA), /* tp_basicsize */ - 0, /* tp_itemsize */ + "bpy_prop_collection_idprop", /* tp_name */ + sizeof(BPy_PropertyRNA), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ (destructor)pyrna_prop_dealloc, /* tp_dealloc */ NULL, /* printfunc tp_print; */ - NULL, /* getattrfunc tp_getattr; */ + NULL, /* getattrfunc tp_getattr; */ NULL, /* setattrfunc tp_setattr; */ - NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ - NULL, /* subclassed */ /* tp_repr */ + NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ + NULL, /* subclassed */ /* tp_repr */ /* Method suites for standard classes */ - NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ + NULL, /* PyNumberMethods *tp_as_number; */ + NULL, /* PySequenceMethods *tp_as_sequence; */ + NULL, /* PyMappingMethods *tp_as_mapping; */ /* More standard operations (here for binary compatibility) */ - NULL, /* hashfunc tp_hash; */ + NULL, /* hashfunc tp_hash; */ NULL, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ /* will only use these if this is a subtype of a py class */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ + NULL, /* getattrofunc tp_getattro; */ + NULL, /* setattrofunc tp_setattro; */ /* Functions to access object as input/output buffer */ NULL, /* PyBufferProcs *tp_as_buffer; */ @@ -5083,7 +5083,7 @@ static PyTypeObject pyrna_prop_collection_idprop_Type= { /*** Flags to define presence of optional/expanded features ***/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ - NULL, /* char *tp_doc; Documentation string */ + NULL, /* char *tp_doc; Documentation string */ /*** Assigned meaning in release 2.0 ***/ /* call function for all accessible objects */ NULL, /* traverseproc tp_traverse; */ @@ -5097,33 +5097,33 @@ static PyTypeObject pyrna_prop_collection_idprop_Type= { /*** weak reference enabler ***/ #ifdef USE_WEAKREFS - offsetof(BPy_PropertyRNA, in_weakreflist), /* long tp_weaklistoffset; */ + offsetof(BPy_PropertyRNA, in_weakreflist), /* long tp_weaklistoffset; */ #else 0, #endif /*** Added in release 2.2 ***/ /* Iterators */ - NULL, /* getiterfunc tp_iter; */ + NULL, /* getiterfunc tp_iter; */ NULL, /* iternextfunc tp_iternext; */ /*** Attribute descriptor and subclassing stuff ***/ pyrna_prop_collection_idprop_methods, /* struct PyMethodDef *tp_methods; */ NULL, /* struct PyMemberDef *tp_members; */ - NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */ - &pyrna_prop_collection_Type, /* struct _typeobject *tp_base; */ + NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */ + &pyrna_prop_collection_Type,/* struct _typeobject *tp_base; */ NULL, /* PyObject *tp_dict; */ NULL, /* descrgetfunc tp_descr_get; */ NULL, /* descrsetfunc tp_descr_set; */ 0, /* long tp_dictoffset; */ NULL, /* initproc tp_init; */ NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ + NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ + NULL, /* PyObject *tp_bases; */ /* method resolution order */ NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ @@ -5135,32 +5135,32 @@ static PyTypeObject pyrna_prop_collection_idprop_Type= { /*-----------------------BPy_PropertyRNA method def------------------------------*/ PyTypeObject pyrna_func_Type= { PyVarObject_HEAD_INIT(NULL, 0) - "bpy_func", /* tp_name */ - sizeof(BPy_FunctionRNA), /* tp_basicsize */ - 0, /* tp_itemsize */ + "bpy_func", /* tp_name */ + sizeof(BPy_FunctionRNA), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - NULL, /* tp_dealloc */ - NULL, /* printfunc tp_print; */ - NULL, /* getattrfunc tp_getattr; */ + NULL, /* tp_dealloc */ + NULL, /* printfunc tp_print; */ + NULL, /* getattrfunc tp_getattr; */ NULL, /* setattrfunc tp_setattr; */ - NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ - (reprfunc) pyrna_func_repr, /* tp_repr */ + NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ + (reprfunc) pyrna_func_repr, /* tp_repr */ /* Method suites for standard classes */ NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ + NULL, /* PySequenceMethods *tp_as_sequence; */ + NULL, /* PyMappingMethods *tp_as_mapping; */ /* More standard operations (here for binary compatibility) */ - NULL, /* hashfunc tp_hash; */ - (ternaryfunc)pyrna_func_call, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ + NULL, /* hashfunc tp_hash; */ + (ternaryfunc)pyrna_func_call, /* ternaryfunc tp_call; */ + NULL, /* reprfunc tp_str; */ /* will only use these if this is a subtype of a py class */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ + NULL, /* getattrofunc tp_getattro; */ + NULL, /* setattrofunc tp_setattro; */ /* Functions to access object as input/output buffer */ NULL, /* PyBufferProcs *tp_as_buffer; */ @@ -5168,7 +5168,7 @@ PyTypeObject pyrna_func_Type= { /*** Flags to define presence of optional/expanded features ***/ Py_TPFLAGS_DEFAULT, /* long tp_flags; */ - NULL, /* char *tp_doc; Documentation string */ + NULL, /* char *tp_doc; Documentation string */ /*** Assigned meaning in release 2.0 ***/ /* call function for all accessible objects */ NULL, /* traverseproc tp_traverse; */ @@ -5178,7 +5178,7 @@ PyTypeObject pyrna_func_Type= { /*** Assigned meaning in release 2.1 ***/ /*** rich comparisons ***/ - NULL, /* richcmpfunc tp_richcompare; */ + NULL, /* richcmpfunc tp_richcompare; */ /*** weak reference enabler ***/ #ifdef USE_WEAKREFS @@ -5189,13 +5189,13 @@ PyTypeObject pyrna_func_Type= { /*** Added in release 2.2 ***/ /* Iterators */ - NULL, /* getiterfunc tp_iter; */ + NULL, /* getiterfunc tp_iter; */ NULL, /* iternextfunc tp_iternext; */ /*** Attribute descriptor and subclassing stuff ***/ - NULL, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMethodDef *tp_methods; */ NULL, /* struct PyMemberDef *tp_members; */ - NULL, /* struct PyGetSetDef *tp_getset; */ + NULL, /* struct PyGetSetDef *tp_getset; */ NULL, /* struct _typeobject *tp_base; */ NULL, /* PyObject *tp_dict; */ NULL, /* descrgetfunc tp_descr_get; */ @@ -5203,7 +5203,7 @@ PyTypeObject pyrna_func_Type= { 0, /* long tp_dictoffset; */ NULL, /* initproc tp_init; */ NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ + NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ @@ -5231,32 +5231,32 @@ static PyObject *pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA * PyTypeObject pyrna_prop_collection_iter_Type= { PyVarObject_HEAD_INIT(NULL, 0) - "bpy_prop_collection_iter", /* tp_name */ - sizeof(BPy_PropertyCollectionIterRNA), /* tp_basicsize */ - 0, /* tp_itemsize */ + "bpy_prop_collection_iter", /* tp_name */ + sizeof(BPy_PropertyCollectionIterRNA), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ (destructor)pyrna_prop_collection_iter_dealloc, /* tp_dealloc */ NULL, /* printfunc tp_print; */ - NULL, /* getattrfunc tp_getattr; */ + NULL, /* getattrfunc tp_getattr; */ NULL, /* setattrfunc tp_setattr; */ - NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ + NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ NULL,/* subclassed */ /* tp_repr */ /* Method suites for standard classes */ NULL, /* PyNumberMethods *tp_as_number; */ - NULL, /* PySequenceMethods *tp_as_sequence; */ - NULL, /* PyMappingMethods *tp_as_mapping; */ + NULL, /* PySequenceMethods *tp_as_sequence; */ + NULL, /* PyMappingMethods *tp_as_mapping; */ /* More standard operations (here for binary compatibility) */ - NULL, /* hashfunc tp_hash; */ + NULL, /* hashfunc tp_hash; */ NULL, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ /* will only use these if this is a subtype of a py class */ - PyObject_GenericGetAttr, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ + PyObject_GenericGetAttr, /* getattrofunc tp_getattro; */ + NULL, /* setattrofunc tp_setattro; */ /* Functions to access object as input/output buffer */ NULL, /* PyBufferProcs *tp_as_buffer; */ @@ -5264,7 +5264,7 @@ PyTypeObject pyrna_prop_collection_iter_Type= { /*** Flags to define presence of optional/expanded features ***/ Py_TPFLAGS_DEFAULT, /* long tp_flags; */ - NULL, /* char *tp_doc; Documentation string */ + NULL, /* char *tp_doc; Documentation string */ /*** Assigned meaning in release 2.0 ***/ /* call function for all accessible objects */ NULL, /* traverseproc tp_traverse; */ @@ -5278,19 +5278,19 @@ PyTypeObject pyrna_prop_collection_iter_Type= { /*** weak reference enabler ***/ #ifdef USE_WEAKREFS - offsetof(BPy_PropertyCollectionIterRNA, in_weakreflist), /* long tp_weaklistoffset; */ + offsetof(BPy_PropertyCollectionIterRNA, in_weakreflist), /* long tp_weaklistoffset; */ #else 0, #endif /*** Added in release 2.2 ***/ /* Iterators */ - PyObject_SelfIter, /* getiterfunc tp_iter; */ - (iternextfunc) pyrna_prop_collection_iter_next, /* iternextfunc tp_iternext; */ + PyObject_SelfIter, /* getiterfunc tp_iter; */ + (iternextfunc) pyrna_prop_collection_iter_next, /* iternextfunc tp_iternext; */ /*** Attribute descriptor and subclassing stuff ***/ - NULL, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMethodDef *tp_methods; */ NULL, /* struct PyMemberDef *tp_members; */ - NULL, /* struct PyGetSetDef *tp_getset; */ + NULL, /* struct PyGetSetDef *tp_getset; */ NULL, /* struct _typeobject *tp_base; */ NULL, /* PyObject *tp_dict; */ NULL, /* descrgetfunc tp_descr_get; */ @@ -5298,12 +5298,12 @@ PyTypeObject pyrna_prop_collection_iter_Type= { 0, /* long tp_dictoffset; */ NULL, /* initproc tp_init; */ NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ + NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ + NULL, /* PyObject *tp_bases; */ /* method resolution order */ NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ diff --git a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h index 67a2279d824..7e9a57a0fe7 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h +++ b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h @@ -51,197 +51,195 @@ /** Base Class for Blender specific inputdevices. Blender specific inputdevices are used when the gameengine is running in embedded mode instead of standalone mode. */ -class BL_BlenderInputDevice : public SCA_IInputDevice +class BL_BlenderInputDevice : public SCA_IInputDevice { // this map is Blender specific: a conversion between blender and ketsji enums std::map m_reverseKeyTranslateTable; public: - BL_BlenderInputDevice() - { - - /* The reverse table. In order to not confuse ourselves, we */ - /* immediately convert all events that come in to KX codes. */ - m_reverseKeyTranslateTable[LEFTMOUSE ] = KX_LEFTMOUSE ; - m_reverseKeyTranslateTable[MIDDLEMOUSE ] = KX_MIDDLEMOUSE ; - m_reverseKeyTranslateTable[RIGHTMOUSE ] = KX_RIGHTMOUSE ; - m_reverseKeyTranslateTable[WHEELUPMOUSE ] = KX_WHEELUPMOUSE ; - m_reverseKeyTranslateTable[WHEELDOWNMOUSE ] = KX_WHEELDOWNMOUSE ; - m_reverseKeyTranslateTable[MOUSEX ] = KX_MOUSEX ; - m_reverseKeyTranslateTable[MOUSEY ] = KX_MOUSEY ; - - // TIMERS - - m_reverseKeyTranslateTable[TIMER0 ] = KX_TIMER0 ; - m_reverseKeyTranslateTable[TIMER1 ] = KX_TIMER1 ; - m_reverseKeyTranslateTable[TIMER2 ] = KX_TIMER2 ; - - // SYSTEM -#if 0 - /* **** XXX **** */ - m_reverseKeyTranslateTable[KEYBD ] = KX_KEYBD ; - m_reverseKeyTranslateTable[RAWKEYBD ] = KX_RAWKEYBD ; - m_reverseKeyTranslateTable[REDRAW ] = KX_REDRAW ; - m_reverseKeyTranslateTable[INPUTCHANGE ] = KX_INPUTCHANGE ; - m_reverseKeyTranslateTable[QFULL ] = KX_QFULL ; - m_reverseKeyTranslateTable[WINFREEZE ] = KX_WINFREEZE ; - m_reverseKeyTranslateTable[WINTHAW ] = KX_WINTHAW ; - m_reverseKeyTranslateTable[WINCLOSE ] = KX_WINCLOSE ; - m_reverseKeyTranslateTable[WINQUIT ] = KX_WINQUIT ; - m_reverseKeyTranslateTable[Q_FIRSTTIME ] = KX_Q_FIRSTTIME ; - /* **** XXX **** */ -#endif - // standard keyboard - - m_reverseKeyTranslateTable[AKEY ] = KX_AKEY ; - m_reverseKeyTranslateTable[BKEY ] = KX_BKEY ; - m_reverseKeyTranslateTable[CKEY ] = KX_CKEY ; - m_reverseKeyTranslateTable[DKEY ] = KX_DKEY ; - m_reverseKeyTranslateTable[EKEY ] = KX_EKEY ; - m_reverseKeyTranslateTable[FKEY ] = KX_FKEY ; - m_reverseKeyTranslateTable[GKEY ] = KX_GKEY ; -//XXX clean up + BL_BlenderInputDevice() + { + + /* The reverse table. In order to not confuse ourselves, we */ + /* immediately convert all events that come in to KX codes. */ + m_reverseKeyTranslateTable[LEFTMOUSE ] = KX_LEFTMOUSE; + m_reverseKeyTranslateTable[MIDDLEMOUSE ] = KX_MIDDLEMOUSE; + m_reverseKeyTranslateTable[RIGHTMOUSE ] = KX_RIGHTMOUSE; + m_reverseKeyTranslateTable[WHEELUPMOUSE ] = KX_WHEELUPMOUSE; + m_reverseKeyTranslateTable[WHEELDOWNMOUSE ] = KX_WHEELDOWNMOUSE; + m_reverseKeyTranslateTable[MOUSEX ] = KX_MOUSEX; + m_reverseKeyTranslateTable[MOUSEY ] = KX_MOUSEY; + + // TIMERS + + m_reverseKeyTranslateTable[TIMER0 ] = KX_TIMER0; + m_reverseKeyTranslateTable[TIMER1 ] = KX_TIMER1; + m_reverseKeyTranslateTable[TIMER2 ] = KX_TIMER2; + + // SYSTEM +#if 0 + /* **** XXX **** */ + m_reverseKeyTranslateTable[KEYBD ] = KX_KEYBD; + m_reverseKeyTranslateTable[RAWKEYBD ] = KX_RAWKEYBD; + m_reverseKeyTranslateTable[REDRAW ] = KX_REDRAW; + m_reverseKeyTranslateTable[INPUTCHANGE ] = KX_INPUTCHANGE; + m_reverseKeyTranslateTable[QFULL ] = KX_QFULL; + m_reverseKeyTranslateTable[WINFREEZE ] = KX_WINFREEZE; + m_reverseKeyTranslateTable[WINTHAW ] = KX_WINTHAW; + m_reverseKeyTranslateTable[WINCLOSE ] = KX_WINCLOSE; + m_reverseKeyTranslateTable[WINQUIT ] = KX_WINQUIT; + m_reverseKeyTranslateTable[Q_FIRSTTIME ] = KX_Q_FIRSTTIME; + /* **** XXX **** */ +#endif + // standard keyboard + + m_reverseKeyTranslateTable[AKEY ] = KX_AKEY; + m_reverseKeyTranslateTable[BKEY ] = KX_BKEY; + m_reverseKeyTranslateTable[CKEY ] = KX_CKEY; + m_reverseKeyTranslateTable[DKEY ] = KX_DKEY; + m_reverseKeyTranslateTable[EKEY ] = KX_EKEY; + m_reverseKeyTranslateTable[FKEY ] = KX_FKEY; + m_reverseKeyTranslateTable[GKEY ] = KX_GKEY; + //XXX clean up #ifdef WIN32 #define HKEY 'h' #endif - m_reverseKeyTranslateTable[HKEY ] = KX_HKEY ; -//XXX clean up + m_reverseKeyTranslateTable[HKEY ] = KX_HKEY; + //XXX clean up #ifdef WIN32 #undef HKEY #endif - m_reverseKeyTranslateTable[IKEY ] = KX_IKEY ; - m_reverseKeyTranslateTable[JKEY ] = KX_JKEY ; - m_reverseKeyTranslateTable[KKEY ] = KX_KKEY ; - m_reverseKeyTranslateTable[LKEY ] = KX_LKEY ; - m_reverseKeyTranslateTable[MKEY ] = KX_MKEY ; - m_reverseKeyTranslateTable[NKEY ] = KX_NKEY ; - m_reverseKeyTranslateTable[OKEY ] = KX_OKEY ; - m_reverseKeyTranslateTable[PKEY ] = KX_PKEY ; - m_reverseKeyTranslateTable[QKEY ] = KX_QKEY ; - m_reverseKeyTranslateTable[RKEY ] = KX_RKEY ; - m_reverseKeyTranslateTable[SKEY ] = KX_SKEY ; - m_reverseKeyTranslateTable[TKEY ] = KX_TKEY ; - m_reverseKeyTranslateTable[UKEY ] = KX_UKEY ; - m_reverseKeyTranslateTable[VKEY ] = KX_VKEY ; - m_reverseKeyTranslateTable[WKEY ] = KX_WKEY ; - m_reverseKeyTranslateTable[XKEY ] = KX_XKEY ; - m_reverseKeyTranslateTable[YKEY ] = KX_YKEY ; - m_reverseKeyTranslateTable[ZKEY ] = KX_ZKEY ; - - m_reverseKeyTranslateTable[ZEROKEY ] = KX_ZEROKEY ; - m_reverseKeyTranslateTable[ONEKEY ] = KX_ONEKEY ; - m_reverseKeyTranslateTable[TWOKEY ] = KX_TWOKEY ; - m_reverseKeyTranslateTable[THREEKEY ] = KX_THREEKEY ; - m_reverseKeyTranslateTable[FOURKEY ] = KX_FOURKEY ; - m_reverseKeyTranslateTable[FIVEKEY ] = KX_FIVEKEY ; - m_reverseKeyTranslateTable[SIXKEY ] = KX_SIXKEY ; - m_reverseKeyTranslateTable[SEVENKEY ] = KX_SEVENKEY ; - m_reverseKeyTranslateTable[EIGHTKEY ] = KX_EIGHTKEY ; - m_reverseKeyTranslateTable[NINEKEY ] = KX_NINEKEY ; - - m_reverseKeyTranslateTable[CAPSLOCKKEY ] = KX_CAPSLOCKKEY ; - - m_reverseKeyTranslateTable[LEFTCTRLKEY ] = KX_LEFTCTRLKEY ; - m_reverseKeyTranslateTable[LEFTALTKEY ] = KX_LEFTALTKEY ; - m_reverseKeyTranslateTable[RIGHTALTKEY ] = KX_RIGHTALTKEY ; - m_reverseKeyTranslateTable[RIGHTCTRLKEY ] = KX_RIGHTCTRLKEY ; - m_reverseKeyTranslateTable[RIGHTSHIFTKEY ] = KX_RIGHTSHIFTKEY ; - m_reverseKeyTranslateTable[LEFTSHIFTKEY ] = KX_LEFTSHIFTKEY ; - - m_reverseKeyTranslateTable[ESCKEY ] = KX_ESCKEY ; - m_reverseKeyTranslateTable[TABKEY ] = KX_TABKEY ; - m_reverseKeyTranslateTable[RETKEY ] = KX_RETKEY ; - m_reverseKeyTranslateTable[SPACEKEY ] = KX_SPACEKEY ; - m_reverseKeyTranslateTable[LINEFEEDKEY ] = KX_LINEFEEDKEY ; - m_reverseKeyTranslateTable[BACKSPACEKEY ] = KX_BACKSPACEKEY ; - m_reverseKeyTranslateTable[DELKEY ] = KX_DELKEY ; - m_reverseKeyTranslateTable[SEMICOLONKEY ] = KX_SEMICOLONKEY ; - m_reverseKeyTranslateTable[PERIODKEY ] = KX_PERIODKEY ; - m_reverseKeyTranslateTable[COMMAKEY ] = KX_COMMAKEY ; - m_reverseKeyTranslateTable[QUOTEKEY ] = KX_QUOTEKEY ; - m_reverseKeyTranslateTable[ACCENTGRAVEKEY ] = KX_ACCENTGRAVEKEY ; - m_reverseKeyTranslateTable[MINUSKEY ] = KX_MINUSKEY ; - m_reverseKeyTranslateTable[SLASHKEY ] = KX_SLASHKEY ; - m_reverseKeyTranslateTable[BACKSLASHKEY ] = KX_BACKSLASHKEY ; - m_reverseKeyTranslateTable[EQUALKEY ] = KX_EQUALKEY ; - m_reverseKeyTranslateTable[LEFTBRACKETKEY ] = KX_LEFTBRACKETKEY ; - m_reverseKeyTranslateTable[RIGHTBRACKETKEY ] = KX_RIGHTBRACKETKEY ; - - m_reverseKeyTranslateTable[LEFTARROWKEY ] = KX_LEFTARROWKEY ; - m_reverseKeyTranslateTable[DOWNARROWKEY ] = KX_DOWNARROWKEY ; - m_reverseKeyTranslateTable[RIGHTARROWKEY ] = KX_RIGHTARROWKEY ; - m_reverseKeyTranslateTable[UPARROWKEY ] = KX_UPARROWKEY ; - - m_reverseKeyTranslateTable[PAD2 ] = KX_PAD2 ; - m_reverseKeyTranslateTable[PAD4 ] = KX_PAD4 ; - m_reverseKeyTranslateTable[PAD6 ] = KX_PAD6 ; - m_reverseKeyTranslateTable[PAD8 ] = KX_PAD8 ; - - m_reverseKeyTranslateTable[PAD1 ] = KX_PAD1 ; - m_reverseKeyTranslateTable[PAD3 ] = KX_PAD3 ; - m_reverseKeyTranslateTable[PAD5 ] = KX_PAD5 ; - m_reverseKeyTranslateTable[PAD7 ] = KX_PAD7 ; - m_reverseKeyTranslateTable[PAD9 ] = KX_PAD9 ; - - m_reverseKeyTranslateTable[PADPERIOD ] = KX_PADPERIOD ; - m_reverseKeyTranslateTable[PADSLASHKEY ] = KX_PADSLASHKEY ; - m_reverseKeyTranslateTable[PADASTERKEY ] = KX_PADASTERKEY ; - - - m_reverseKeyTranslateTable[PAD0 ] = KX_PAD0 ; - m_reverseKeyTranslateTable[PADMINUS ] = KX_PADMINUS ; - m_reverseKeyTranslateTable[PADENTER ] = KX_PADENTER ; - m_reverseKeyTranslateTable[PADPLUSKEY ] = KX_PADPLUSKEY ; - - - m_reverseKeyTranslateTable[F1KEY ] = KX_F1KEY ; - m_reverseKeyTranslateTable[F2KEY ] = KX_F2KEY ; - m_reverseKeyTranslateTable[F3KEY ] = KX_F3KEY ; - m_reverseKeyTranslateTable[F4KEY ] = KX_F4KEY ; - m_reverseKeyTranslateTable[F5KEY ] = KX_F5KEY ; - m_reverseKeyTranslateTable[F6KEY ] = KX_F6KEY ; - m_reverseKeyTranslateTable[F7KEY ] = KX_F7KEY ; - m_reverseKeyTranslateTable[F8KEY ] = KX_F8KEY ; - m_reverseKeyTranslateTable[F9KEY ] = KX_F9KEY ; - m_reverseKeyTranslateTable[F10KEY ] = KX_F10KEY ; - m_reverseKeyTranslateTable[F11KEY ] = KX_F11KEY ; - m_reverseKeyTranslateTable[F12KEY ] = KX_F12KEY ; - m_reverseKeyTranslateTable[F13KEY ] = KX_F13KEY ; - m_reverseKeyTranslateTable[F14KEY ] = KX_F14KEY ; - m_reverseKeyTranslateTable[F15KEY ] = KX_F15KEY ; - m_reverseKeyTranslateTable[F16KEY ] = KX_F16KEY ; - m_reverseKeyTranslateTable[F17KEY ] = KX_F17KEY ; - m_reverseKeyTranslateTable[F18KEY ] = KX_F18KEY ; - m_reverseKeyTranslateTable[F19KEY ] = KX_F19KEY ; - - m_reverseKeyTranslateTable[PAUSEKEY ] = KX_PAUSEKEY ; - m_reverseKeyTranslateTable[INSERTKEY ] = KX_INSERTKEY ; - m_reverseKeyTranslateTable[HOMEKEY ] = KX_HOMEKEY ; - m_reverseKeyTranslateTable[PAGEUPKEY ] = KX_PAGEUPKEY ; - m_reverseKeyTranslateTable[PAGEDOWNKEY ] = KX_PAGEDOWNKEY ; - m_reverseKeyTranslateTable[ENDKEY ] = KX_ENDKEY ; - - - } + m_reverseKeyTranslateTable[IKEY ] = KX_IKEY; + m_reverseKeyTranslateTable[JKEY ] = KX_JKEY; + m_reverseKeyTranslateTable[KKEY ] = KX_KKEY; + m_reverseKeyTranslateTable[LKEY ] = KX_LKEY; + m_reverseKeyTranslateTable[MKEY ] = KX_MKEY; + m_reverseKeyTranslateTable[NKEY ] = KX_NKEY; + m_reverseKeyTranslateTable[OKEY ] = KX_OKEY; + m_reverseKeyTranslateTable[PKEY ] = KX_PKEY; + m_reverseKeyTranslateTable[QKEY ] = KX_QKEY; + m_reverseKeyTranslateTable[RKEY ] = KX_RKEY; + m_reverseKeyTranslateTable[SKEY ] = KX_SKEY; + m_reverseKeyTranslateTable[TKEY ] = KX_TKEY; + m_reverseKeyTranslateTable[UKEY ] = KX_UKEY; + m_reverseKeyTranslateTable[VKEY ] = KX_VKEY; + m_reverseKeyTranslateTable[WKEY ] = KX_WKEY; + m_reverseKeyTranslateTable[XKEY ] = KX_XKEY; + m_reverseKeyTranslateTable[YKEY ] = KX_YKEY; + m_reverseKeyTranslateTable[ZKEY ] = KX_ZKEY; + + m_reverseKeyTranslateTable[ZEROKEY ] = KX_ZEROKEY; + m_reverseKeyTranslateTable[ONEKEY ] = KX_ONEKEY; + m_reverseKeyTranslateTable[TWOKEY ] = KX_TWOKEY; + m_reverseKeyTranslateTable[THREEKEY ] = KX_THREEKEY; + m_reverseKeyTranslateTable[FOURKEY ] = KX_FOURKEY; + m_reverseKeyTranslateTable[FIVEKEY ] = KX_FIVEKEY; + m_reverseKeyTranslateTable[SIXKEY ] = KX_SIXKEY; + m_reverseKeyTranslateTable[SEVENKEY ] = KX_SEVENKEY; + m_reverseKeyTranslateTable[EIGHTKEY ] = KX_EIGHTKEY; + m_reverseKeyTranslateTable[NINEKEY ] = KX_NINEKEY; + + m_reverseKeyTranslateTable[CAPSLOCKKEY ] = KX_CAPSLOCKKEY; + + m_reverseKeyTranslateTable[LEFTCTRLKEY ] = KX_LEFTCTRLKEY; + m_reverseKeyTranslateTable[LEFTALTKEY ] = KX_LEFTALTKEY; + m_reverseKeyTranslateTable[RIGHTALTKEY ] = KX_RIGHTALTKEY; + m_reverseKeyTranslateTable[RIGHTCTRLKEY ] = KX_RIGHTCTRLKEY; + m_reverseKeyTranslateTable[RIGHTSHIFTKEY ] = KX_RIGHTSHIFTKEY; + m_reverseKeyTranslateTable[LEFTSHIFTKEY ] = KX_LEFTSHIFTKEY; + + m_reverseKeyTranslateTable[ESCKEY ] = KX_ESCKEY; + m_reverseKeyTranslateTable[TABKEY ] = KX_TABKEY; + m_reverseKeyTranslateTable[RETKEY ] = KX_RETKEY; + m_reverseKeyTranslateTable[SPACEKEY ] = KX_SPACEKEY; + m_reverseKeyTranslateTable[LINEFEEDKEY ] = KX_LINEFEEDKEY; + m_reverseKeyTranslateTable[BACKSPACEKEY ] = KX_BACKSPACEKEY; + m_reverseKeyTranslateTable[DELKEY ] = KX_DELKEY; + m_reverseKeyTranslateTable[SEMICOLONKEY ] = KX_SEMICOLONKEY; + m_reverseKeyTranslateTable[PERIODKEY ] = KX_PERIODKEY; + m_reverseKeyTranslateTable[COMMAKEY ] = KX_COMMAKEY; + m_reverseKeyTranslateTable[QUOTEKEY ] = KX_QUOTEKEY; + m_reverseKeyTranslateTable[ACCENTGRAVEKEY ] = KX_ACCENTGRAVEKEY; + m_reverseKeyTranslateTable[MINUSKEY ] = KX_MINUSKEY; + m_reverseKeyTranslateTable[SLASHKEY ] = KX_SLASHKEY; + m_reverseKeyTranslateTable[BACKSLASHKEY ] = KX_BACKSLASHKEY; + m_reverseKeyTranslateTable[EQUALKEY ] = KX_EQUALKEY; + m_reverseKeyTranslateTable[LEFTBRACKETKEY ] = KX_LEFTBRACKETKEY; + m_reverseKeyTranslateTable[RIGHTBRACKETKEY ] = KX_RIGHTBRACKETKEY; + + m_reverseKeyTranslateTable[LEFTARROWKEY ] = KX_LEFTARROWKEY; + m_reverseKeyTranslateTable[DOWNARROWKEY ] = KX_DOWNARROWKEY; + m_reverseKeyTranslateTable[RIGHTARROWKEY ] = KX_RIGHTARROWKEY; + m_reverseKeyTranslateTable[UPARROWKEY ] = KX_UPARROWKEY; + + m_reverseKeyTranslateTable[PAD2 ] = KX_PAD2; + m_reverseKeyTranslateTable[PAD4 ] = KX_PAD4; + m_reverseKeyTranslateTable[PAD6 ] = KX_PAD6; + m_reverseKeyTranslateTable[PAD8 ] = KX_PAD8; + + m_reverseKeyTranslateTable[PAD1 ] = KX_PAD1; + m_reverseKeyTranslateTable[PAD3 ] = KX_PAD3; + m_reverseKeyTranslateTable[PAD5 ] = KX_PAD5; + m_reverseKeyTranslateTable[PAD7 ] = KX_PAD7; + m_reverseKeyTranslateTable[PAD9 ] = KX_PAD9; + + m_reverseKeyTranslateTable[PADPERIOD ] = KX_PADPERIOD; + m_reverseKeyTranslateTable[PADSLASHKEY ] = KX_PADSLASHKEY; + m_reverseKeyTranslateTable[PADASTERKEY ] = KX_PADASTERKEY; + + + m_reverseKeyTranslateTable[PAD0 ] = KX_PAD0; + m_reverseKeyTranslateTable[PADMINUS ] = KX_PADMINUS; + m_reverseKeyTranslateTable[PADENTER ] = KX_PADENTER; + m_reverseKeyTranslateTable[PADPLUSKEY ] = KX_PADPLUSKEY; + + + m_reverseKeyTranslateTable[F1KEY ] = KX_F1KEY; + m_reverseKeyTranslateTable[F2KEY ] = KX_F2KEY; + m_reverseKeyTranslateTable[F3KEY ] = KX_F3KEY; + m_reverseKeyTranslateTable[F4KEY ] = KX_F4KEY; + m_reverseKeyTranslateTable[F5KEY ] = KX_F5KEY; + m_reverseKeyTranslateTable[F6KEY ] = KX_F6KEY; + m_reverseKeyTranslateTable[F7KEY ] = KX_F7KEY; + m_reverseKeyTranslateTable[F8KEY ] = KX_F8KEY; + m_reverseKeyTranslateTable[F9KEY ] = KX_F9KEY; + m_reverseKeyTranslateTable[F10KEY ] = KX_F10KEY; + m_reverseKeyTranslateTable[F11KEY ] = KX_F11KEY; + m_reverseKeyTranslateTable[F12KEY ] = KX_F12KEY; + m_reverseKeyTranslateTable[F13KEY ] = KX_F13KEY; + m_reverseKeyTranslateTable[F14KEY ] = KX_F14KEY; + m_reverseKeyTranslateTable[F15KEY ] = KX_F15KEY; + m_reverseKeyTranslateTable[F16KEY ] = KX_F16KEY; + m_reverseKeyTranslateTable[F17KEY ] = KX_F17KEY; + m_reverseKeyTranslateTable[F18KEY ] = KX_F18KEY; + m_reverseKeyTranslateTable[F19KEY ] = KX_F19KEY; + + m_reverseKeyTranslateTable[PAUSEKEY ] = KX_PAUSEKEY; + m_reverseKeyTranslateTable[INSERTKEY ] = KX_INSERTKEY; + m_reverseKeyTranslateTable[HOMEKEY ] = KX_HOMEKEY; + m_reverseKeyTranslateTable[PAGEUPKEY ] = KX_PAGEUPKEY; + m_reverseKeyTranslateTable[PAGEDOWNKEY ] = KX_PAGEDOWNKEY; + m_reverseKeyTranslateTable[ENDKEY ] = KX_ENDKEY; + } virtual ~BL_BlenderInputDevice() - { + { - } - - KX_EnumInputs ToNative(unsigned short incode) { + } + + KX_EnumInputs ToNative(unsigned short incode) { return m_reverseKeyTranslateTable[incode]; } virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)=0; -// virtual const SCA_InputEvent& GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0; + // virtual const SCA_InputEvent& GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0; virtual bool ConvertBlenderEvent(unsigned short incode,short val)=0; - + #ifdef WITH_CXX_GUARDEDALLOC public: void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_BlenderInputDevice"); } void operator delete(void *mem) { MEM_freeN(mem); } #endif -}; +}; #endif //__KX_BLENDERINPUTDEVICE diff --git a/source/gameengine/Converter/BL_MeshDeformer.h b/source/gameengine/Converter/BL_MeshDeformer.h index 90466e930fb..0968478ce7e 100644 --- a/source/gameengine/Converter/BL_MeshDeformer.h +++ b/source/gameengine/Converter/BL_MeshDeformer.h @@ -88,7 +88,7 @@ protected: // -- int m_tvtot; BL_DeformableGameObject* m_gameobj; - double m_lastDeformUpdate; + double m_lastDeformUpdate; #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/gameengine/Converter/BL_ShapeDeformer.h b/source/gameengine/Converter/BL_ShapeDeformer.h index 655cc9d7aeb..609603ae52b 100644 --- a/source/gameengine/Converter/BL_ShapeDeformer.h +++ b/source/gameengine/Converter/BL_ShapeDeformer.h @@ -46,8 +46,8 @@ class BL_ShapeDeformer : public BL_SkinDeformer { public: BL_ShapeDeformer(BL_DeformableGameObject *gameobj, - Object *bmeshobj, - RAS_MeshObject *mesh); + Object *bmeshobj, + RAS_MeshObject *mesh); /* this second constructor is needed for making a mesh deformable on the fly. */ BL_ShapeDeformer(BL_DeformableGameObject *gameobj, diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index ffb9a8ce691..7191730187c 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -679,7 +679,7 @@ void KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo) MEM_freeN( tmpicu ); localDel_ipoCurve( tmpicu ); } - } + } } else { ipo = NULL; // XXX add_ipo(blenderObject->id.name+2, ID_OB); blenderObject->ipo = ipo; diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index a84a1419d0d..8fc224fba6f 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -942,7 +942,7 @@ void BL_ConvertActuators(char* maggiename, case ACT_2DFILTER: { bTwoDFilterActuator *_2dfilter = (bTwoDFilterActuator*) bact->data; - SCA_2DFilterActuator *tmp = NULL; + SCA_2DFilterActuator *tmp = NULL; RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode; switch(_2dfilter->type) diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.h b/source/gameengine/GameLogic/SCA_2DFilterActuator.h index 7f31c1713f4..82c82ac3be5 100644 --- a/source/gameengine/GameLogic/SCA_2DFilterActuator.h +++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.h @@ -52,19 +52,19 @@ private: public: - SCA_2DFilterActuator( - class SCA_IObject* gameobj, - RAS_2DFilterManager::RAS_2DFILTER_MODE type, - short flag, - float float_arg, - int int_arg, - RAS_IRasterizer* rasterizer, - SCA_IScene* scene); + SCA_2DFilterActuator( + class SCA_IObject* gameobj, + RAS_2DFilterManager::RAS_2DFILTER_MODE type, + short flag, + float float_arg, + int int_arg, + RAS_IRasterizer* rasterizer, + SCA_IScene* scene); void SetShaderText(const char *text); - virtual ~SCA_2DFilterActuator(); - virtual bool Update(); + virtual ~SCA_2DFilterActuator(); + virtual bool Update(); - virtual CValue* GetReplica(); + virtual CValue* GetReplica(); }; #endif diff --git a/source/gameengine/GameLogic/SCA_PythonController.h b/source/gameengine/GameLogic/SCA_PythonController.h index 3ccbfea7ed5..739e566237b 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.h +++ b/source/gameengine/GameLogic/SCA_PythonController.h @@ -34,7 +34,7 @@ #ifndef KX_PYTHONCONTROLLER_H #define KX_PYTHONCONTROLLER_H - + #include "SCA_IController.h" #include "SCA_LogicManager.h" #include "BoolValue.h" diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp index d76f3f775a5..c9d11a27c76 100644 --- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp +++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp @@ -207,10 +207,10 @@ bool SCA_RandomActuator::Update() sensible values. The termination condition states two things: 1. s >= 0 is not allowed: to prevent the distro from - getting a bias towards high values. This is a small + getting a bias towards high values. This is a small correction, really, and might also be left out. 2. s == 0 is not allowed: to prevent a division by zero - when renormalising the drawn value to the desired + when renormalising the drawn value to the desired distribution shape. As a side effect, the distro will never yield the exact mean. I am not sure whether this is consistent, since the error diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index c5daae9c963..5bc6093a9ff 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -192,7 +192,7 @@ static LRESULT CALLBACK screenSaverWindowProc(HWND hwnd, UINT uMsg, WPARAM wPara LONG dx = scr_save_mouse_pos.x - pt.x; LONG dy = scr_save_mouse_pos.y - pt.y; if (abs(dx) > SCR_SAVE_MOUSE_MOVE_THRESHOLD - || abs(dy) > SCR_SAVE_MOUSE_MOVE_THRESHOLD) + || abs(dy) > SCR_SAVE_MOUSE_MOVE_THRESHOLD) { close = TRUE; } diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h index ff9131f464e..405e2d52989 100644 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h +++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h @@ -43,7 +43,7 @@ class KX_NetworkEventManager : public SCA_EventManager public: KX_NetworkEventManager(class SCA_LogicManager* logicmgr, - class NG_NetworkDeviceInterface *ndi); + class NG_NetworkDeviceInterface *ndi); virtual ~KX_NetworkEventManager (); virtual void NextFrame(); @@ -51,7 +51,7 @@ public: SCA_LogicManager* GetLogicManager() { return m_logicmgr; } class NG_NetworkDeviceInterface* GetNetworkDevice() { - return m_ndi; } + return m_ndi; } }; #endif //KX_NETWORK_EVENTMANAGER_H diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 67178803457..3f6f4bb9099 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -111,7 +111,7 @@ KX_GameObject::KX_GameObject( m_pHitObject(NULL), m_actionManager(NULL), m_isDeformable(false) - #ifdef WITH_PYTHON +#ifdef WITH_PYTHON , m_attr_dict(NULL) #endif { diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp index 7289ffc6e29..cb59ef42699 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp @@ -237,9 +237,9 @@ bool KX_ObjectActuator::Update() if (m_current_linear_factor > 1.0) m_current_linear_factor = 1.0; linV = m_current_linear_factor * m_linear_velocity; - parent->setLinearVelocity(linV,(m_bitLocalFlag.LinearVelocity) != 0); + parent->setLinearVelocity(linV,(m_bitLocalFlag.LinearVelocity) != 0); } else { - parent->setLinearVelocity(m_linear_velocity,(m_bitLocalFlag.LinearVelocity) != 0); + parent->setLinearVelocity(m_linear_velocity,(m_bitLocalFlag.LinearVelocity) != 0); } } } @@ -260,7 +260,7 @@ bool KX_ObjectActuator::Update() if (m_current_angular_factor > 1.0) m_current_angular_factor = 1.0; angV = m_current_angular_factor * m_angular_velocity; - parent->setAngularVelocity(angV,(m_bitLocalFlag.AngularVelocity) != 0); + parent->setAngularVelocity(angV,(m_bitLocalFlag.AngularVelocity) != 0); } else { parent->setAngularVelocity(m_angular_velocity,(m_bitLocalFlag.AngularVelocity) != 0); } diff --git a/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp b/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp index d9483083aa1..bd743159950 100644 --- a/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp +++ b/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp @@ -51,6 +51,6 @@ void KX_OrientationInterpolator::Execute(float currentTime) const { MT_Scalar ss = si*sh; m_target.setValue(cj*ch, sj*sc-cs, sj*cc+ss, - cj*sh, sj*ss+cc, sj*cs-sc, - -sj, cj*si, cj*ci); + cj*sh, sj*ss+cc, sj*cs-sc, + -sj, cj*si, cj*ci); } diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp index 9d0597051ad..d32f267f0e0 100644 --- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp +++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp @@ -187,7 +187,7 @@ void KX_PolygonMaterial::DefaultActivate(RAS_IRasterizer* rasty, TCachingInfo& c rasty->SetCullFace(true); if ((m_drawingmode & RAS_IRasterizer::KX_LINES) || - (rasty->GetDrawingMode() <= RAS_IRasterizer::KX_WIREFRAME)) + (rasty->GetDrawingMode() <= RAS_IRasterizer::KX_WIREFRAME)) rasty->SetLines(true); else rasty->SetLines(false); diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.h b/source/gameengine/Ketsji/KX_TrackToActuator.h index c5e96bd7454..bbf0134a859 100644 --- a/source/gameengine/Ketsji/KX_TrackToActuator.h +++ b/source/gameengine/Ketsji/KX_TrackToActuator.h @@ -57,7 +57,7 @@ class KX_TrackToActuator : public SCA_IActuator public: KX_TrackToActuator(SCA_IObject* gameobj, SCA_IObject *ob, int time, - bool threedee,int trackflag,int upflag); + bool threedee,int trackflag,int upflag); virtual ~KX_TrackToActuator(); virtual CValue* GetReplica() { KX_TrackToActuator* replica = new KX_TrackToActuator(*this); diff --git a/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h b/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h index 67d0e741507..cb7807a86a6 100644 --- a/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h +++ b/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h @@ -52,8 +52,8 @@ public: virtual void NextFrame(); bool Connect(char *address, unsigned int port, char *password, - unsigned int localport, unsigned int timeout) { - return true;} + unsigned int localport, unsigned int timeout) { + return true;} bool Disconnect(void) {return true;} virtual void SendNetworkMessage(class NG_NetworkMessage* msg); diff --git a/source/gameengine/Network/NG_NetworkDeviceInterface.h b/source/gameengine/Network/NG_NetworkDeviceInterface.h index 6df228680ec..857b4660327 100644 --- a/source/gameengine/Network/NG_NetworkDeviceInterface.h +++ b/source/gameengine/Network/NG_NetworkDeviceInterface.h @@ -64,7 +64,7 @@ public: bool IsOnline(void) { return m_online; } virtual bool Connect(char *address, unsigned int port, char *password, - unsigned int localport, unsigned int timeout)=0; + unsigned int localport, unsigned int timeout)=0; virtual bool Disconnect(void)=0; virtual void SendNetworkMessage(NG_NetworkMessage* msg)=0; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h index 08445654916..82acd64161f 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h @@ -216,12 +216,12 @@ struct CcdConstructionInfo ///more advanced collision filtering should be done in btCollisionDispatcher::NeedsCollision enum CollisionFilterGroups { - DefaultFilter = 1, - StaticFilter = 2, - KinematicFilter = 4, - DebrisFilter = 8, - SensorFilter = 16, - AllFilter = DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorFilter, + DefaultFilter = 1, + StaticFilter = 2, + KinematicFilter = 4, + DebrisFilter = 8, + SensorFilter = 16, + AllFilter = DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorFilter, }; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 526176481ed..39b2022a1f4 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -2564,8 +2564,8 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl btPlaneSpace1( axisInA, axis1, axis2 ); frameInA.getBasis().setValue( axisInA.x(), axis1.x(), axis2.x(), - axisInA.y(), axis1.y(), axis2.y(), - axisInA.z(), axis1.z(), axis2.z() ); + axisInA.y(), axis1.y(), axis2.y(), + axisInA.z(), axis1.z(), axis2.z() ); frameInA.setOrigin( pivotInA ); diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h index 18e1282b111..c34a00513bf 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h @@ -164,7 +164,7 @@ protected: virtual float getConstraintParam(int constraintId,int param); - virtual void removeConstraint(int constraintid); + virtual void removeConstraint(int constraintid); virtual float getAppliedImpulse(int constraintid); diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp index ed18ff0329e..d9a9fbb0d31 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp @@ -306,8 +306,8 @@ void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance) if(depth){ glGenTextures(1, (GLuint*)&texname[1]); glBindTexture(GL_TEXTURE_2D, texname[1]); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, texturewidth,textureheight, - 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE,NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, texturewidth,textureheight, + 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE,NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); diff --git a/source/gameengine/Rasterizer/RAS_CameraData.h b/source/gameengine/Rasterizer/RAS_CameraData.h index e6254f72511..5657fda4f3c 100644 --- a/source/gameengine/Rasterizer/RAS_CameraData.h +++ b/source/gameengine/Rasterizer/RAS_CameraData.h @@ -49,19 +49,19 @@ struct RAS_CameraData float m_focallength; RAS_CameraData(float lens = 35.0, float scale = 6.0, float clipstart = 0.1, float clipend = 5000.0, bool perspective = true, - float focallength = 3.0, bool viewport = false, int viewportleft = 0, int viewportbottom = 0, - int viewportright = 0, int viewporttop = 0) : - m_lens(lens), - m_scale(scale), - m_clipstart(clipstart), - m_clipend(clipend), - m_perspective(perspective), - m_viewport(viewport), - m_viewportleft(viewportleft), - m_viewportbottom(viewportbottom), - m_viewportright(viewportright), - m_viewporttop(viewporttop), - m_focallength(focallength) + float focallength = 3.0, bool viewport = false, int viewportleft = 0, int viewportbottom = 0, + int viewportright = 0, int viewporttop = 0) : + m_lens(lens), + m_scale(scale), + m_clipstart(clipstart), + m_clipend(clipend), + m_perspective(perspective), + m_viewport(viewport), + m_viewportleft(viewportleft), + m_viewportbottom(viewportbottom), + m_viewportright(viewportright), + m_viewporttop(viewporttop), + m_focallength(focallength) { } }; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h index a277d9835d8..3a3ea57d67b 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h @@ -38,17 +38,17 @@ uniform vec2 bgl_TextureCoordinateOffset[9]; void main(void) { - vec4 sample[9]; + vec4 sample[9]; - for (int i = 0; i < 9; i++) - { - sample[i] = texture2D(bgl_RenderedTexture, - gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); - } + for (int i = 0; i < 9; i++) + { + sample[i] = texture2D(bgl_RenderedTexture, + gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); + } - gl_FragColor = (sample[0] + (2.0*sample[1]) + sample[2] + - (2.0*sample[3]) + sample[4] + (2.0*sample[5]) + - sample[6] + (2.0*sample[7]) + sample[8]) / 13.0; + gl_FragColor = (sample[0] + (2.0*sample[1]) + sample[2] + + (2.0*sample[3]) + sample[4] + (2.0*sample[5]) + + sample[6] + (2.0*sample[7]) + sample[8]) / 13.0; } ); #endif diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h index 6aeff254f77..f486be47f9f 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h @@ -38,17 +38,17 @@ uniform vec2 bgl_TextureCoordinateOffset[9]; void main(void) { - vec4 sample[9]; - vec4 maxValue = vec4(0.0); + vec4 sample[9]; + vec4 maxValue = vec4(0.0); - for (int i = 0; i < 9; i++) - { - sample[i] = texture2D(bgl_RenderedTexture, - gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); - maxValue = max(sample[i], maxValue); - } + for (int i = 0; i < 9; i++) + { + sample[i] = texture2D(bgl_RenderedTexture, + gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); + maxValue = max(sample[i], maxValue); + } - gl_FragColor = maxValue; + gl_FragColor = maxValue; } ); #endif diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h index 1e9dccaec87..a1755dc0eeb 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h @@ -33,22 +33,22 @@ #define __RAS_EROSION2DFILTER const char * ErosionFragmentShader=STRINGIFY( -uniform sampler2D bgl_RenderedTexture; -uniform vec2 bgl_TextureCoordinateOffset[9]; + uniform sampler2D bgl_RenderedTexture; + uniform vec2 bgl_TextureCoordinateOffset[9]; void main(void) { - vec4 sample[9]; - vec4 minValue = vec4(1.0); + vec4 sample[9]; + vec4 minValue = vec4(1.0); - for (int i = 0; i < 9; i++) - { - sample[i] = texture2D(bgl_RenderedTexture, - gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); - minValue = min(sample[i], minValue); - } + for (int i = 0; i < 9; i++) + { + sample[i] = texture2D(bgl_RenderedTexture, + gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); + minValue = min(sample[i], minValue); + } - gl_FragColor = minValue; + gl_FragColor = minValue; } ); #endif diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h index c7cfa83a11f..45c94d358ba 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h @@ -38,18 +38,18 @@ uniform vec2 bgl_TextureCoordinateOffset[9]; void main(void) { - vec4 sample[9]; + vec4 sample[9]; - for (int i = 0; i < 9; i++) - { - sample[i] = texture2D(bgl_RenderedTexture, - gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); - } + for (int i = 0; i < 9; i++) + { + sample[i] = texture2D(bgl_RenderedTexture, + gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); + } - gl_FragColor = (sample[4] * 8.0) - - (sample[0] + sample[1] + sample[2] + - sample[3] + sample[5] + - sample[6] + sample[7] + sample[8]); + gl_FragColor = (sample[4] * 8.0) - + (sample[0] + sample[1] + sample[2] + + sample[3] + sample[5] + + sample[6] + sample[7] + sample[8]); gl_FragColor = vec4(gl_FragColor.rgb, 1.0); } ); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h index ada53cd751d..8d08d9077cb 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h @@ -38,23 +38,23 @@ uniform vec2 bgl_TextureCoordinateOffset[9]; void main(void) { - vec4 sample[9]; + vec4 sample[9]; - for (int i = 0; i < 9; i++) - { - sample[i] = texture2D(bgl_RenderedTexture, - gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); - } + for (int i = 0; i < 9; i++) + { + sample[i] = texture2D(bgl_RenderedTexture, + gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); + } - vec4 horizEdge = sample[2] + sample[5] + sample[8] - - (sample[0] + sample[3] + sample[6]); + vec4 horizEdge = sample[2] + sample[5] + sample[8] - + (sample[0] + sample[3] + sample[6]); - vec4 vertEdge = sample[0] + sample[1] + sample[2] - - (sample[6] + sample[7] + sample[8]); + vec4 vertEdge = sample[0] + sample[1] + sample[2] - + (sample[6] + sample[7] + sample[8]); - gl_FragColor.rgb = sqrt((horizEdge.rgb * horizEdge.rgb) + - (vertEdge.rgb * vertEdge.rgb)); - gl_FragColor.a = 1.0; + gl_FragColor.rgb = sqrt((horizEdge.rgb * horizEdge.rgb) + + (vertEdge.rgb * vertEdge.rgb)); + gl_FragColor.a = 1.0; } ); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h index 0d68bc09c70..a9c827fa9e1 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h @@ -38,18 +38,18 @@ uniform vec2 bgl_TextureCoordinateOffset[9]; void main(void) { - vec4 sample[9]; + vec4 sample[9]; - for (int i = 0; i < 9; i++) - { - sample[i] = texture2D(bgl_RenderedTexture, - gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); - } + for (int i = 0; i < 9; i++) + { + sample[i] = texture2D(bgl_RenderedTexture, + gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); + } - gl_FragColor = (sample[4] * 9.0) - - (sample[0] + sample[1] + sample[2] + - sample[3] + sample[5] + - sample[6] + sample[7] + sample[8]); + gl_FragColor = (sample[4] * 9.0) - + (sample[0] + sample[1] + sample[2] + + sample[3] + sample[5] + + sample[6] + sample[7] + sample[8]); } ); #endif diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h index 0f80f0f22b4..350ce19fafd 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h @@ -38,23 +38,23 @@ uniform vec2 bgl_TextureCoordinateOffset[9]; void main(void) { - vec4 sample[9]; + vec4 sample[9]; - for (int i = 0; i < 9; i++) - { - sample[i] = texture2D(bgl_RenderedTexture, - gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); - } + for (int i = 0; i < 9; i++) + { + sample[i] = texture2D(bgl_RenderedTexture, + gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); + } - vec4 horizEdge = sample[2] + (2.0*sample[5]) + sample[8] - - (sample[0] + (2.0*sample[3]) + sample[6]); + vec4 horizEdge = sample[2] + (2.0*sample[5]) + sample[8] - + (sample[0] + (2.0*sample[3]) + sample[6]); - vec4 vertEdge = sample[0] + (2.0*sample[1]) + sample[2] - - (sample[6] + (2.0*sample[7]) + sample[8]); + vec4 vertEdge = sample[0] + (2.0*sample[1]) + sample[2] - + (sample[6] + (2.0*sample[7]) + sample[8]); - gl_FragColor.rgb = sqrt((horizEdge.rgb * horizEdge.rgb) + - (vertEdge.rgb * vertEdge.rgb)); - gl_FragColor.a = 1.0; + gl_FragColor.rgb = sqrt((horizEdge.rgb * horizEdge.rgb) + + (vertEdge.rgb * vertEdge.rgb)); + gl_FragColor.a = 1.0; } ); #endif diff --git a/source/gameengine/SceneGraph/SG_DList.h b/source/gameengine/SceneGraph/SG_DList.h index b82e51e0d2f..9e7e514b27a 100644 --- a/source/gameengine/SceneGraph/SG_DList.h +++ b/source/gameengine/SceneGraph/SG_DList.h @@ -134,88 +134,88 @@ public: } }; - SG_DList() - { - m_flink = m_blink = this; - } + SG_DList() + { + m_flink = m_blink = this; + } SG_DList(const SG_DList& other) { - m_flink = m_blink = this; + m_flink = m_blink = this; } - virtual ~SG_DList() - { + virtual ~SG_DList() + { Delink(); - } + } - inline bool Empty() // Check for empty queue - { - return ( m_flink == this ); - } - bool AddBack( SG_DList *item ) // Add to the back - { + inline bool Empty() // Check for empty queue + { + return ( m_flink == this ); + } + bool AddBack( SG_DList *item ) // Add to the back + { if (!item->Empty()) return false; - item->m_blink = m_blink; - item->m_flink = this; - m_blink->m_flink = item; - m_blink = item; + item->m_blink = m_blink; + item->m_flink = this; + m_blink->m_flink = item; + m_blink = item; return true; - } - bool AddFront( SG_DList *item ) // Add to the back - { + } + bool AddFront( SG_DList *item ) // Add to the back + { if (!item->Empty()) return false; - item->m_flink = m_flink; - item->m_blink = this; - m_flink->m_blink = item; - m_flink = item; + item->m_flink = m_flink; + item->m_blink = this; + m_flink->m_blink = item; + m_flink = item; return true; - } - SG_DList *Remove() // Remove from the front - { - if (Empty()) - { - return NULL; - } - SG_DList* item = m_flink; - m_flink = item->m_flink; - m_flink->m_blink = this; - item->m_flink = item->m_blink = item; - return item; - } - bool Delink() // Remove from the middle - { + } + SG_DList *Remove() // Remove from the front + { + if (Empty()) + { + return NULL; + } + SG_DList* item = m_flink; + m_flink = item->m_flink; + m_flink->m_blink = this; + item->m_flink = item->m_blink = item; + return item; + } + bool Delink() // Remove from the middle + { if (Empty()) return false; m_blink->m_flink = m_flink; m_flink->m_blink = m_blink; m_flink = m_blink = this; return true; - } - inline SG_DList *Peek() // Look at front without removing - { - return m_flink; - } - inline SG_DList *Back() // Look at front without removing - { - return m_blink; - } - inline SG_DList *Self() - { - return this; - } - inline const SG_DList *Peek() const // Look at front without removing - { - return (const SG_DList*)m_flink; - } - inline const SG_DList *Back() const // Look at front without removing - { - return (const SG_DList*)m_blink; - } - inline const SG_DList *Self() const - { - return this; - } + } + inline SG_DList *Peek() // Look at front without removing + { + return m_flink; + } + inline SG_DList *Back() // Look at front without removing + { + return m_blink; + } + inline SG_DList *Self() + { + return this; + } + inline const SG_DList *Peek() const // Look at front without removing + { + return (const SG_DList*)m_flink; + } + inline const SG_DList *Back() const // Look at front without removing + { + return (const SG_DList*)m_blink; + } + inline const SG_DList *Self() const + { + return this; + } #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/gameengine/SceneGraph/SG_IObject.h b/source/gameengine/SceneGraph/SG_IObject.h index c42935bc487..8c0159fe8d4 100644 --- a/source/gameengine/SceneGraph/SG_IObject.h +++ b/source/gameengine/SceneGraph/SG_IObject.h @@ -194,7 +194,7 @@ public: /** * Clear the array of pointers to controllers associated with * this node. This does not delete the controllers themselves! - * This should be used very carefully to avoid memory + * This should be used very carefully to avoid memory * leaks. */ diff --git a/source/gameengine/SceneGraph/SG_QList.h b/source/gameengine/SceneGraph/SG_QList.h index de79c35821e..eb404b1a5a5 100644 --- a/source/gameengine/SceneGraph/SG_QList.h +++ b/source/gameengine/SceneGraph/SG_QList.h @@ -91,73 +91,73 @@ public: }; SG_QList() : SG_DList() - { - m_fqlink = m_bqlink = this; - } + { + m_fqlink = m_bqlink = this; + } SG_QList(const SG_QList& other) : SG_DList() { - m_fqlink = m_bqlink = this; + m_fqlink = m_bqlink = this; } - virtual ~SG_QList() - { + virtual ~SG_QList() + { QDelink(); - } + } - inline bool QEmpty() // Check for empty queue - { - return ( m_fqlink == this ); - } - bool QAddBack( SG_QList *item ) // Add to the back - { + inline bool QEmpty() // Check for empty queue + { + return ( m_fqlink == this ); + } + bool QAddBack( SG_QList *item ) // Add to the back + { if (!item->QEmpty()) return false; - item->m_bqlink = m_bqlink; - item->m_fqlink = this; - m_bqlink->m_fqlink = item; - m_bqlink = item; + item->m_bqlink = m_bqlink; + item->m_fqlink = this; + m_bqlink->m_fqlink = item; + m_bqlink = item; return true; - } - bool QAddFront( SG_QList *item ) // Add to the back - { + } + bool QAddFront( SG_QList *item ) // Add to the back + { if (!item->Empty()) return false; - item->m_fqlink = m_fqlink; - item->m_bqlink = this; - m_fqlink->m_bqlink = item; - m_fqlink = item; + item->m_fqlink = m_fqlink; + item->m_bqlink = this; + m_fqlink->m_bqlink = item; + m_fqlink = item; return true; - } - SG_QList *QRemove() // Remove from the front - { - if (QEmpty()) - { - return NULL; - } - SG_QList* item = m_fqlink; - m_fqlink = item->m_fqlink; - m_fqlink->m_bqlink = this; - item->m_fqlink = item->m_bqlink = item; - return item; - } - bool QDelink() // Remove from the middle - { + } + SG_QList *QRemove() // Remove from the front + { + if (QEmpty()) + { + return NULL; + } + SG_QList* item = m_fqlink; + m_fqlink = item->m_fqlink; + m_fqlink->m_bqlink = this; + item->m_fqlink = item->m_bqlink = item; + return item; + } + bool QDelink() // Remove from the middle + { if (QEmpty()) return false; m_bqlink->m_fqlink = m_fqlink; m_fqlink->m_bqlink = m_bqlink; m_fqlink = m_bqlink = this; return true; - } - inline SG_QList *QPeek() // Look at front without removing - { - return m_fqlink; - } - inline SG_QList *QBack() // Look at front without removing - { - return m_bqlink; - } - - + } + inline SG_QList *QPeek() // Look at front without removing + { + return m_fqlink; + } + inline SG_QList *QBack() // Look at front without removing + { + return m_bqlink; + } + + #ifdef WITH_CXX_GUARDEDALLOC public: void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SG_QList"); } diff --git a/source/gameengine/SceneGraph/SG_Spatial.cpp b/source/gameengine/SceneGraph/SG_Spatial.cpp index 94b8584051e..09fb7278bfa 100644 --- a/source/gameengine/SceneGraph/SG_Spatial.cpp +++ b/source/gameengine/SceneGraph/SG_Spatial.cpp @@ -115,7 +115,7 @@ UpdateSpatialData( const SG_Spatial *parent, double time, bool& parentUpdated -){ + ){ bool bComputesWorldTransform = false; // update spatial controllers diff --git a/source/gameengine/VideoTexture/Exception.h b/source/gameengine/VideoTexture/Exception.h index 16248186108..11e617cf4ce 100644 --- a/source/gameengine/VideoTexture/Exception.h +++ b/source/gameengine/VideoTexture/Exception.h @@ -122,11 +122,11 @@ public: desc = m_description; } - void registerDesc(void) - { - if (std::find(m_expDescs.begin(), m_expDescs.end(), this) == m_expDescs.end()) - m_expDescs.push_back(this); - } + void registerDesc(void) + { + if (std::find(m_expDescs.begin(), m_expDescs.end(), this) == m_expDescs.end()) + m_expDescs.push_back(this); + } // list of exception descriptions static std::vector m_expDescs; diff --git a/source/gameengine/VideoTexture/ImageBase.cpp b/source/gameengine/VideoTexture/ImageBase.cpp index 86de214e2d3..65509ab9424 100644 --- a/source/gameengine/VideoTexture/ImageBase.cpp +++ b/source/gameengine/VideoTexture/ImageBase.cpp @@ -375,7 +375,7 @@ void Image_dealloc (PyImage * self) if (self->m_image->m_exports > 0) { PyErr_SetString(PyExc_SystemError, - "deallocated Image object has exported buffers"); + "deallocated Image object has exported buffers"); PyErr_Print(); } // if release requires deleting of object, do it diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp index 24833ace08f..f7546d876b2 100644 --- a/source/gameengine/VideoTexture/ImageRender.cpp +++ b/source/gameengine/VideoTexture/ImageRender.cpp @@ -328,11 +328,11 @@ static int ImageRender_init (PyObject * pySelf, PyObject * args, PyObject * kwds // get background color PyObject * getBackground (PyImage * self, void * closure) { - return Py_BuildValue("[BBBB]", - getImageRender(self)->getBackground(0), - getImageRender(self)->getBackground(1), - getImageRender(self)->getBackground(2), - getImageRender(self)->getBackground(3)); + return Py_BuildValue("[BBBB]", + getImageRender(self)->getBackground(0), + getImageRender(self)->getBackground(1), + getImageRender(self)->getBackground(2), + getImageRender(self)->getBackground(3)); } // set color -- cgit v1.2.3 From 60dcfe25269ff9709c784f6f44c9b0273e73c786 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 3 Sep 2011 04:44:18 +0000 Subject: =?UTF-8?q?fix=20[#28462]=20Tiled=20textures=20and=202D=20filters?= =?UTF-8?q?=20don't=20mix=20patch=20by=20Juha=20M=C3=A4ki-Kanto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/gameengine/Rasterizer/RAS_2DFilterManager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp index d9a9fbb0d31..725d00aa5cd 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp @@ -433,6 +433,9 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, 0, 0, texturewidth,textureheight, 0); } + // reverting to texunit 0, without this we get bug [#28462] + glActiveTextureARB(GL_TEXTURE0); + glViewport(0,0, texturewidth, textureheight); glDisable(GL_DEPTH_TEST); -- cgit v1.2.3 From 8cc307b4f2d2e1321ab8ec1baee6697ae3b0a967 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 3 Sep 2011 06:46:31 +0000 Subject: PyC_ExceptionBuffer is now threadsafe, used for converting exceptions into reports. --- source/blender/python/generic/py_capi_utils.c | 79 ++++++--------------------- 1 file changed, 18 insertions(+), 61 deletions(-) diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 81aea8571f8..b7e67ec5a93 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -208,77 +208,34 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...) return item; } -/* returns the exception string as a new PyUnicode object, depends on external StringIO module */ +/* returns the exception string as a new PyUnicode object, depends on external traceback module */ PyObject *PyC_ExceptionBuffer(void) { - PyObject *stdout_backup = PySys_GetObject("stdout"); /* borrowed */ - PyObject *stderr_backup = PySys_GetObject("stderr"); /* borrowed */ - PyObject *string_io = NULL; - PyObject *string_io_buf = NULL; - PyObject *string_io_mod= NULL; - PyObject *string_io_getvalue= NULL; - - PyObject *error_type, *error_value, *error_traceback; - - if (!PyErr_Occurred()) - return NULL; - - PyErr_Fetch(&error_type, &error_value, &error_traceback); - - PyErr_Clear(); - - /* import io - * string_io = io.StringIO() - */ - - if(! (string_io_mod= PyImport_ImportModule("io")) ) { + PyObject *traceback_mod= NULL; + PyObject *format_tb_func= NULL; + PyObject *ret= NULL; + + if(! (traceback_mod= PyImport_ImportModule("traceback")) ) { goto error_cleanup; } - else if (! (string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) { + else if (! (format_tb_func= PyObject_GetAttrString(traceback_mod, "format_exc"))) { goto error_cleanup; } - else if (! (string_io_getvalue= PyObject_GetAttrString(string_io, "getvalue"))) { - goto error_cleanup; + + ret= PyObject_CallObject(format_tb_func, NULL); + + if(ret == Py_None) { + Py_DECREF(ret); + ret= NULL; } - - Py_INCREF(stdout_backup); // since these were borrowed we dont want them freed when replaced. - Py_INCREF(stderr_backup); - - PySys_SetObject("stdout", string_io); // both of these are free'd when restoring - PySys_SetObject("stderr", string_io); - - PyErr_Restore(error_type, error_value, error_traceback); - PyErr_Print(); /* print the error */ - PyErr_Clear(); - - string_io_buf = PyObject_CallObject(string_io_getvalue, NULL); - - PySys_SetObject("stdout", stdout_backup); - PySys_SetObject("stderr", stderr_backup); - - Py_DECREF(stdout_backup); /* now sys owns the ref again */ - Py_DECREF(stderr_backup); - - Py_DECREF(string_io_mod); - Py_DECREF(string_io_getvalue); - Py_DECREF(string_io); /* free the original reference */ - - PyErr_Clear(); - return string_io_buf; - - + error_cleanup: /* could not import the module so print the error and close */ - Py_XDECREF(string_io_mod); - Py_XDECREF(string_io); - - PyErr_Restore(error_type, error_value, error_traceback); - PyErr_Print(); /* print the error */ - PyErr_Clear(); - - return NULL; -} + Py_XDECREF(traceback_mod); + Py_XDECREF(format_tb_func); + return ret; +} /* string conversion, escape non-unicode chars, coerce must be set to NULL */ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce) -- cgit v1.2.3 From a6a14d0a1e2dcc1aa5535a96339245bb645fba58 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Sat, 3 Sep 2011 08:18:43 +0000 Subject: == CustomData == * Added comments for each entry in the LAYERTYPEINFO array noting the number and name of the layer type; was hard to tell before which entry was what --- source/blender/blenkernel/intern/customdata.c | 28 +++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 8d19322c0db..c342bbc917f 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -808,41 +808,65 @@ static void layerDefault_mcol(void *data, int count) static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { + /* 0: CD_MVERT */ {sizeof(MVert), "MVert", 1, NULL, NULL, NULL, NULL, NULL, NULL}, + /* 1: CD_MSTICKY */ {sizeof(MSticky), "MSticky", 1, NULL, NULL, NULL, layerInterp_msticky, NULL, NULL}, + /* 2: CD_MDEFORMVERT */ {sizeof(MDeformVert), "MDeformVert", 1, NULL, layerCopy_mdeformvert, layerFree_mdeformvert, layerInterp_mdeformvert, NULL, NULL}, + /* 3: CD_MEDGE */ {sizeof(MEdge), "MEdge", 1, NULL, NULL, NULL, NULL, NULL, NULL}, + /* 4: CD_MFACE */ {sizeof(MFace), "MFace", 1, NULL, NULL, NULL, NULL, NULL, NULL}, + /* 5: CD_MTFACE */ {sizeof(MTFace), "MTFace", 1, "UVTex", layerCopy_tface, NULL, layerInterp_tface, layerSwap_tface, layerDefault_tface}, + /* 6: CD_MCOL */ /* 4 MCol structs per face */ {sizeof(MCol)*4, "MCol", 4, "Col", NULL, NULL, layerInterp_mcol, layerSwap_mcol, layerDefault_mcol}, + /* 7: CD_ORIGINDEX */ {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, + /* 8: CD_NORMAL */ /* 3 floats per normal vector */ {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, + /* 9: CD_FLAGS */ {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, + /* 10: CD_PROP_FLT */ {sizeof(MFloatProperty), "MFloatProperty",1,"Float",NULL,NULL,NULL,NULL}, + /* 11: CD_PROP_INT */ {sizeof(MIntProperty), "MIntProperty",1,"Int",NULL,NULL,NULL,NULL}, + /* 12: CD_PROP_STR */ {sizeof(MStringProperty), "MStringProperty",1,"String",NULL,NULL,NULL,NULL}, + /* 13: CD_ORIGSPACE */ {sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVTex", layerCopy_origspace_face, NULL, layerInterp_origspace_face, layerSwap_origspace_face, layerDefault_origspace_face}, + /* 14: CD_ORCO */ {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, + /* 15: CD_MTEXPOLY */ {sizeof(MTexPoly), "MTexPoly", 1, "Face Texture", NULL, NULL, NULL, NULL, NULL}, + /* 16: CD_MLOOPUV */ {sizeof(MLoopUV), "MLoopUV", 1, "UV coord", NULL, NULL, layerInterp_mloopuv, NULL, NULL}, + /* 17: CD_MLOOPCOL */ {sizeof(MLoopCol), "MLoopCol", 1, "Col", NULL, NULL, layerInterp_mloopcol, NULL, layerDefault_mloopcol}, + /* 18: CD_TANGENT */ {sizeof(float)*4*4, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, + /* 19: CD_MDISPS */ {sizeof(MDisps), "MDisps", 1, NULL, layerCopy_mdisps, layerFree_mdisps, layerInterp_mdisps, layerSwap_mdisps, NULL, layerRead_mdisps, layerWrite_mdisps, layerFilesize_mdisps, layerValidate_mdisps}, + /* 20: CD_WEIGHT_MCOL */ {sizeof(MCol)*4, "MCol", 4, "WeightCol", NULL, NULL, layerInterp_mcol, layerSwap_mcol, layerDefault_mcol}, - {sizeof(MCol)*4, "MCol", 4, "IDCol", NULL, NULL, layerInterp_mcol, + /* 21: CD_ID_MCOL */ + {sizeof(MCol)*4, "MCol", 4, "IDCol", NULL, NULL, layerInterp_mcol, layerSwap_mcol, layerDefault_mcol}, - {sizeof(MCol)*4, "MCol", 4, "TexturedCol", NULL, NULL, layerInterp_mcol, + /* 22: CD_TEXTURE_MCOL */ + {sizeof(MCol)*4, "MCol", 4, "TexturedCol", NULL, NULL, layerInterp_mcol, layerSwap_mcol, layerDefault_mcol}, + /* 23: CD_CLOTH_ORCO */ {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL} }; -- cgit v1.2.3 From a01ffbbddb40c8f14f10aa5edf0cd1ba5dcc6942 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 3 Sep 2011 09:43:20 +0000 Subject: minor edits to build on openbsd --- intern/guardedalloc/MEM_sys_types.h | 2 +- intern/opennl/superlu/superlu_sys_types.h | 2 +- source/blender/blenloader/BLO_sys_types.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/intern/guardedalloc/MEM_sys_types.h b/intern/guardedalloc/MEM_sys_types.h index c5148e84ffe..48230db23a3 100644 --- a/intern/guardedalloc/MEM_sys_types.h +++ b/intern/guardedalloc/MEM_sys_types.h @@ -88,7 +88,7 @@ typedef unsigned long uintptr_t; #define _UINTPTR_T_DEFINED #endif -#elif defined(__linux__) || defined(__NetBSD__) +#elif defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) /* Linux-i386, Linux-Alpha, Linux-ppc */ #include diff --git a/intern/opennl/superlu/superlu_sys_types.h b/intern/opennl/superlu/superlu_sys_types.h index 2cd9cab453d..c154b4c50ac 100644 --- a/intern/opennl/superlu/superlu_sys_types.h +++ b/intern/opennl/superlu/superlu_sys_types.h @@ -89,7 +89,7 @@ typedef unsigned long uintptr_t; #define _UINTPTR_T_DEFINED #endif -#elif defined(__linux__) || defined(__NetBSD__) +#elif defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) /* Linux-i386, Linux-Alpha, Linux-ppc */ #include diff --git a/source/blender/blenloader/BLO_sys_types.h b/source/blender/blenloader/BLO_sys_types.h index d56723ec1c5..2114fc34bf1 100644 --- a/source/blender/blenloader/BLO_sys_types.h +++ b/source/blender/blenloader/BLO_sys_types.h @@ -83,7 +83,7 @@ typedef unsigned long uintptr_t; #define _UINTPTR_T_DEFINED #endif -#elif defined(__linux__) || defined(__NetBSD__) +#elif defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) /* Linux-i386, Linux-Alpha, Linux-ppc */ #include -- cgit v1.2.3 From 451136e7c0860b5240d4fcec50c95cd4790b8e2b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 3 Sep 2011 15:36:36 +0000 Subject: warning fixes --- intern/iksolver/intern/IK_QSegment.cpp | 2 +- source/blender/blenkernel/intern/mesh_validate.c | 2 +- source/blender/collada/DocumentExporter.cpp | 7 ++----- source/blender/collada/ExtraTags.cpp | 12 ++++-------- source/blender/makesrna/intern/rna_scene_api.c | 2 +- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/intern/iksolver/intern/IK_QSegment.cpp b/intern/iksolver/intern/IK_QSegment.cpp index df4fbc8fadd..ba4fbb88542 100644 --- a/intern/iksolver/intern/IK_QSegment.cpp +++ b/intern/iksolver/intern/IK_QSegment.cpp @@ -319,7 +319,7 @@ void IK_QSegment::RemoveChild(IK_QSegment *child) else { IK_QSegment *seg = m_child; - while (seg->m_sibling != child); + while (seg->m_sibling != child) seg = seg->m_sibling; if (child == seg->m_sibling) diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 9c916d517c5..70398594872 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -166,7 +166,7 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve } if(BLI_edgehash_haskey(edge_hash, med->v1, med->v2)) { - PRINT(" edge %u: is a duplicate of, %u\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2))); + PRINT(" edge %u: is a duplicate of, %d\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2))); remove= do_fixes; } diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 285ab283b37..6e780889d16 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -328,9 +328,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename, bool //scale = RNA_struct_find_property(&unit_settings, "scale_length"); std::string unitname = "meter"; - float linearmeasure = 1.0f; - - linearmeasure = RNA_float_get(&unit_settings, "scale_length"); + float linearmeasure = RNA_float_get(&unit_settings, "scale_length"); switch(RNA_property_enum_get(&unit_settings, system)) { case USER_UNIT_NONE: @@ -368,8 +366,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename, bool asset.setUnit(unitname, linearmeasure); asset.setUpAxisType(COLLADASW::Asset::Z_UP); - // TODO: need an Author field in userpref - if(strlen(U.author) > 0) { + if(U.author[0] != '\0') { asset.getContributor().mAuthor = U.author; } else { diff --git a/source/blender/collada/ExtraTags.cpp b/source/blender/collada/ExtraTags.cpp index 653d4a377cd..f0c6d2228b1 100644 --- a/source/blender/collada/ExtraTags.cpp +++ b/source/blender/collada/ExtraTags.cpp @@ -90,32 +90,28 @@ std::string ExtraTags::asString( std::string tag, bool *ok) void ExtraTags::setData(std::string tag, short *data) { bool ok = false; - int tmp = 0; - tmp = asInt(tag, &ok); + int tmp = asInt(tag, &ok); if(ok) *data = (short)tmp; } void ExtraTags::setData(std::string tag, int *data) { bool ok = false; - int tmp = 0; - tmp = asInt(tag, &ok); + int tmp = asInt(tag, &ok); if(ok) *data = tmp; } void ExtraTags::setData(std::string tag, float *data) { bool ok = false; - float tmp = 0.0f; - tmp = asFloat(tag, &ok); + float tmp = asFloat(tag, &ok); if(ok) *data = tmp; } void ExtraTags::setData(std::string tag, char *data) { bool ok = false; - int tmp = 0; - tmp = asInt(tag, &ok); + int tmp = asInt(tag, &ok); if(ok) *data = (char)tmp; } diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 1220c4f34a1..fd7987c18a2 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -111,7 +111,7 @@ void RNA_api_scene(StructRNA *srna) #ifdef WITH_COLLADA /* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */ func= RNA_def_function(srna, "collada_export", "rna_Scene_collada_export"); - parm= RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file."); + RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file."); parm= RNA_def_boolean(func, "selected", 0, "Export only selected", "Export only selected elements."); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */ -- cgit v1.2.3 From 8295480bbeee2aafa0ea70d19836b3ab094ee08e Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sat, 3 Sep 2011 19:33:07 +0000 Subject: BGE animations: Fixing a crash that would happen if the property for a property mode action actuator was invalid. --- source/gameengine/Converter/BL_ActionActuator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 50e887a21a8..063544932de 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -217,6 +217,9 @@ bool BL_ActionActuator::Update(double curtime, bool frame) case ACT_ACTION_FROM_PROP: CValue* prop = GetParent()->GetProperty(m_propname); + // If we don't have a property, we can't do anything, so just bail + if (!prop) return false; + playtype = BL_Action::ACT_MODE_PLAY; start = end = prop->GetNumber(); -- cgit v1.2.3 From 1f8291f78d6eb3e02414cc7801fe5ba9ad524e4b Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sat, 3 Sep 2011 20:48:47 +0000 Subject: BGE animations: Adding a separate list to KX_Scene for animated objects. This makes scenes with a lot of non-animated objects faster. In my test scene with 8000 static, non-animated cubes my time spent on animations went from 1.5~1.7ms to 0.001ms. --- source/gameengine/Ketsji/KX_GameObject.cpp | 5 +++-- source/gameengine/Ketsji/KX_Scene.cpp | 16 +++++++++++++++- source/gameengine/Ketsji/KX_Scene.h | 5 +++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 3f6f4bb9099..6adaea2d6ad 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -159,6 +159,7 @@ KX_GameObject::~KX_GameObject() } if (m_actionManager) { + KX_GetActiveScene()->RemoveAnimatedObject(this); delete m_actionManager; } #ifdef WITH_PYTHON @@ -355,8 +356,8 @@ BL_ActionManager* KX_GameObject::GetActionManager() { // We only want to create an action manager if we need it if (!m_actionManager) - m_actionManager = new BL_ActionManager(this); - + { KX_GetActiveScene()->AddAnimatedObject(this); m_actionManager = new BL_ActionManager(this); + } return m_actionManager; } diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index a49c1bf4b4c..06e343cedb2 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -168,6 +168,7 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice, m_lightlist= new CListValue(); m_inactivelist = new CListValue(); m_euthanasyobjects = new CListValue(); + m_animatedlist = new CListValue(); m_logicmgr = new SCA_LogicManager(); @@ -253,6 +254,9 @@ KX_Scene::~KX_Scene() if (m_euthanasyobjects) m_euthanasyobjects->Release(); + if (m_animatedlist) + m_animatedlist->Release(); + if (m_logicmgr) delete m_logicmgr; @@ -1502,10 +1506,20 @@ void KX_Scene::LogicBeginFrame(double curtime) m_logicmgr->BeginFrame(curtime, 1.0/KX_KetsjiEngine::GetTicRate()); } +void KX_Scene::AddAnimatedObject(CValue* gameobj) +{ + m_animatedlist->Add(gameobj); +} + +void KX_Scene::RemoveAnimatedObject(CValue* gameobj) +{ + m_animatedlist->RemoveValue(gameobj); +} + void KX_Scene::UpdateAnimations(double curtime) { // Update any animations - for (int i=0; iGetCount(); ++i) + for (int i=0; iGetCount(); ++i) ((KX_GameObject*)GetObjectList()->GetValue(i))->UpdateActionManager(curtime); } diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h index da9cc12c76a..499861bce50 100644 --- a/source/gameengine/Ketsji/KX_Scene.h +++ b/source/gameengine/Ketsji/KX_Scene.h @@ -130,6 +130,7 @@ protected: CListValue* m_parentlist; // all 'root' parents CListValue* m_lightlist; CListValue* m_inactivelist; // all objects that are not in the active layer + CListValue* m_animatedlist; // all animated objects SG_QList m_sghead; // list of nodes that needs scenegraph update // the Dlist is not object that must be updated @@ -334,6 +335,10 @@ public: int NewRemoveObject(CValue* gameobj); void ReplaceMesh(CValue* gameobj, void* meshob, bool use_gfx, bool use_phys); + + void AddAnimatedObject(CValue* gameobj); + void RemoveAnimatedObject(CValue* gameobj); + /** * @section Logic stuff * Initiate an update of the logic system. -- cgit v1.2.3 From 1764f2135d3c1780c4ead12fae3eb97ac2de5a7d Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sun, 4 Sep 2011 00:15:59 +0000 Subject: Some whitespace changes --- source/blender/collada/AnimationExporter.cpp | 1694 +++++++++++++------------- source/blender/collada/AnimationImporter.cpp | 388 +++--- source/blender/collada/AnimationImporter.h | 10 +- source/blender/collada/ArmatureExporter.cpp | 2 +- source/blender/collada/ArmatureImporter.cpp | 4 +- source/blender/collada/ArmatureImporter.h | 4 +- source/blender/collada/MeshImporter.cpp | 2 +- source/blender/collada/SkinInfo.cpp | 6 +- source/blender/collada/TransformWriter.cpp | 2 +- 9 files changed, 1055 insertions(+), 1057 deletions(-) diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 8a0a39da558..4c20d1cf6c1 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -1,26 +1,26 @@ /* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed. - * - * ***** END GPL LICENSE BLOCK ***** - */ +* $Id$ +* +* ***** BEGIN GPL LICENSE BLOCK ***** +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +* +* Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed. +* +* ***** END GPL LICENSE BLOCK ***** +*/ #include "GeometryExporter.h" #include "AnimationExporter.h" @@ -30,10 +30,10 @@ template void forEachObjectInScene(Scene *sce, Functor &f) { Base *base= (Base*) sce->base.first; - + while(base) { Object *ob = base->object; - + f(ob); base= base->next; @@ -61,7 +61,7 @@ void AnimationExporter::operator() (Object *ob) bool isMatAnim = false; //Export transform animations - if(ob->adt && ob->adt->action) + if(ob->adt && ob->adt->action) { fcu = (FCurve*)ob->adt->action->curves.first; @@ -72,21 +72,21 @@ void AnimationExporter::operator() (Object *ob) for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) write_bone_animation_matrix(ob, bone); } - + while (fcu) { //for armature animations as objects if ( ob->type == OB_ARMATURE ) transformName = fcu->rna_path; else transformName = extract_transform_name( fcu->rna_path ); - + if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) || (!strcmp(transformName, "rotation_euler") && ob->rotmode == ROT_MODE_EUL)|| (!strcmp(transformName, "rotation_quaternion"))) dae_animation(ob ,fcu, transformName, false); fcu = fcu->next; } - + } //Export Lamp parameter animations @@ -94,8 +94,8 @@ void AnimationExporter::operator() (Object *ob) { fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first); while (fcu) { - transformName = extract_transform_name( fcu->rna_path ); - + transformName = extract_transform_name( fcu->rna_path ); + if ((!strcmp(transformName, "color")) || (!strcmp(transformName, "spot_size"))|| (!strcmp(transformName, "spot_blend"))|| (!strcmp(transformName, "distance")) ) dae_animation(ob , fcu, transformName, true ); @@ -108,8 +108,8 @@ void AnimationExporter::operator() (Object *ob) { fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first); while (fcu) { - transformName = extract_transform_name( fcu->rna_path ); - + transformName = extract_transform_name( fcu->rna_path ); + if ((!strcmp(transformName, "lens"))|| (!strcmp(transformName, "ortho_scale"))|| (!strcmp(transformName, "clip_end"))||(!strcmp(transformName, "clip_start"))) @@ -129,7 +129,7 @@ void AnimationExporter::operator() (Object *ob) fcu = (FCurve*)ma->adt->action->curves.first; while (fcu) { transformName = extract_transform_name( fcu->rna_path ); - + if ((!strcmp(transformName, "specular_hardness"))||(!strcmp(transformName, "specular_color")) ||(!strcmp(transformName, "diffuse_color"))||(!strcmp(transformName, "alpha"))|| (!strcmp(transformName, "ior"))) @@ -137,384 +137,384 @@ void AnimationExporter::operator() (Object *ob) fcu = fcu->next; } } - + } } - //euler sources from quternion sources - float * AnimationExporter::get_eul_source_for_quat(Object *ob ) +//euler sources from quternion sources +float * AnimationExporter::get_eul_source_for_quat(Object *ob ) +{ + FCurve *fcu = (FCurve*)ob->adt->action->curves.first; + const int keys = fcu->totvert; + float *quat = (float*)MEM_callocN(sizeof(float) * fcu->totvert * 4, "quat output source values"); + float *eul = (float*)MEM_callocN(sizeof(float) * fcu->totvert * 3, "quat output source values"); + float temp_quat[4]; + float temp_eul[3]; + while(fcu) { - FCurve *fcu = (FCurve*)ob->adt->action->curves.first; - const int keys = fcu->totvert; - float *quat = (float*)MEM_callocN(sizeof(float) * fcu->totvert * 4, "quat output source values"); - float *eul = (float*)MEM_callocN(sizeof(float) * fcu->totvert * 3, "quat output source values"); - float temp_quat[4]; - float temp_eul[3]; - while(fcu) - { - char * transformName = extract_transform_name( fcu->rna_path ); - - if( !strcmp(transformName, "rotation_quaternion") ) { - for ( int i = 0 ; i < fcu->totvert ; i++){ - *(quat + ( i * 4 ) + fcu->array_index) = fcu->bezt[i].vec[1][1]; - } - } - fcu = fcu->next; + char * transformName = extract_transform_name( fcu->rna_path ); + + if( !strcmp(transformName, "rotation_quaternion") ) { + for ( int i = 0 ; i < fcu->totvert ; i++){ + *(quat + ( i * 4 ) + fcu->array_index) = fcu->bezt[i].vec[1][1]; } + } + fcu = fcu->next; + } - for ( int i = 0 ; i < keys ; i++){ - for ( int j = 0;j<4;j++) - temp_quat[j] = quat[(i*4)+j]; + for ( int i = 0 ; i < keys ; i++){ + for ( int j = 0;j<4;j++) + temp_quat[j] = quat[(i*4)+j]; - quat_to_eul(temp_eul,temp_quat); + quat_to_eul(temp_eul,temp_quat); - for (int k = 0;k<3;k++) - eul[i*3 + k] = temp_eul[k]; - - } - MEM_freeN(quat); - return eul; + for (int k = 0;k<3;k++) + eul[i*3 + k] = temp_eul[k]; } + MEM_freeN(quat); + return eul; + +} + +//Get proper name for bones +std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu ) +{ + //hard-way to derive the bone name from rna_path. Must find more compact method + std::string rna_path = std::string(fcu->rna_path); - //Get proper name for bones - std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu ) + char* boneName = strtok((char *)rna_path.c_str(), "\""); + boneName = strtok(NULL,"\""); + + if( boneName != NULL ) + return /*id_name(ob) + "_" +*/ std::string(boneName); + else + return id_name(ob); +} + +//convert f-curves to animation curves and write +void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material * ma ) +{ + const char *axis_name = NULL; + char anim_id[200]; + + bool has_tangents = false; + bool quatRotation = false; + + if ( !strcmp(transformName, "rotation_quaternion") ) { - //hard-way to derive the bone name from rna_path. Must find more compact method - std::string rna_path = std::string(fcu->rna_path); - - char* boneName = strtok((char *)rna_path.c_str(), "\""); - boneName = strtok(NULL,"\""); - - if( boneName != NULL ) - return /*id_name(ob) + "_" +*/ std::string(boneName); - else - return id_name(ob); + fprintf(stderr, "quaternion rotation curves are not supported. rotation curve will not be exported\n"); + quatRotation = true; + return; } - //convert f-curves to animation curves and write - void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material * ma ) + //axis names for colors + else if ( !strcmp(transformName, "color")||!strcmp(transformName, "specular_color")||!strcmp(transformName, "diffuse_color")|| + (!strcmp(transformName, "alpha"))) { - const char *axis_name = NULL; - char anim_id[200]; - - bool has_tangents = false; - bool quatRotation = false; - - if ( !strcmp(transformName, "rotation_quaternion") ) - { - fprintf(stderr, "quaternion rotation curves are not supported. rotation curve will not be exported\n"); - quatRotation = true; - return; - } - - //axis names for colors - else if ( !strcmp(transformName, "color")||!strcmp(transformName, "specular_color")||!strcmp(transformName, "diffuse_color")|| - (!strcmp(transformName, "alpha"))) - { - const char *axis_names[] = {"R", "G", "B"}; - if (fcu->array_index < 3) + const char *axis_names[] = {"R", "G", "B"}; + if (fcu->array_index < 3) axis_name = axis_names[fcu->array_index]; - } + } - //axis names for transforms - else if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) || - (!strcmp(transformName, "rotation_euler"))||(!strcmp(transformName, "rotation_quaternion"))) - { - const char *axis_names[] = {"X", "Y", "Z"}; - if (fcu->array_index < 3) + //axis names for transforms + else if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) || + (!strcmp(transformName, "rotation_euler"))||(!strcmp(transformName, "rotation_quaternion"))) + { + const char *axis_names[] = {"X", "Y", "Z"}; + if (fcu->array_index < 3) axis_name = axis_names[fcu->array_index]; - } + } - //no axis name. single parameter. - else{ - axis_name = ""; - } - - std::string ob_name = std::string("null"); - - //Create anim Id - if (ob->type == OB_ARMATURE) - { - ob_name = getObjectBoneName( ob , fcu); - BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s.%s", (char*)translate_id(ob_name).c_str(), - transformName, axis_name); - } - else - { - if (ma) - ob_name = id_name(ob) + "_material"; - else - ob_name = id_name(ob); - BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(), - fcu->rna_path, axis_name); - } - - openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING); + //no axis name. single parameter. + else{ + axis_name = ""; + } - // create input source - std::string input_id = create_source_from_fcurve(COLLADASW::InputSemantic::INPUT, fcu, anim_id, axis_name); + std::string ob_name = std::string("null"); - // create output source - std::string output_id ; - - //quat rotations are skipped for now, because of complications with determining axis. - if(quatRotation) - { - float * eul = get_eul_source_for_quat(ob); - float * eul_axis = (float*)MEM_callocN(sizeof(float) * fcu->totvert, "quat output source values"); - for ( int i = 0 ; i< fcu->totvert ; i++) - eul_axis[i] = eul[i*3 + fcu->array_index]; - output_id= create_source_from_array(COLLADASW::InputSemantic::OUTPUT, eul_axis , fcu->totvert, quatRotation, anim_id, axis_name); - MEM_freeN(eul); - MEM_freeN(eul_axis); - } - else - { - output_id= create_source_from_fcurve(COLLADASW::InputSemantic::OUTPUT, fcu, anim_id, axis_name); - } - // create interpolations source - std::string interpolation_id = create_interpolation_source(fcu, anim_id, axis_name, &has_tangents); - - // handle tangents (if required) - std::string intangent_id; - std::string outtangent_id; - - if (has_tangents) { - // create in_tangent source - intangent_id = create_source_from_fcurve(COLLADASW::InputSemantic::IN_TANGENT, fcu, anim_id, axis_name); - - // create out_tangent source - outtangent_id = create_source_from_fcurve(COLLADASW::InputSemantic::OUT_TANGENT, fcu, anim_id, axis_name); - } + //Create anim Id + if (ob->type == OB_ARMATURE) + { + ob_name = getObjectBoneName( ob , fcu); + BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s.%s", (char*)translate_id(ob_name).c_str(), + transformName, axis_name); + } + else + { + if (ma) + ob_name = id_name(ob) + "_material"; + else + ob_name = id_name(ob); + BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(), + fcu->rna_path, axis_name); + } - std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX; - COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id); - std::string empty; - sampler.addInput(COLLADASW::InputSemantic::INPUT, COLLADABU::URI(empty, input_id)); - sampler.addInput(COLLADASW::InputSemantic::OUTPUT, COLLADABU::URI(empty, output_id)); + openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING); - // this input is required - sampler.addInput(COLLADASW::InputSemantic::INTERPOLATION, COLLADABU::URI(empty, interpolation_id)); + // create input source + std::string input_id = create_source_from_fcurve(COLLADASW::InputSemantic::INPUT, fcu, anim_id, axis_name); - if (has_tangents) { - sampler.addInput(COLLADASW::InputSemantic::IN_TANGENT, COLLADABU::URI(empty, intangent_id)); - sampler.addInput(COLLADASW::InputSemantic::OUT_TANGENT, COLLADABU::URI(empty, outtangent_id)); - } + // create output source + std::string output_id ; - addSampler(sampler); + //quat rotations are skipped for now, because of complications with determining axis. + if(quatRotation) + { + float * eul = get_eul_source_for_quat(ob); + float * eul_axis = (float*)MEM_callocN(sizeof(float) * fcu->totvert, "quat output source values"); + for ( int i = 0 ; i< fcu->totvert ; i++) + eul_axis[i] = eul[i*3 + fcu->array_index]; + output_id= create_source_from_array(COLLADASW::InputSemantic::OUTPUT, eul_axis , fcu->totvert, quatRotation, anim_id, axis_name); + MEM_freeN(eul); + MEM_freeN(eul_axis); + } + else + { + output_id= create_source_from_fcurve(COLLADASW::InputSemantic::OUTPUT, fcu, anim_id, axis_name); + } + // create interpolations source + std::string interpolation_id = create_interpolation_source(fcu, anim_id, axis_name, &has_tangents); - std::string target ; + // handle tangents (if required) + std::string intangent_id; + std::string outtangent_id; - if ( !is_param ) - target = translate_id(ob_name) - + "/" + get_transform_sid(fcu->rna_path, -1, axis_name, true); - else - { - if ( ob->type == OB_LAMP ) - target = get_light_id(ob) - + "/" + get_light_param_sid(fcu->rna_path, -1, axis_name, true); + if (has_tangents) { + // create in_tangent source + intangent_id = create_source_from_fcurve(COLLADASW::InputSemantic::IN_TANGENT, fcu, anim_id, axis_name); - if ( ob->type == OB_CAMERA ) - target = get_camera_id(ob) - + "/" + get_camera_param_sid(fcu->rna_path, -1, axis_name, true); + // create out_tangent source + outtangent_id = create_source_from_fcurve(COLLADASW::InputSemantic::OUT_TANGENT, fcu, anim_id, axis_name); + } - if( ma ) - target = translate_id(id_name(ma)) + "-effect" - +"/common/" /*profile common is only supported */ + get_transform_sid(fcu->rna_path, -1, axis_name, true); - } - addChannel(COLLADABU::URI(empty, sampler_id), target); + std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX; + COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id); + std::string empty; + sampler.addInput(COLLADASW::InputSemantic::INPUT, COLLADABU::URI(empty, input_id)); + sampler.addInput(COLLADASW::InputSemantic::OUTPUT, COLLADABU::URI(empty, output_id)); + + // this input is required + sampler.addInput(COLLADASW::InputSemantic::INTERPOLATION, COLLADABU::URI(empty, interpolation_id)); - closeAnimation(); + if (has_tangents) { + sampler.addInput(COLLADASW::InputSemantic::IN_TANGENT, COLLADABU::URI(empty, intangent_id)); + sampler.addInput(COLLADASW::InputSemantic::OUT_TANGENT, COLLADABU::URI(empty, outtangent_id)); } + addSampler(sampler); + + std::string target ; - - //write bone animations in transform matrix sources - void AnimationExporter::write_bone_animation_matrix(Object *ob_arm, Bone *bone) + if ( !is_param ) + target = translate_id(ob_name) + + "/" + get_transform_sid(fcu->rna_path, -1, axis_name, true); + else { - if (!ob_arm->adt) - return; - - //This will only export animations of bones in deform group. - /*if(!is_bone_deform_group(bone)) - return;*/ - - sample_and_write_bone_animation_matrix(ob_arm, bone); - - for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) - write_bone_animation_matrix(ob_arm, child); + if ( ob->type == OB_LAMP ) + target = get_light_id(ob) + + "/" + get_light_param_sid(fcu->rna_path, -1, axis_name, true); + + if ( ob->type == OB_CAMERA ) + target = get_camera_id(ob) + + "/" + get_camera_param_sid(fcu->rna_path, -1, axis_name, true); + + if( ma ) + target = translate_id(id_name(ma)) + "-effect" + +"/common/" /*profile common is only supported */ + get_transform_sid(fcu->rna_path, -1, axis_name, true); } + addChannel(COLLADABU::URI(empty, sampler_id), target); - bool AnimationExporter::is_bone_deform_group(Bone * bone) + closeAnimation(); +} + + + +//write bone animations in transform matrix sources +void AnimationExporter::write_bone_animation_matrix(Object *ob_arm, Bone *bone) +{ + if (!ob_arm->adt) + return; + + //This will only export animations of bones in deform group. + /*if(!is_bone_deform_group(bone)) + return;*/ + + sample_and_write_bone_animation_matrix(ob_arm, bone); + + for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) + write_bone_animation_matrix(ob_arm, child); +} + +bool AnimationExporter::is_bone_deform_group(Bone * bone) +{ + bool is_def; + //Check if current bone is deform + if((bone->flag & BONE_NO_DEFORM) == 0 ) return true; + //Check child bones + else { - bool is_def; - //Check if current bone is deform - if((bone->flag & BONE_NO_DEFORM) == 0 ) return true; - //Check child bones - else - { - for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next){ - //loop through all the children until deform bone is found, and then return - is_def = is_bone_deform_group(child); - if (is_def) return true; - } + for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next){ + //loop through all the children until deform bone is found, and then return + is_def = is_bone_deform_group(child); + if (is_def) return true; } - //no deform bone found in children also - return false; } + //no deform bone found in children also + return false; +} - void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone) - { - bArmature *arm = (bArmature*)ob_arm->data; - int flag = arm->flag; - std::vector fra; - //char prefix[256]; - - FCurve* fcu = (FCurve*)ob_arm->adt->action->curves.first; - while(fcu) - { - std::string bone_name = getObjectBoneName(ob_arm,fcu); - int val = BLI_strcasecmp((char*)bone_name.c_str(),bone->name); - if(val==0) break; - fcu = fcu->next; - } +void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone) +{ + bArmature *arm = (bArmature*)ob_arm->data; + int flag = arm->flag; + std::vector fra; + //char prefix[256]; - if(!(fcu)) return; - bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); - if (!pchan) - return; - - find_frames(ob_arm, fra); + FCurve* fcu = (FCurve*)ob_arm->adt->action->curves.first; + while(fcu) + { + std::string bone_name = getObjectBoneName(ob_arm,fcu); + int val = BLI_strcasecmp((char*)bone_name.c_str(),bone->name); + if(val==0) break; + fcu = fcu->next; + } - if (flag & ARM_RESTPOS) { - arm->flag &= ~ARM_RESTPOS; - where_is_pose(scene, ob_arm); - } + if(!(fcu)) return; + bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); + if (!pchan) + return; - if (fra.size()) { - dae_baked_animation(fra ,ob_arm, bone ); - } + find_frames(ob_arm, fra); - if (flag & ARM_RESTPOS) - arm->flag = flag; + if (flag & ARM_RESTPOS) { + arm->flag &= ~ARM_RESTPOS; where_is_pose(scene, ob_arm); } - void AnimationExporter::dae_baked_animation(std::vector &fra, Object *ob_arm , Bone *bone) - { - std::string ob_name = id_name(ob_arm); - std::string bone_name = bone->name; - char anim_id[200]; - - if (!fra.size()) - return; + if (fra.size()) { + dae_baked_animation(fra ,ob_arm, bone ); + } - BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(), - (char*)translate_id(bone_name).c_str(), "pose_matrix"); + if (flag & ARM_RESTPOS) + arm->flag = flag; + where_is_pose(scene, ob_arm); +} - openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING); +void AnimationExporter::dae_baked_animation(std::vector &fra, Object *ob_arm , Bone *bone) +{ + std::string ob_name = id_name(ob_arm); + std::string bone_name = bone->name; + char anim_id[200]; - // create input source - std::string input_id = create_source_from_vector(COLLADASW::InputSemantic::INPUT, fra, false, anim_id, ""); + if (!fra.size()) + return; - // create output source - std::string output_id; - output_id = create_4x4_source( fra, ob_arm , bone , anim_id); + BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(), + (char*)translate_id(bone_name).c_str(), "pose_matrix"); - // create interpolations source - std::string interpolation_id = fake_interpolation_source(fra.size(), anim_id, ""); + openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING); - std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX; - COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id); - std::string empty; - sampler.addInput(COLLADASW::InputSemantic::INPUT, COLLADABU::URI(empty, input_id)); - sampler.addInput(COLLADASW::InputSemantic::OUTPUT, COLLADABU::URI(empty, output_id)); + // create input source + std::string input_id = create_source_from_vector(COLLADASW::InputSemantic::INPUT, fra, false, anim_id, ""); - // TODO create in/out tangents source + // create output source + std::string output_id; + output_id = create_4x4_source( fra, ob_arm , bone , anim_id); - // this input is required - sampler.addInput(COLLADASW::InputSemantic::INTERPOLATION, COLLADABU::URI(empty, interpolation_id)); + // create interpolations source + std::string interpolation_id = fake_interpolation_source(fra.size(), anim_id, ""); - addSampler(sampler); + std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX; + COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id); + std::string empty; + sampler.addInput(COLLADASW::InputSemantic::INPUT, COLLADABU::URI(empty, input_id)); + sampler.addInput(COLLADASW::InputSemantic::OUTPUT, COLLADABU::URI(empty, output_id)); - std::string target = translate_id(bone_name) + "/transform"; - addChannel(COLLADABU::URI(empty, sampler_id), target); + // TODO create in/out tangents source - closeAnimation(); - } + // this input is required + sampler.addInput(COLLADASW::InputSemantic::INTERPOLATION, COLLADABU::URI(empty, interpolation_id)); - // dae_bone_animation -> add_bone_animation - // (blend this into dae_bone_animation) - void AnimationExporter::dae_bone_animation(std::vector &fra, float *values, int tm_type, int axis, std::string ob_name, std::string bone_name) - { - const char *axis_names[] = {"X", "Y", "Z"}; - const char *axis_name = NULL; - char anim_id[200]; - bool is_rot = tm_type == 0; - - if (!fra.size()) - return; + addSampler(sampler); - char rna_path[200]; - BLI_snprintf(rna_path, sizeof(rna_path), "pose.bones[\"%s\"].%s", bone_name.c_str(), - tm_type == 0 ? "rotation_quaternion" : (tm_type == 1 ? "scale" : "location")); + std::string target = translate_id(bone_name) + "/transform"; + addChannel(COLLADABU::URI(empty, sampler_id), target); - if (axis > -1) - axis_name = axis_names[axis]; - - std::string transform_sid = get_transform_sid(NULL, tm_type, axis_name, false); - - BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(), - (char*)translate_id(bone_name).c_str(), (char*)transform_sid.c_str()); + closeAnimation(); +} - openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING); +// dae_bone_animation -> add_bone_animation +// (blend this into dae_bone_animation) +void AnimationExporter::dae_bone_animation(std::vector &fra, float *values, int tm_type, int axis, std::string ob_name, std::string bone_name) +{ + const char *axis_names[] = {"X", "Y", "Z"}; + const char *axis_name = NULL; + char anim_id[200]; + bool is_rot = tm_type == 0; - // create input source - std::string input_id = create_source_from_vector(COLLADASW::InputSemantic::INPUT, fra, is_rot, anim_id, axis_name); + if (!fra.size()) + return; - // create output source - std::string output_id; - if (axis == -1) - output_id = create_xyz_source(values, fra.size(), anim_id); - else - output_id = create_source_from_array(COLLADASW::InputSemantic::OUTPUT, values, fra.size(), is_rot, anim_id, axis_name); + char rna_path[200]; + BLI_snprintf(rna_path, sizeof(rna_path), "pose.bones[\"%s\"].%s", bone_name.c_str(), + tm_type == 0 ? "rotation_quaternion" : (tm_type == 1 ? "scale" : "location")); - // create interpolations source - std::string interpolation_id = fake_interpolation_source(fra.size(), anim_id, axis_name); + if (axis > -1) + axis_name = axis_names[axis]; - std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX; - COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id); - std::string empty; - sampler.addInput(COLLADASW::InputSemantic::INPUT, COLLADABU::URI(empty, input_id)); - sampler.addInput(COLLADASW::InputSemantic::OUTPUT, COLLADABU::URI(empty, output_id)); + std::string transform_sid = get_transform_sid(NULL, tm_type, axis_name, false); - // TODO create in/out tangents source + BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(), + (char*)translate_id(bone_name).c_str(), (char*)transform_sid.c_str()); - // this input is required - sampler.addInput(COLLADASW::InputSemantic::INTERPOLATION, COLLADABU::URI(empty, interpolation_id)); + openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING); - addSampler(sampler); + // create input source + std::string input_id = create_source_from_vector(COLLADASW::InputSemantic::INPUT, fra, is_rot, anim_id, axis_name); - std::string target = translate_id(ob_name + "_" + bone_name) + "/" + transform_sid; - addChannel(COLLADABU::URI(empty, sampler_id), target); + // create output source + std::string output_id; + if (axis == -1) + output_id = create_xyz_source(values, fra.size(), anim_id); + else + output_id = create_source_from_array(COLLADASW::InputSemantic::OUTPUT, values, fra.size(), is_rot, anim_id, axis_name); - closeAnimation(); - } + // create interpolations source + std::string interpolation_id = fake_interpolation_source(fra.size(), anim_id, axis_name); - float AnimationExporter::convert_time(float frame) - { - return FRA2TIME(frame); - } + std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX; + COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id); + std::string empty; + sampler.addInput(COLLADASW::InputSemantic::INPUT, COLLADABU::URI(empty, input_id)); + sampler.addInput(COLLADASW::InputSemantic::OUTPUT, COLLADABU::URI(empty, output_id)); - float AnimationExporter::convert_angle(float angle) - { - return COLLADABU::Math::Utils::radToDegF(angle); - } + // TODO create in/out tangents source - std::string AnimationExporter::get_semantic_suffix(COLLADASW::InputSemantic::Semantics semantic) - { - switch(semantic) { + // this input is required + sampler.addInput(COLLADASW::InputSemantic::INTERPOLATION, COLLADABU::URI(empty, interpolation_id)); + + addSampler(sampler); + + std::string target = translate_id(ob_name + "_" + bone_name) + "/" + transform_sid; + addChannel(COLLADABU::URI(empty, sampler_id), target); + + closeAnimation(); +} + +float AnimationExporter::convert_time(float frame) +{ + return FRA2TIME(frame); +} + +float AnimationExporter::convert_angle(float angle) +{ + return COLLADABU::Math::Utils::radToDegF(angle); +} + +std::string AnimationExporter::get_semantic_suffix(COLLADASW::InputSemantic::Semantics semantic) +{ + switch(semantic) { case COLLADASW::InputSemantic::INPUT: return INPUT_SOURCE_ID_SUFFIX; case COLLADASW::InputSemantic::OUTPUT: @@ -527,14 +527,14 @@ void AnimationExporter::operator() (Object *ob) return OUTTANGENT_SOURCE_ID_SUFFIX; default: break; - } - return ""; } + return ""; +} - void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param, - COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis, bool transform) - { - switch(semantic) { +void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param, + COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis, bool transform) +{ + switch(semantic) { case COLLADASW::InputSemantic::INPUT: param.push_back("TIME"); break; @@ -547,14 +547,14 @@ void AnimationExporter::operator() (Object *ob) param.push_back(axis); } else - if ( transform ) - { - param.push_back("TRANSFORM"); - }else{ //assumes if axis isn't specified all axises are added - param.push_back("X"); - param.push_back("Y"); - param.push_back("Z"); - } + if ( transform ) + { + param.push_back("TRANSFORM"); + }else{ //assumes if axis isn't specified all axises are added + param.push_back("X"); + param.push_back("Y"); + param.push_back("Z"); + } } break; case COLLADASW::InputSemantic::IN_TANGENT: @@ -564,12 +564,12 @@ void AnimationExporter::operator() (Object *ob) break; default: break; - } } +} - void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool rotation, float *values, int *length) - { - switch (semantic) { +void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool rotation, float *values, int *length) +{ + switch (semantic) { case COLLADASW::InputSemantic::INPUT: *length = 1; values[0] = convert_time(bezt->vec[1][0]); @@ -583,9 +583,9 @@ void AnimationExporter::operator() (Object *ob) values[0] = bezt->vec[1][1]; } break; - + case COLLADASW::InputSemantic::IN_TANGENT: - *length = 2; + *length = 2; values[0] = convert_time(bezt->vec[0][0]); if (bezt->ipo != BEZT_IPO_BEZ) { // We're in a mixed interpolation scenario, set zero as it's irrelevant but value might contain unused data @@ -598,7 +598,7 @@ void AnimationExporter::operator() (Object *ob) values[1] = bezt->vec[0][1]; } break; - + case COLLADASW::InputSemantic::OUT_TANGENT: *length = 2; values[0] = convert_time(bezt->vec[2][0]); @@ -617,283 +617,283 @@ void AnimationExporter::operator() (Object *ob) default: *length = 0; break; - } } +} - std::string AnimationExporter::create_source_from_fcurve(COLLADASW::InputSemantic::Semantics semantic, FCurve *fcu, const std::string& anim_id, const char *axis_name) - { - std::string source_id = anim_id + get_semantic_suffix(semantic); - - //bool is_rotation = !strcmp(fcu->rna_path, "rotation"); - bool is_angle = false; - - if (strstr(fcu->rna_path, "rotation")) is_angle = true; - - COLLADASW::FloatSourceF source(mSW); - source.setId(source_id); - source.setArrayId(source_id + ARRAY_ID_SUFFIX); - source.setAccessorCount(fcu->totvert); - - switch (semantic) { +std::string AnimationExporter::create_source_from_fcurve(COLLADASW::InputSemantic::Semantics semantic, FCurve *fcu, const std::string& anim_id, const char *axis_name) +{ + std::string source_id = anim_id + get_semantic_suffix(semantic); + + //bool is_rotation = !strcmp(fcu->rna_path, "rotation"); + bool is_angle = false; + + if (strstr(fcu->rna_path, "rotation")) is_angle = true; + + COLLADASW::FloatSourceF source(mSW); + source.setId(source_id); + source.setArrayId(source_id + ARRAY_ID_SUFFIX); + source.setAccessorCount(fcu->totvert); + + switch (semantic) { case COLLADASW::InputSemantic::INPUT: case COLLADASW::InputSemantic::OUTPUT: - source.setAccessorStride(1); + source.setAccessorStride(1); break; case COLLADASW::InputSemantic::IN_TANGENT: case COLLADASW::InputSemantic::OUT_TANGENT: - source.setAccessorStride(2); + source.setAccessorStride(2); break; - } - - - COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - add_source_parameters(param, semantic, is_angle, axis_name, false); + } - source.prepareToAppendValues(); - for (unsigned int i = 0; i < fcu->totvert; i++) { - float values[3]; // be careful! - int length = 0; - get_source_values(&fcu->bezt[i], semantic, is_angle, values, &length); - for (int j = 0; j < length; j++) - source.appendValues(values[j]); - } + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + add_source_parameters(param, semantic, is_angle, axis_name, false); - source.finish(); + source.prepareToAppendValues(); - return source_id; + for (unsigned int i = 0; i < fcu->totvert; i++) { + float values[3]; // be careful! + int length = 0; + get_source_values(&fcu->bezt[i], semantic, is_angle, values, &length); + for (int j = 0; j < length; j++) + source.appendValues(values[j]); } - //Currently called only to get OUTPUT source values ( if rotation and hence the axis is also specified ) - std::string AnimationExporter::create_source_from_array(COLLADASW::InputSemantic::Semantics semantic, float *v, int tot, bool is_rot, const std::string& anim_id, const char *axis_name) - { - std::string source_id = anim_id + get_semantic_suffix(semantic); - - COLLADASW::FloatSourceF source(mSW); - source.setId(source_id); - source.setArrayId(source_id + ARRAY_ID_SUFFIX); - source.setAccessorCount(tot); - source.setAccessorStride(1); - - COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - add_source_parameters(param, semantic, is_rot, axis_name, false); - - source.prepareToAppendValues(); - - for (int i = 0; i < tot; i++) { - float val = v[i]; - ////if (semantic == COLLADASW::InputSemantic::INPUT) - // val = convert_time(val); - //else - if (is_rot) - val *= 180.0f / M_PI; - source.appendValues(val); - } + source.finish(); - source.finish(); + return source_id; +} - return source_id; +//Currently called only to get OUTPUT source values ( if rotation and hence the axis is also specified ) +std::string AnimationExporter::create_source_from_array(COLLADASW::InputSemantic::Semantics semantic, float *v, int tot, bool is_rot, const std::string& anim_id, const char *axis_name) +{ + std::string source_id = anim_id + get_semantic_suffix(semantic); + + COLLADASW::FloatSourceF source(mSW); + source.setId(source_id); + source.setArrayId(source_id + ARRAY_ID_SUFFIX); + source.setAccessorCount(tot); + source.setAccessorStride(1); + + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + add_source_parameters(param, semantic, is_rot, axis_name, false); + + source.prepareToAppendValues(); + + for (int i = 0; i < tot; i++) { + float val = v[i]; + ////if (semantic == COLLADASW::InputSemantic::INPUT) + // val = convert_time(val); + //else + if (is_rot) + val *= 180.0f / M_PI; + source.appendValues(val); } -// only used for sources with INPUT semantic - std::string AnimationExporter::create_source_from_vector(COLLADASW::InputSemantic::Semantics semantic, std::vector &fra, bool is_rot, const std::string& anim_id, const char *axis_name) - { - std::string source_id = anim_id + get_semantic_suffix(semantic); - - COLLADASW::FloatSourceF source(mSW); - source.setId(source_id); - source.setArrayId(source_id + ARRAY_ID_SUFFIX); - source.setAccessorCount(fra.size()); - source.setAccessorStride(1); - - COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - add_source_parameters(param, semantic, is_rot, axis_name, false); - - source.prepareToAppendValues(); - - std::vector::iterator it; - for (it = fra.begin(); it != fra.end(); it++) { - float val = *it; - //if (semantic == COLLADASW::InputSemantic::INPUT) - val = convert_time(val); - /*else if (is_rot) - val = convert_angle(val);*/ - source.appendValues(val); - } - source.finish(); + source.finish(); - return source_id; + return source_id; +} +// only used for sources with INPUT semantic +std::string AnimationExporter::create_source_from_vector(COLLADASW::InputSemantic::Semantics semantic, std::vector &fra, bool is_rot, const std::string& anim_id, const char *axis_name) +{ + std::string source_id = anim_id + get_semantic_suffix(semantic); + + COLLADASW::FloatSourceF source(mSW); + source.setId(source_id); + source.setArrayId(source_id + ARRAY_ID_SUFFIX); + source.setAccessorCount(fra.size()); + source.setAccessorStride(1); + + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + add_source_parameters(param, semantic, is_rot, axis_name, false); + + source.prepareToAppendValues(); + + std::vector::iterator it; + for (it = fra.begin(); it != fra.end(); it++) { + float val = *it; + //if (semantic == COLLADASW::InputSemantic::INPUT) + val = convert_time(val); + /*else if (is_rot) + val = convert_angle(val);*/ + source.appendValues(val); } - std::string AnimationExporter::create_4x4_source(std::vector &frames , Object * ob_arm, Bone *bone , const std::string& anim_id) - { - COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT; - std::string source_id = anim_id + get_semantic_suffix(semantic); + source.finish(); - COLLADASW::Float4x4Source source(mSW); - source.setId(source_id); - source.setArrayId(source_id + ARRAY_ID_SUFFIX); - source.setAccessorCount(frames.size()); - source.setAccessorStride(16); - - COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - add_source_parameters(param, semantic, false, NULL, true); + return source_id; +} - source.prepareToAppendValues(); - - bPoseChannel *parchan = NULL; - bPoseChannel *pchan = NULL; - bPose *pose = ob_arm->pose; +std::string AnimationExporter::create_4x4_source(std::vector &frames , Object * ob_arm, Bone *bone , const std::string& anim_id) +{ + COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT; + std::string source_id = anim_id + get_semantic_suffix(semantic); - pchan = get_pose_channel(pose, bone->name); + COLLADASW::Float4x4Source source(mSW); + source.setId(source_id); + source.setArrayId(source_id + ARRAY_ID_SUFFIX); + source.setAccessorCount(frames.size()); + source.setAccessorStride(16); - if (!pchan) - return ""; + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + add_source_parameters(param, semantic, false, NULL, true); - parchan = pchan->parent; + source.prepareToAppendValues(); - enable_fcurves(ob_arm->adt->action, bone->name); + bPoseChannel *parchan = NULL; + bPoseChannel *pchan = NULL; + bPose *pose = ob_arm->pose; - std::vector::iterator it; - int j = 0; - for (it = frames.begin(); it != frames.end(); it++) { - float mat[4][4], ipar[4][4]; + pchan = get_pose_channel(pose, bone->name); - float ctime = bsystem_time(scene, ob_arm, *it, 0.0f); + if (!pchan) + return ""; - BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); - where_is_pose_bone(scene, ob_arm, pchan, ctime, 1); + parchan = pchan->parent; - // compute bone local mat - if (bone->parent) { - invert_m4_m4(ipar, parchan->pose_mat); - mul_m4_m4m4(mat, pchan->pose_mat, ipar); - } - else - copy_m4_m4(mat, pchan->pose_mat); - UnitConverter converter; + enable_fcurves(ob_arm->adt->action, bone->name); - float outmat[4][4]; - converter.mat4_to_dae(outmat,mat); + std::vector::iterator it; + int j = 0; + for (it = frames.begin(); it != frames.end(); it++) { + float mat[4][4], ipar[4][4]; + float ctime = bsystem_time(scene, ob_arm, *it, 0.0f); - source.appendValues(outmat); - + BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); + where_is_pose_bone(scene, ob_arm, pchan, ctime, 1); - j++; + // compute bone local mat + if (bone->parent) { + invert_m4_m4(ipar, parchan->pose_mat); + mul_m4_m4m4(mat, pchan->pose_mat, ipar); } + else + copy_m4_m4(mat, pchan->pose_mat); + UnitConverter converter; - enable_fcurves(ob_arm->adt->action, NULL); + float outmat[4][4]; + converter.mat4_to_dae(outmat,mat); - source.finish(); - return source_id; - } - // only used for sources with OUTPUT semantic ( locations and scale) - std::string AnimationExporter::create_xyz_source(float *v, int tot, const std::string& anim_id) - { - COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT; - std::string source_id = anim_id + get_semantic_suffix(semantic); - - COLLADASW::FloatSourceF source(mSW); - source.setId(source_id); - source.setArrayId(source_id + ARRAY_ID_SUFFIX); - source.setAccessorCount(tot); - source.setAccessorStride(3); - - COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - add_source_parameters(param, semantic, false, NULL, false); - - source.prepareToAppendValues(); - - for (int i = 0; i < tot; i++) { - source.appendValues(*v, *(v + 1), *(v + 2)); - v += 3; - } + source.appendValues(outmat); - source.finish(); - return source_id; + j++; } - std::string AnimationExporter::create_interpolation_source(FCurve *fcu, const std::string& anim_id, const char *axis_name, bool *has_tangents) - { - std::string source_id = anim_id + get_semantic_suffix(COLLADASW::InputSemantic::INTERPOLATION); + enable_fcurves(ob_arm->adt->action, NULL); - COLLADASW::NameSource source(mSW); - source.setId(source_id); - source.setArrayId(source_id + ARRAY_ID_SUFFIX); - source.setAccessorCount(fcu->totvert); - source.setAccessorStride(1); - - COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - param.push_back("INTERPOLATION"); + source.finish(); - source.prepareToAppendValues(); + return source_id; +} +// only used for sources with OUTPUT semantic ( locations and scale) +std::string AnimationExporter::create_xyz_source(float *v, int tot, const std::string& anim_id) +{ + COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT; + std::string source_id = anim_id + get_semantic_suffix(semantic); - *has_tangents = false; + COLLADASW::FloatSourceF source(mSW); + source.setId(source_id); + source.setArrayId(source_id + ARRAY_ID_SUFFIX); + source.setAccessorCount(tot); + source.setAccessorStride(3); - for (unsigned int i = 0; i < fcu->totvert; i++) { - if (fcu->bezt[i].ipo==BEZT_IPO_BEZ) { - source.appendValues(BEZIER_NAME); - *has_tangents = true; - } else if (fcu->bezt[i].ipo==BEZT_IPO_CONST) { - source.appendValues(STEP_NAME); - } else { // BEZT_IPO_LIN - source.appendValues(LINEAR_NAME); - } - } - // unsupported? -- HERMITE, CARDINAL, BSPLINE, NURBS + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + add_source_parameters(param, semantic, false, NULL, false); - source.finish(); + source.prepareToAppendValues(); - return source_id; + for (int i = 0; i < tot; i++) { + source.appendValues(*v, *(v + 1), *(v + 2)); + v += 3; } - std::string AnimationExporter::fake_interpolation_source(int tot, const std::string& anim_id, const char *axis_name) - { - std::string source_id = anim_id + get_semantic_suffix(COLLADASW::InputSemantic::INTERPOLATION); + source.finish(); + + return source_id; +} + +std::string AnimationExporter::create_interpolation_source(FCurve *fcu, const std::string& anim_id, const char *axis_name, bool *has_tangents) +{ + std::string source_id = anim_id + get_semantic_suffix(COLLADASW::InputSemantic::INTERPOLATION); + + COLLADASW::NameSource source(mSW); + source.setId(source_id); + source.setArrayId(source_id + ARRAY_ID_SUFFIX); + source.setAccessorCount(fcu->totvert); + source.setAccessorStride(1); + + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + param.push_back("INTERPOLATION"); - COLLADASW::NameSource source(mSW); - source.setId(source_id); - source.setArrayId(source_id + ARRAY_ID_SUFFIX); - source.setAccessorCount(tot); - source.setAccessorStride(1); - - COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - param.push_back("INTERPOLATION"); + source.prepareToAppendValues(); - source.prepareToAppendValues(); + *has_tangents = false; - for (int i = 0; i < tot; i++) { + for (unsigned int i = 0; i < fcu->totvert; i++) { + if (fcu->bezt[i].ipo==BEZT_IPO_BEZ) { + source.appendValues(BEZIER_NAME); + *has_tangents = true; + } else if (fcu->bezt[i].ipo==BEZT_IPO_CONST) { + source.appendValues(STEP_NAME); + } else { // BEZT_IPO_LIN source.appendValues(LINEAR_NAME); } + } + // unsupported? -- HERMITE, CARDINAL, BSPLINE, NURBS + + source.finish(); + + return source_id; +} + +std::string AnimationExporter::fake_interpolation_source(int tot, const std::string& anim_id, const char *axis_name) +{ + std::string source_id = anim_id + get_semantic_suffix(COLLADASW::InputSemantic::INTERPOLATION); + + COLLADASW::NameSource source(mSW); + source.setId(source_id); + source.setArrayId(source_id + ARRAY_ID_SUFFIX); + source.setAccessorCount(tot); + source.setAccessorStride(1); + + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + param.push_back("INTERPOLATION"); - source.finish(); + source.prepareToAppendValues(); - return source_id; + for (int i = 0; i < tot; i++) { + source.appendValues(LINEAR_NAME); } - std::string AnimationExporter::get_light_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) - { - std::string tm_name; - // when given rna_path, determine tm_type from it - if (rna_path) { - char *name = extract_transform_name(rna_path); - - if (!strcmp(name, "color")) - tm_type = 1; - else if (!strcmp(name, "spot_size")) - tm_type = 2; - else if (!strcmp(name, "spot_blend")) - tm_type = 3; - else if (!strcmp(name, "distance")) - tm_type = 4; - else - tm_type = -1; - } + source.finish(); - switch (tm_type) { + return source_id; +} + +std::string AnimationExporter::get_light_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) +{ + std::string tm_name; + // when given rna_path, determine tm_type from it + if (rna_path) { + char *name = extract_transform_name(rna_path); + + if (!strcmp(name, "color")) + tm_type = 1; + else if (!strcmp(name, "spot_size")) + tm_type = 2; + else if (!strcmp(name, "spot_blend")) + tm_type = 3; + else if (!strcmp(name, "distance")) + tm_type = 4; + else + tm_type = -1; + } + + switch (tm_type) { case 1: tm_name = "color"; break; @@ -906,43 +906,43 @@ void AnimationExporter::operator() (Object *ob) case 4: tm_name = "blender/blender_dist"; break; - + default: tm_name = ""; break; - } - - if (tm_name.size()) { - if (axis_name != "") - return tm_name + "." + std::string(axis_name); - else - return tm_name; - } + } - return std::string(""); + if (tm_name.size()) { + if (axis_name != "") + return tm_name + "." + std::string(axis_name); + else + return tm_name; } - - std::string AnimationExporter::get_camera_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) - { - std::string tm_name; - // when given rna_path, determine tm_type from it - if (rna_path) { - char *name = extract_transform_name(rna_path); - - if (!strcmp(name, "lens")) - tm_type = 0; - else if (!strcmp(name, "ortho_scale")) - tm_type = 1; - else if (!strcmp(name, "clip_end")) - tm_type = 2; - else if (!strcmp(name, "clip_start")) - tm_type = 3; - - else - tm_type = -1; - } - switch (tm_type) { + return std::string(""); +} + +std::string AnimationExporter::get_camera_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) +{ + std::string tm_name; + // when given rna_path, determine tm_type from it + if (rna_path) { + char *name = extract_transform_name(rna_path); + + if (!strcmp(name, "lens")) + tm_type = 0; + else if (!strcmp(name, "ortho_scale")) + tm_type = 1; + else if (!strcmp(name, "clip_end")) + tm_type = 2; + else if (!strcmp(name, "clip_start")) + tm_type = 3; + + else + tm_type = -1; + } + + switch (tm_type) { case 0: tm_name = "xfov"; break; @@ -955,56 +955,56 @@ void AnimationExporter::operator() (Object *ob) case 3: tm_name = "znear"; break; - + default: tm_name = ""; break; - } - - if (tm_name.size()) { - if (axis_name != "") - return tm_name + "." + std::string(axis_name); - else - return tm_name; - } + } - return std::string(""); + if (tm_name.size()) { + if (axis_name != "") + return tm_name + "." + std::string(axis_name); + else + return tm_name; } - // Assign sid of the animated parameter or transform - // for rotation, axis name is always appended and the value of append_axis is ignored - std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) - { - std::string tm_name; - bool is_rotation =false; - // when given rna_path, determine tm_type from it - if (rna_path) { - char *name = extract_transform_name(rna_path); - - if (!strcmp(name, "rotation_euler")) - tm_type = 0; - else if (!strcmp(name, "rotation_quaternion")) - tm_type = 1; - else if (!strcmp(name, "scale")) - tm_type = 2; - else if (!strcmp(name, "location")) - tm_type = 3; - else if (!strcmp(name, "specular_hardness")) - tm_type = 4; - else if (!strcmp(name, "specular_color")) - tm_type = 5; - else if (!strcmp(name, "diffuse_color")) - tm_type = 6; - else if (!strcmp(name, "alpha")) - tm_type = 7; - else if (!strcmp(name, "ior")) - tm_type = 8; - - else - tm_type = -1; - } + return std::string(""); +} + +// Assign sid of the animated parameter or transform +// for rotation, axis name is always appended and the value of append_axis is ignored +std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) +{ + std::string tm_name; + bool is_rotation =false; + // when given rna_path, determine tm_type from it + if (rna_path) { + char *name = extract_transform_name(rna_path); + + if (!strcmp(name, "rotation_euler")) + tm_type = 0; + else if (!strcmp(name, "rotation_quaternion")) + tm_type = 1; + else if (!strcmp(name, "scale")) + tm_type = 2; + else if (!strcmp(name, "location")) + tm_type = 3; + else if (!strcmp(name, "specular_hardness")) + tm_type = 4; + else if (!strcmp(name, "specular_color")) + tm_type = 5; + else if (!strcmp(name, "diffuse_color")) + tm_type = 6; + else if (!strcmp(name, "alpha")) + tm_type = 7; + else if (!strcmp(name, "ior")) + tm_type = 8; - switch (tm_type) { + else + tm_type = -1; + } + + switch (tm_type) { case 0: case 1: tm_name = "rotation"; @@ -1031,173 +1031,173 @@ void AnimationExporter::operator() (Object *ob) case 8: tm_name = "index_of_refraction"; break; - + default: tm_name = ""; break; - } - - if (tm_name.size()) { - if (is_rotation) - return tm_name + std::string(axis_name) + ".ANGLE"; - else - if (axis_name != "") - return tm_name + "." + std::string(axis_name); - else - return tm_name; - } - - return std::string(""); } - char* AnimationExporter::extract_transform_name(char *rna_path) - { - char *dot = strrchr(rna_path, '.'); - return dot ? (dot + 1) : rna_path; + if (tm_name.size()) { + if (is_rotation) + return tm_name + std::string(axis_name) + ".ANGLE"; + else + if (axis_name != "") + return tm_name + "." + std::string(axis_name); + else + return tm_name; } - //find keyframes of all the objects animations - void AnimationExporter::find_frames(Object *ob, std::vector &fra) - { - FCurve *fcu= (FCurve*)ob->adt->action->curves.first; + return std::string(""); +} - for (; fcu; fcu = fcu->next) { - - for (unsigned int i = 0; i < fcu->totvert; i++) { - float f = fcu->bezt[i].vec[1][0]; // - if (std::find(fra.begin(), fra.end(), f) == fra.end()) - fra.push_back(f); - } - } +char* AnimationExporter::extract_transform_name(char *rna_path) +{ + char *dot = strrchr(rna_path, '.'); + return dot ? (dot + 1) : rna_path; +} - // keep the keys in ascending order - std::sort(fra.begin(), fra.end()); - } +//find keyframes of all the objects animations +void AnimationExporter::find_frames(Object *ob, std::vector &fra) +{ + FCurve *fcu= (FCurve*)ob->adt->action->curves.first; - + for (; fcu; fcu = fcu->next) { - // enable fcurves driving a specific bone, disable all the rest - // if bone_name = NULL enable all fcurves - void AnimationExporter::enable_fcurves(bAction *act, char *bone_name) - { - FCurve *fcu; - char prefix[200]; - - if (bone_name) - BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone_name); - - for (fcu = (FCurve*)act->curves.first; fcu; fcu = fcu->next) { - if (bone_name) { - if (!strncmp(fcu->rna_path, prefix, strlen(prefix))) - fcu->flag &= ~FCURVE_DISABLED; - else - fcu->flag |= FCURVE_DISABLED; - } - else { - fcu->flag &= ~FCURVE_DISABLED; - } + for (unsigned int i = 0; i < fcu->totvert; i++) { + float f = fcu->bezt[i].vec[1][0]; + if (std::find(fra.begin(), fra.end(), f) == fra.end()) + fra.push_back(f); } } - - bool AnimationExporter::hasAnimations(Scene *sce) - { - Base *base= (Base*) sce->base.first; - - while(base) { - Object *ob = base->object; - - FCurve *fcu = 0; - //Check for object transform animations - if(ob->adt && ob->adt->action) - fcu = (FCurve*)ob->adt->action->curves.first; - //Check for Lamp parameter animations - else if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action ) - fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first); - //Check for Camera parameter animations - else if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action ) - fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first); - - //Check Material Effect parameter animations. - for(int a = 0; a < ob->totcol; a++) - { - Material *ma = give_current_material(ob, a+1); - if (!ma) continue; - if(ma->adt && ma->adt->action) - { - fcu = (FCurve*)ma->adt->action->curves.first; - } - } - if ( fcu) - return true; - base= base->next; + // keep the keys in ascending order + std::sort(fra.begin(), fra.end()); +} + + + +// enable fcurves driving a specific bone, disable all the rest +// if bone_name = NULL enable all fcurves +void AnimationExporter::enable_fcurves(bAction *act, char *bone_name) +{ + FCurve *fcu; + char prefix[200]; + + if (bone_name) + BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone_name); + + for (fcu = (FCurve*)act->curves.first; fcu; fcu = fcu->next) { + if (bone_name) { + if (!strncmp(fcu->rna_path, prefix, strlen(prefix))) + fcu->flag &= ~FCURVE_DISABLED; + else + fcu->flag |= FCURVE_DISABLED; + } + else { + fcu->flag &= ~FCURVE_DISABLED; } - return false; } +} - //------------------------------- Not used in the new system.-------------------------------------------------------- - void AnimationExporter::find_rotation_frames(Object *ob, std::vector &fra, const char *prefix, int rotmode) - { - if (rotmode > 0) - find_frames(ob, fra, prefix, "rotation_euler"); - else if (rotmode == ROT_MODE_QUAT) - find_frames(ob, fra, prefix, "rotation_quaternion"); - /*else if (rotmode == ROT_MODE_AXISANGLE) - ;*/ - } +bool AnimationExporter::hasAnimations(Scene *sce) +{ + Base *base= (Base*) sce->base.first; - void AnimationExporter::find_frames(Object *ob, std::vector &fra, const char *prefix, const char *tm_name) - { - FCurve *fcu= (FCurve*)ob->adt->action->curves.first; - - for (; fcu; fcu = fcu->next) { - if (prefix && strncmp(prefix, fcu->rna_path, strlen(prefix))) - continue; - - char *name = extract_transform_name(fcu->rna_path); - if (!strcmp(name, tm_name)) { - for (unsigned int i = 0; i < fcu->totvert; i++) { - float f = fcu->bezt[i].vec[1][0]; // - if (std::find(fra.begin(), fra.end(), f) == fra.end()) - fra.push_back(f); - } + while(base) { + Object *ob = base->object; + + FCurve *fcu = 0; + //Check for object transform animations + if(ob->adt && ob->adt->action) + fcu = (FCurve*)ob->adt->action->curves.first; + //Check for Lamp parameter animations + else if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action ) + fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first); + //Check for Camera parameter animations + else if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action ) + fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first); + + //Check Material Effect parameter animations. + for(int a = 0; a < ob->totcol; a++) + { + Material *ma = give_current_material(ob, a+1); + if (!ma) continue; + if(ma->adt && ma->adt->action) + { + fcu = (FCurve*)ma->adt->action->curves.first; } } - // keep the keys in ascending order - std::sort(fra.begin(), fra.end()); + if ( fcu) + return true; + base= base->next; } + return false; +} - void AnimationExporter::write_bone_animation(Object *ob_arm, Bone *bone) - { - if (!ob_arm->adt) - return; - - //write bone animations for 3 transform types - //i=0 --> rotations - //i=1 --> scale - //i=2 --> location - for (int i = 0; i < 3; i++) - sample_and_write_bone_animation(ob_arm, bone, i); - - for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) - write_bone_animation(ob_arm, child); +//------------------------------- Not used in the new system.-------------------------------------------------------- +void AnimationExporter::find_rotation_frames(Object *ob, std::vector &fra, const char *prefix, int rotmode) +{ + if (rotmode > 0) + find_frames(ob, fra, prefix, "rotation_euler"); + else if (rotmode == ROT_MODE_QUAT) + find_frames(ob, fra, prefix, "rotation_quaternion"); + /*else if (rotmode == ROT_MODE_AXISANGLE) + ;*/ +} + +void AnimationExporter::find_frames(Object *ob, std::vector &fra, const char *prefix, const char *tm_name) +{ + FCurve *fcu= (FCurve*)ob->adt->action->curves.first; + + for (; fcu; fcu = fcu->next) { + if (prefix && strncmp(prefix, fcu->rna_path, strlen(prefix))) + continue; + + char *name = extract_transform_name(fcu->rna_path); + if (!strcmp(name, tm_name)) { + for (unsigned int i = 0; i < fcu->totvert; i++) { + float f = fcu->bezt[i].vec[1][0]; + if (std::find(fra.begin(), fra.end(), f) == fra.end()) + fra.push_back(f); + } + } } - void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type) - { - bArmature *arm = (bArmature*)ob_arm->data; - int flag = arm->flag; - std::vector fra; - char prefix[256]; + // keep the keys in ascending order + std::sort(fra.begin(), fra.end()); +} - BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone->name); +void AnimationExporter::write_bone_animation(Object *ob_arm, Bone *bone) +{ + if (!ob_arm->adt) + return; + + //write bone animations for 3 transform types + //i=0 --> rotations + //i=1 --> scale + //i=2 --> location + for (int i = 0; i < 3; i++) + sample_and_write_bone_animation(ob_arm, bone, i); + + for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) + write_bone_animation(ob_arm, child); +} - bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); - if (!pchan) - return; - //Fill frame array with key frame values framed at @param:transform_type - switch (transform_type) { +void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type) +{ + bArmature *arm = (bArmature*)ob_arm->data; + int flag = arm->flag; + std::vector fra; + char prefix[256]; + + BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone->name); + + bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); + if (!pchan) + return; + //Fill frame array with key frame values framed at @param:transform_type + switch (transform_type) { case 0: find_rotation_frames(ob_arm, fra, prefix, pchan->rotmode); break; @@ -1209,77 +1209,77 @@ void AnimationExporter::operator() (Object *ob) break; default: return; - } + } - // exit rest position - if (flag & ARM_RESTPOS) { - arm->flag &= ~ARM_RESTPOS; - where_is_pose(scene, ob_arm); - } - //v array will hold all values which will be exported. - if (fra.size()) { - float *values = (float*)MEM_callocN(sizeof(float) * 3 * fra.size(), "temp. anim frames"); - sample_animation(values, fra, transform_type, bone, ob_arm, pchan); - - if (transform_type == 0) { - // write x, y, z curves separately if it is rotation - float *axisValues = (float*)MEM_callocN(sizeof(float) * fra.size(), "temp. anim frames"); - - for (int i = 0; i < 3; i++) { - for (unsigned int j = 0; j < fra.size(); j++) - axisValues[j] = values[j * 3 + i]; - - dae_bone_animation(fra, axisValues, transform_type, i, id_name(ob_arm), bone->name); - } - MEM_freeN(axisValues); - } - else { - // write xyz at once if it is location or scale - dae_bone_animation(fra, values, transform_type, -1, id_name(ob_arm), bone->name); - } + // exit rest position + if (flag & ARM_RESTPOS) { + arm->flag &= ~ARM_RESTPOS; + where_is_pose(scene, ob_arm); + } + //v array will hold all values which will be exported. + if (fra.size()) { + float *values = (float*)MEM_callocN(sizeof(float) * 3 * fra.size(), "temp. anim frames"); + sample_animation(values, fra, transform_type, bone, ob_arm, pchan); - MEM_freeN(values); + if (transform_type == 0) { + // write x, y, z curves separately if it is rotation + float *axisValues = (float*)MEM_callocN(sizeof(float) * fra.size(), "temp. anim frames"); + + for (int i = 0; i < 3; i++) { + for (unsigned int j = 0; j < fra.size(); j++) + axisValues[j] = values[j * 3 + i]; + + dae_bone_animation(fra, axisValues, transform_type, i, id_name(ob_arm), bone->name); + } + MEM_freeN(axisValues); + } + else { + // write xyz at once if it is location or scale + dae_bone_animation(fra, values, transform_type, -1, id_name(ob_arm), bone->name); } - // restore restpos - if (flag & ARM_RESTPOS) - arm->flag = flag; - where_is_pose(scene, ob_arm); + MEM_freeN(values); } - void AnimationExporter::sample_animation(float *v, std::vector &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pchan) - { - bPoseChannel *parchan = NULL; - bPose *pose = ob_arm->pose; + // restore restpos + if (flag & ARM_RESTPOS) + arm->flag = flag; + where_is_pose(scene, ob_arm); +} - pchan = get_pose_channel(pose, bone->name); +void AnimationExporter::sample_animation(float *v, std::vector &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pchan) +{ + bPoseChannel *parchan = NULL; + bPose *pose = ob_arm->pose; - if (!pchan) - return; + pchan = get_pose_channel(pose, bone->name); - parchan = pchan->parent; + if (!pchan) + return; - enable_fcurves(ob_arm->adt->action, bone->name); + parchan = pchan->parent; - std::vector::iterator it; - for (it = frames.begin(); it != frames.end(); it++) { - float mat[4][4], ipar[4][4]; + enable_fcurves(ob_arm->adt->action, bone->name); - float ctime = bsystem_time(scene, ob_arm, *it, 0.0f); + std::vector::iterator it; + for (it = frames.begin(); it != frames.end(); it++) { + float mat[4][4], ipar[4][4]; + float ctime = bsystem_time(scene, ob_arm, *it, 0.0f); - BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); - where_is_pose_bone(scene, ob_arm, pchan, ctime, 1); - // compute bone local mat - if (bone->parent) { - invert_m4_m4(ipar, parchan->pose_mat); - mul_m4_m4m4(mat, pchan->pose_mat, ipar); - } - else - copy_m4_m4(mat, pchan->pose_mat); + BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); + where_is_pose_bone(scene, ob_arm, pchan, ctime, 1); + + // compute bone local mat + if (bone->parent) { + invert_m4_m4(ipar, parchan->pose_mat); + mul_m4_m4m4(mat, pchan->pose_mat, ipar); + } + else + copy_m4_m4(mat, pchan->pose_mat); - switch (type) { + switch (type) { case 0: mat4_to_eul(v, mat); break; @@ -1289,12 +1289,10 @@ void AnimationExporter::operator() (Object *ob) case 2: copy_v3_v3(v, mat[3]); break; - } - - v += 3; } - enable_fcurves(ob_arm->adt->action, NULL); + v += 3; } - + enable_fcurves(ob_arm->adt->action, NULL); +} diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 4a3cd5eeb06..db32664f736 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -89,17 +89,17 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) { COLLADAFW::FloatOrDoubleArray& input = curve->getInputValues(); COLLADAFW::FloatOrDoubleArray& output = curve->getOutputValues(); - + if( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER || curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_STEP ) { - COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues(); - COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues(); + COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues(); + COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues(); } float fps = (float)FPS; size_t dim = curve->getOutDimension(); unsigned int i; - + std::vector& fcurves = curve_map[curve->getUniqueId()]; switch (dim) { @@ -110,18 +110,18 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) { for (i = 0; i < dim; i++ ) { FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve"); - + fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED); // fcu->rna_path = BLI_strdupn(path, strlen(path)); fcu->array_index = 0; fcu->totvert = curve->getKeyCount(); - + // create beztriple for each key for (unsigned int j = 0; j < curve->getKeyCount(); j++) { BezTriple bez; memset(&bez, 0, sizeof(BezTriple)); - + // input, output bez.vec[1][0] = bc_get_float_value(input, j) * fps; bez.vec[1][1] = bc_get_float_value(output, j * dim + i); @@ -131,20 +131,20 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_STEP) { COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues(); - COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues(); + COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues(); // intangent - bez.vec[0][0] = bc_get_float_value(intan, (j * 2 * dim ) + (2 * i)) * fps; - bez.vec[0][1] = bc_get_float_value(intan, (j * 2 * dim )+ (2 * i) + 1); + bez.vec[0][0] = bc_get_float_value(intan, (j * 2 * dim ) + (2 * i)) * fps; + bez.vec[0][1] = bc_get_float_value(intan, (j * 2 * dim )+ (2 * i) + 1); - // outtangent - bez.vec[2][0] = bc_get_float_value(outtan, (j * 2 * dim ) + (2 * i)) * fps; - bez.vec[2][1] = bc_get_float_value(outtan, (j * 2 * dim )+ (2 * i) + 1); - if(curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) + // outtangent + bez.vec[2][0] = bc_get_float_value(outtan, (j * 2 * dim ) + (2 * i)) * fps; + bez.vec[2][1] = bc_get_float_value(outtan, (j * 2 * dim )+ (2 * i) + 1); + if(curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) bez.ipo = BEZT_IPO_BEZ; - else - bez.ipo = BEZT_IPO_CONST; - //bez.h1 = bez.h2 = HD_AUTO; + else + bez.ipo = BEZT_IPO_CONST; + //bez.h1 = bez.h2 = HD_AUTO; } else { @@ -153,7 +153,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) } // bez.ipo = U.ipo_new; /* use default interpolation mode here... */ bez.f1 = bez.f2 = bez.f3 = SELECT; - + insert_bezt_fcurve(fcu, &bez, 0); } @@ -306,9 +306,9 @@ bool AnimationImporter::write_animation(const COLLADAFW::Animation* anim) bool AnimationImporter::write_animation_list(const COLLADAFW::AnimationList* animlist) { const COLLADAFW::UniqueId& animlist_id = animlist->getUniqueId(); - + animlist_map[animlist_id] = animlist; - + #if 0 // should not happen @@ -317,10 +317,10 @@ bool AnimationImporter::write_animation_list(const COLLADAFW::AnimationList* ani } // for bones rna_path is like: pose.bones["bone-name"].rotation - + #endif - + return true; } @@ -433,7 +433,7 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act) //sets the rna_path and array index to curve void AnimationImporter::modify_fcurve(std::vector* curves , char* rna_path , int array_index ) -{ +{ std::vector::iterator it; int i; for (it = curves->begin(), i = 0; it != curves->end(); it++, i++) { @@ -450,18 +450,18 @@ void AnimationImporter::modify_fcurve(std::vector* curves , char* rna_p void AnimationImporter::find_frames( std::vector* frames , std::vector* curves) { std::vector::iterator iter; - for (iter = curves->begin(); iter != curves->end(); iter++) { - FCurve *fcu = *iter; - - for (unsigned int k = 0; k < fcu->totvert; k++) { - //get frame value from bezTriple - float fra = fcu->bezt[k].vec[1][0]; - //if frame already not added add frame to frames - if (std::find(frames->begin(), frames->end(), fra) == frames->end()) - frames->push_back(fra); - - } + for (iter = curves->begin(); iter != curves->end(); iter++) { + FCurve *fcu = *iter; + + for (unsigned int k = 0; k < fcu->totvert; k++) { + //get frame value from bezTriple + float fra = fcu->bezt[k].vec[1][0]; + //if frame already not added add frame to frames + if (std::find(frames->begin(), frames->end(), fra) == frames->end()) + frames->push_back(fra); + } + } } //creates the rna_paths and array indices of fcurves from animations using transformation and bound animation class of each animation. @@ -472,18 +472,18 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation * COLLADAFW::Transformation::TransformationType tm_type = transform->getTransformationType(); bool is_matrix = tm_type == COLLADAFW::Transformation::MATRIX; bool is_rotation = tm_type == COLLADAFW::Transformation::ROTATE; - + //to check if the no of curves are valid bool xyz = ((tm_type == COLLADAFW::Transformation::TRANSLATE ||tm_type == COLLADAFW::Transformation::SCALE) && binding->animationClass == COLLADAFW::AnimationList::POSITION_XYZ); - - + + if (!((!xyz && curves->size() == 1) || (xyz && curves->size() == 3) || is_matrix)) { fprintf(stderr, "expected %d curves, got %d\n", xyz ? 3 : 1, (int)curves->size()); return; } - + char rna_path[100]; - + switch (tm_type) { case COLLADAFW::Transformation::TRANSLATE: case COLLADAFW::Transformation::SCALE: @@ -495,80 +495,80 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation * BLI_strncpy(rna_path, loc ? "location" : "scale", sizeof(rna_path)); switch (binding->animationClass) { - case COLLADAFW::AnimationList::POSITION_X: - modify_fcurve(curves, rna_path, 0 ); - break; - case COLLADAFW::AnimationList::POSITION_Y: - modify_fcurve(curves, rna_path, 1 ); - break; - case COLLADAFW::AnimationList::POSITION_Z: - modify_fcurve(curves, rna_path, 2 ); - break; - case COLLADAFW::AnimationList::POSITION_XYZ: - modify_fcurve(curves, rna_path, -1 ); - break; - default: - fprintf(stderr, "AnimationClass %d is not supported for %s.\n", - binding->animationClass, loc ? "TRANSLATE" : "SCALE"); - } - break; + case COLLADAFW::AnimationList::POSITION_X: + modify_fcurve(curves, rna_path, 0 ); + break; + case COLLADAFW::AnimationList::POSITION_Y: + modify_fcurve(curves, rna_path, 1 ); + break; + case COLLADAFW::AnimationList::POSITION_Z: + modify_fcurve(curves, rna_path, 2 ); + break; + case COLLADAFW::AnimationList::POSITION_XYZ: + modify_fcurve(curves, rna_path, -1 ); + break; + default: + fprintf(stderr, "AnimationClass %d is not supported for %s.\n", + binding->animationClass, loc ? "TRANSLATE" : "SCALE"); + } + break; } - - + + case COLLADAFW::Transformation::ROTATE: { if (is_joint) BLI_snprintf(rna_path, sizeof(rna_path), "%s.rotation_euler", joint_path); else BLI_strncpy(rna_path, "rotation_euler", sizeof(rna_path)); - std::vector::iterator iter; + std::vector::iterator iter; for (iter = curves->begin(); iter != curves->end(); iter++) { FCurve* fcu = *iter; - + //if transform is rotation the fcurves values must be turned in to radian. if (is_rotation) fcurve_deg_to_rad(fcu); } COLLADAFW::Rotate* rot = (COLLADAFW::Rotate*)transform; COLLADABU::Math::Vector3& axis = rot->getRotationAxis(); - + switch (binding->animationClass) { - case COLLADAFW::AnimationList::ANGLE: - if (COLLADABU::Math::Vector3::UNIT_X == axis) { - modify_fcurve(curves, rna_path, 0 ); - } - else if (COLLADABU::Math::Vector3::UNIT_Y == axis) { - modify_fcurve(curves, rna_path, 1 ); - } - else if (COLLADABU::Math::Vector3::UNIT_Z == axis) { - modify_fcurve(curves, rna_path, 2 ); - } - break; - case COLLADAFW::AnimationList::AXISANGLE: - // TODO convert axis-angle to quat? or XYZ? - default: - fprintf(stderr, "AnimationClass %d is not supported for ROTATE transformation.\n", - binding->animationClass); - } + case COLLADAFW::AnimationList::ANGLE: + if (COLLADABU::Math::Vector3::UNIT_X == axis) { + modify_fcurve(curves, rna_path, 0 ); + } + else if (COLLADABU::Math::Vector3::UNIT_Y == axis) { + modify_fcurve(curves, rna_path, 1 ); + } + else if (COLLADABU::Math::Vector3::UNIT_Z == axis) { + modify_fcurve(curves, rna_path, 2 ); + } break; + case COLLADAFW::AnimationList::AXISANGLE: + // TODO convert axis-angle to quat? or XYZ? + default: + fprintf(stderr, "AnimationClass %d is not supported for ROTATE transformation.\n", + binding->animationClass); + } + break; } - + case COLLADAFW::Transformation::MATRIX: /*{ - COLLADAFW::Matrix* mat = (COLLADAFW::Matrix*)transform; - COLLADABU::Math::Matrix4 mat4 = mat->getMatrix(); - switch (binding->animationClass) { - case COLLADAFW::AnimationList::TRANSFORM: - - } + COLLADAFW::Matrix* mat = (COLLADAFW::Matrix*)transform; + COLLADABU::Math::Matrix4 mat4 = mat->getMatrix(); + switch (binding->animationClass) { + case COLLADAFW::AnimationList::TRANSFORM: + + } }*/ break; case COLLADAFW::Transformation::SKEW: case COLLADAFW::Transformation::LOOKAT: fprintf(stderr, "Animation of SKEW and LOOKAT transformations is not supported yet.\n"); break; - } - + } + } //creates the rna_paths and array indices of fcurves from animations using color and bound animation class of each animation. @@ -576,15 +576,15 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list { char rna_path[100]; BLI_strncpy(rna_path,anim_type, sizeof(rna_path)); - + const COLLADAFW::AnimationList *animlist = animlist_map[listid]; const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings(); - //all the curves belonging to the current binding - std::vector animcurves; + //all the curves belonging to the current binding + std::vector animcurves; for (unsigned int j = 0; j < bindings.getCount(); j++) { - animcurves = curve_map[bindings[j].animation]; - - switch (bindings[j].animationClass) { + animcurves = curve_map[bindings[j].animation]; + + switch (bindings[j].animationClass) { case COLLADAFW::AnimationList::COLOR_R: modify_fcurve(&animcurves, rna_path, 0 ); break; @@ -598,13 +598,13 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list case COLLADAFW::AnimationList::COLOR_RGBA: // to do-> set intensity modify_fcurve(&animcurves, rna_path, -1 ); break; - + default: fprintf(stderr, "AnimationClass %d is not supported for %s.\n", - bindings[j].animationClass, "COLOR" ); + bindings[j].animationClass, "COLOR" ); } - std::vector::iterator iter; + std::vector::iterator iter; //Add the curves of the current animation to the object for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { FCurve * fcu = *iter; @@ -612,7 +612,7 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list } } - + } void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, char * anim_type) @@ -625,7 +625,7 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list const COLLADAFW::AnimationList *animlist = animlist_map[listid]; const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings(); //all the curves belonging to the current binding - std::vector animcurves; + std::vector animcurves; for (unsigned int j = 0; j < bindings.getCount(); j++) { animcurves = curve_map[bindings[j].animation]; @@ -671,28 +671,28 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector& copy_m4_m4(rest, bone->arm_mat); invert_m4_m4(irest, rest); } - // new curves to assign matrix transform animation + // new curves to assign matrix transform animation FCurve *newcu[10]; // if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale unsigned int totcu = 10 ; - const char *tm_str = NULL; + const char *tm_str = NULL; char rna_path[200]; for (int i = 0; i < totcu; i++) { int axis = i; - if (i < 4) { - tm_str = "rotation_quaternion"; - axis = i; - } - else if (i < 7) { - tm_str = "location"; - axis = i - 4; - } - else { - tm_str = "scale"; - axis = i - 7; - } - + if (i < 4) { + tm_str = "rotation_quaternion"; + axis = i; + } + else if (i < 7) { + tm_str = "location"; + axis = i - 4; + } + else { + tm_str = "scale"; + axis = i - 7; + } + if (is_joint) BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str); @@ -702,11 +702,11 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector& newcu[i]->totvert = frames.size(); } - if (frames.size() == 0) + if (frames.size() == 0) return; -std::sort(frames.begin(), frames.end()); - + std::sort(frames.begin(), frames.end()); + std::vector::iterator it; // sample values at each frame @@ -717,7 +717,7 @@ std::sort(frames.begin(), frames.end()); float matfra[4][4]; unit_m4(matfra); - + // calc object-space mat evaluate_transform_at_frame(matfra, node, fra); @@ -743,23 +743,23 @@ std::sort(frames.begin(), frames.end()); } float rot[4], loc[3], scale[3]; - - mat4_to_quat(rot, mat); - /*for ( int i = 0 ; i < 4 ; i ++ ) - { - rot[i] = rot[i] * (180 / M_PI); - }*/ - copy_v3_v3(loc, mat[3]); - mat4_to_size(scale, mat); - + + mat4_to_quat(rot, mat); + /*for ( int i = 0 ; i < 4 ; i ++ ) + { + rot[i] = rot[i] * (180 / M_PI); + }*/ + copy_v3_v3(loc, mat[3]); + mat4_to_size(scale, mat); + // add keys for (int i = 0; i < totcu; i++) { - if (i < 4) - add_bezt(newcu[i], fra, rot[i]); - else if (i < 7) - add_bezt(newcu[i], fra, loc[i - 4]); - else - add_bezt(newcu[i], fra, scale[i - 7]); + if (i < 4) + add_bezt(newcu[i], fra, rot[i]); + else if (i < 7) + add_bezt(newcu[i], fra, loc[i - 4]); + else + add_bezt(newcu[i], fra, scale[i - 7]); } } verify_adt_action((ID*)&ob->id, 1); @@ -774,13 +774,13 @@ std::sort(frames.begin(), frames.end()); BLI_addtail(curves, newcu[i]); } - if (is_joint) { - bPoseChannel *chan = get_pose_channel(ob->pose, bone_name); - chan->rotmode = ROT_MODE_QUAT; - } - else { - ob->rotmode = ROT_MODE_QUAT; - } + if (is_joint) { + bPoseChannel *chan = get_pose_channel(ob->pose, bone_name); + chan->rotmode = ROT_MODE_QUAT; + } + else { + ob->rotmode = ROT_MODE_QUAT; + } return; @@ -804,24 +804,24 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node , bAction * act; bActionGroup *grp = NULL; - + if ( (animType->transform) != 0 ) { - const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL; - char joint_path[200]; + const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL; + char joint_path[200]; if ( is_joint ) - armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path)); - - + armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path)); + + if (!ob->adt || !ob->adt->action) act = verify_adt_action((ID*)&ob->id, 1); else act = ob->adt->action; - - //Get the list of animation curves of the object - ListBase *AnimCurves = &(act->curves); + + //Get the list of animation curves of the object + ListBase *AnimCurves = &(act->curves); const COLLADAFW::TransformationPointerArray& nodeTransforms = node->getTransformations(); - + //for each transformation in node for (unsigned int i = 0; i < nodeTransforms.getCount(); i++) { COLLADAFW::Transformation *transform = nodeTransforms[i]; @@ -829,10 +829,10 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node , bool is_rotation = tm_type == COLLADAFW::Transformation::ROTATE; bool is_matrix = tm_type == COLLADAFW::Transformation::MATRIX; - + const COLLADAFW::UniqueId& listid = transform->getAnimationList(); - - //check if transformation has animations + + //check if transformation has animations if (animlist_map.find(listid) == animlist_map.end()) continue ; else { @@ -840,25 +840,25 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node , const COLLADAFW::AnimationList *animlist = animlist_map[listid]; const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings(); //all the curves belonging to the current binding - std::vector animcurves; + std::vector animcurves; for (unsigned int j = 0; j < bindings.getCount(); j++) { - animcurves = curve_map[bindings[j].animation]; - if ( is_matrix ) - apply_matrix_curves(ob, animcurves, root , node, transform ); - else { + animcurves = curve_map[bindings[j].animation]; + if ( is_matrix ) + apply_matrix_curves(ob, animcurves, root , node, transform ); + else { //calculate rnapaths and array index of fcurves according to transformation and animation class - Assign_transform_animations(transform, &bindings[j], &animcurves, is_joint, joint_path ); - - std::vector::iterator iter; - //Add the curves of the current animation to the object - for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { - FCurve * fcu = *iter; - if ((ob->type == OB_ARMATURE)) - add_bone_fcurve( ob, node , fcu ); - else - BLI_addtail(AnimCurves, fcu); - } + Assign_transform_animations(transform, &bindings[j], &animcurves, is_joint, joint_path ); + + std::vector::iterator iter; + //Add the curves of the current animation to the object + for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { + FCurve * fcu = *iter; + if ((ob->type == OB_ARMATURE)) + add_bone_fcurve( ob, node , fcu ); + else + BLI_addtail(AnimCurves, fcu); } + } } } if (is_rotation) { @@ -880,7 +880,7 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node , Lamp * lamp = (Lamp*) ob->data; if (!lamp->adt || !lamp->adt->action) act = verify_adt_action((ID*)&lamp->id, 1); - else act = lamp->adt->action; + else act = lamp->adt->action; ListBase *AnimCurves = &(act->curves); const COLLADAFW::InstanceLightPointerArray& nodeLights = node->getInstanceLights(); @@ -892,23 +892,23 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node , { const COLLADAFW::Color *col = &(light->getColor()); const COLLADAFW::UniqueId& listid = col->getAnimationList(); - + Assign_color_animations(listid, AnimCurves, "color"); } if ((animType->light & LIGHT_FOA) != 0 ) { const COLLADAFW::AnimatableFloat *foa = &(light->getFallOffAngle()); const COLLADAFW::UniqueId& listid = foa->getAnimationList(); - + Assign_float_animations( listid ,AnimCurves, "spot_size"); } if ( (animType->light & LIGHT_FOE) != 0 ) { const COLLADAFW::AnimatableFloat *foe = &(light->getFallOffExponent()); const COLLADAFW::UniqueId& listid = foe->getAnimationList(); - + Assign_float_animations( listid ,AnimCurves, "spot_blend"); - + } } } @@ -918,7 +918,7 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node , Camera * camera = (Camera*) ob->data; if (!camera->adt || !camera->adt->action) act = verify_adt_action((ID*)&camera->id, 1); - else act = camera->adt->action; + else act = camera->adt->action; ListBase *AnimCurves = &(act->curves); const COLLADAFW::InstanceCameraPointerArray& nodeCameras= node->getInstanceCameras(); @@ -957,12 +957,12 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node , } } if ( animType->material != 0){ - Material *ma = give_current_material(ob, 1); - if (!ma->adt || !ma->adt->action) act = verify_adt_action((ID*)&ma->id, 1); - else act = ma->adt->action; + Material *ma = give_current_material(ob, 1); + if (!ma->adt || !ma->adt->action) act = verify_adt_action((ID*)&ma->id, 1); + else act = ma->adt->action; ListBase *AnimCurves = &(act->curves); - + const COLLADAFW::InstanceGeometryPointerArray& nodeGeoms = node->getInstanceGeometries(); for (unsigned int i = 0; i < nodeGeoms.getCount(); i++) { const COLLADAFW::MaterialBindingArray& matBinds = nodeGeoms[i]->getMaterialBindings(); @@ -988,7 +988,7 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node , const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList(); Assign_color_animations( listid, AnimCurves , "specular_color" ); } - + if((animType->material & MATERIAL_DIFF_COLOR) != 0){ const COLLADAFW::ColorOrTexture *cot = &(efc->getDiffuse()); const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList(); @@ -1005,15 +1005,15 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD std::map FW_object_map) { AnimMix *types = new AnimMix(); - + const COLLADAFW::TransformationPointerArray& nodeTransforms = node->getTransformations(); - + //for each transformation in node for (unsigned int i = 0; i < nodeTransforms.getCount(); i++) { COLLADAFW::Transformation *transform = nodeTransforms[i]; const COLLADAFW::UniqueId& listid = transform->getAnimationList(); - - //check if transformation has animations + + //check if transformation has animations if (animlist_map.find(listid) == animlist_map.end()) continue ; else { @@ -1028,9 +1028,9 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD types->light = setAnimType(&(light->getColor()),(types->light), LIGHT_COLOR); types->light = setAnimType(&(light->getFallOffAngle()),(types->light), LIGHT_FOA); types->light = setAnimType(&(light->getFallOffExponent()),(types->light), LIGHT_FOE); - + if ( types->light != 0) break; - + } const COLLADAFW::InstanceCameraPointerArray& nodeCameras = node->getInstanceCameras(); @@ -1039,9 +1039,9 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD if ( camera->getCameraType() == COLLADAFW::Camera::PERSPECTIVE ) { - types->camera = setAnimType(&(camera->getXMag()),(types->camera), CAMERA_XFOV); + types->camera = setAnimType(&(camera->getXMag()),(types->camera), CAMERA_XFOV); } - else + else { types->camera = setAnimType(&(camera->getXMag()),(types->camera), CAMERA_XMAG); } @@ -1063,7 +1063,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD types->material = setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS); types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR); types->material = setAnimType(&(efc->getDiffuse().getColor()),(types->material), MATERIAL_DIFF_COLOR); - // types->material = setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY); + // types->material = setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY); types->material = setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR); } } @@ -1101,7 +1101,7 @@ void AnimationImporter::find_frames_old(std::vector * frames, COLLADAFW:: const COLLADAFW::AnimationList *animlist = animlist_map[listid]; const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings(); - + if (bindings.getCount()) { //for each AnimationBinding get the fcurves which animate the transform for (unsigned int j = 0; j < bindings.getCount(); j++) { @@ -1113,7 +1113,7 @@ void AnimationImporter::find_frames_old(std::vector * frames, COLLADAFW:: for (iter = curves.begin(); iter != curves.end(); iter++) { FCurve *fcu = *iter; - + //if transform is rotation the fcurves values must be turned in to radian. if (is_rotation) fcurve_deg_to_rad(fcu); @@ -1448,9 +1448,9 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); if (type != COLLADAFW::Transformation::ROTATE && - type != COLLADAFW::Transformation::SCALE && - type != COLLADAFW::Transformation::TRANSLATE && - type != COLLADAFW::Transformation::MATRIX) { + type != COLLADAFW::Transformation::SCALE && + type != COLLADAFW::Transformation::TRANSLATE && + type != COLLADAFW::Transformation::MATRIX) { fprintf(stderr, "animation of transformation %d is not supported yet\n", type); return false; } @@ -1572,7 +1572,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float COLLADAFW::Matrix tm(matrix); dae_matrix_to_mat4(&tm, mat); - + std::vector::iterator it; return true; diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index 18303eb2f0b..ed9a2171c87 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -88,7 +88,7 @@ private: void add_fcurves_to_object(Object *ob, std::vector& curves, char *rna_path, int array_index, Animation *animated); int typeFlag; - + enum lightAnim { // INANIMATE = 0, @@ -144,7 +144,7 @@ public: #if 0 virtual void change_eul_to_quat(Object *ob, bAction *act); #endif - + void translate_Animations( COLLADAFW::Node * Node , std::map& root_map, std::map& object_map , @@ -161,7 +161,7 @@ public: void Assign_color_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves ,char * anim_type); void Assign_float_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, char * anim_type); - + int setAnimType ( const COLLADAFW::Animatable * prop , int type, int addition); void modify_fcurve(std::vector* curves , char* rna_path , int array_index ); @@ -206,5 +206,5 @@ public: void extra_data_importer(std::string elementName); }; - - #endif + +#endif diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index 92d06bb639f..de01c000373 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -188,7 +188,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm) for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) { add_bone_node(child, ob_arm); } - node.end(); + node.end(); //} } diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 2ec8ae540d2..27aee133557 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -87,7 +87,7 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p if ( it != finished_joints.end()) return; float mat[4][4]; - float obmat[4][4]; + float obmat[4][4]; // object-space get_node_mat(obmat, node, NULL, NULL); @@ -296,7 +296,7 @@ void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone, COLLADAFW: et->setData("tip_z",&z); float vec[3] = {x,y,z}; copy_v3_v3(leaf.bone->tail, leaf.bone->head); - add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec); + add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec); }else leaf_bones.push_back(leaf); } diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index 4f4aed210f2..a197e612a87 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -115,7 +115,7 @@ private: void fix_leaf_bones(); - void set_pose ( Object * ob_arm , COLLADAFW::Node * root_node ,char * parentname, float parent_mat[][4]); + void set_pose ( Object * ob_arm , COLLADAFW::Node * root_node ,char * parentname, float parent_mat[][4]); #if 0 @@ -171,7 +171,7 @@ public: // gives a world-space mat bool get_joint_bind_mat(float m[][4], COLLADAFW::Node *joint); - + void set_tags_map( TagsMap& tags_map); }; diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 760fb2359a4..6032109b809 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -411,7 +411,7 @@ int MeshImporter::count_new_tris(COLLADAFW::Mesh *mesh, Mesh *me) } // TODO: import uv set names -void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //TODO:: Refactor. Possibly replace by iterators +void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //TODO:: Refactor. Possibly replace by iterators { unsigned int i; diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp index ce0d561c524..1d890415ebe 100644 --- a/source/blender/collada/SkinInfo.cpp +++ b/source/blender/collada/SkinInfo.cpp @@ -266,9 +266,9 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::mapmat4_to_dae_double(dmat,local); + converter->mat4_to_dae_double(dmat,local); TransformBase::decompose(local, loc, rot, NULL, scale); if ( node.getType() == COLLADASW::Node::JOINT) -- cgit v1.2.3 From cbc812b757068c65effd90bdd4b08d7f4e25c342 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sun, 4 Sep 2011 01:13:44 +0000 Subject: Fix [#28322] COLLADA imports messed up UVs Reported by Chad Gleason Imported index order could put mface->v4==0. We already know amount of verts, so use that instead. --- source/blender/collada/MeshImporter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 6032109b809..e9086f05628 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -220,8 +220,8 @@ void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs, if (quad) uvs.getUV(indices[index + 3], mtface->uv[3]); -#ifdef COLLADA_DEBUG - /*if (quad) { +#if 1 // #ifdef COLLADA_DEBUG + if (quad) { fprintf(stderr, "face uv:\n" "((%d, %d, %d, %d))\n" "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n", @@ -248,7 +248,7 @@ void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs, mtface->uv[0][0], mtface->uv[0][1], mtface->uv[1][0], mtface->uv[1][1], mtface->uv[2][0], mtface->uv[2][1]); - }*/ + } #endif } @@ -587,7 +587,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T for (k = 0; k < index_list_array.getCount(); k++) { // get mtface by face index and uv set index MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k); - set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, mface->v4 != 0); + set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, vcount == 4); } #endif -- cgit v1.2.3 From 70e3541f3a4327db0fd3fd4070091ddfda313cfe Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sun, 4 Sep 2011 01:27:16 +0000 Subject: BGE animations: Fixing a potential crash when using camera IPOs. The IPOs were being created off of blendercamera->adt->action when they should have been using the supplied action. Thanks to z0r for pointing out the problem and a potential fix. --- source/gameengine/Converter/KX_IpoConvert.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp index 0ee99f5335b..b13dbe324f5 100644 --- a/source/gameengine/Converter/KX_IpoConvert.cpp +++ b/source/gameengine/Converter/KX_IpoConvert.cpp @@ -257,7 +257,7 @@ SG_Controller *BL_CreateCameraIPO(struct bAction *action, KX_GameObject* camera ipocontr->m_clipstart = blendercamera->clipsta; ipocontr->m_clipend = blendercamera->clipend; - BL_InterpolatorList *adtList= GetAdtList(blendercamera->adt->action, converter); + BL_InterpolatorList *adtList= GetAdtList(action, converter); // For each active channel in the adtList add an // interpolator to the game object. -- cgit v1.2.3 From 103b06d4dfe0c5cda0eed2dad8d077e32aa056df Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sun, 4 Sep 2011 01:42:47 +0000 Subject: BGE animations: fixing initialization order issues for BL_ActionActuator and BL_ArmatureObject. Thanks to z0r for pointing them out and providing a fix. --- source/gameengine/Converter/BL_ActionActuator.cpp | 2 +- source/gameengine/Converter/BL_ArmatureObject.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 063544932de..895def17e8e 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -88,10 +88,10 @@ BL_ActionActuator::BL_ActionActuator(SCA_IObject* gameobj, m_blendin(blendin), m_blendstart(0), m_stridelength(stride), + m_layer_weight(layer_weight), m_playtype(playtype), m_priority(priority), m_layer(layer), - m_layer_weight(layer_weight), m_ipo_flags(ipo_flags), m_pose(NULL), m_blendpose(NULL), diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index 395cae4ba87..684bd3f341e 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -231,10 +231,10 @@ BL_ArmatureObject::BL_ArmatureObject( m_timestep(0.040), m_activeAct(NULL), m_activePriority(999), + m_vert_deform_type(vert_deform_type), m_constraintNumber(0), m_channelNumber(0), - m_lastapplyframe(0.0), - m_vert_deform_type(vert_deform_type) + m_lastapplyframe(0.0) { m_armature = (bArmature *)armature->data; -- cgit v1.2.3 From caa1acb6b1d6b908e34be31c4b9bd026066b820f Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sun, 4 Sep 2011 02:12:03 +0000 Subject: Prevent potential crasher, commonEffects could be empty. --- source/blender/collada/AnimationImporter.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index db32664f736..29c356ed8f0 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -1059,12 +1059,14 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD const COLLADAFW::UniqueId & matuid = matBinds[j].getReferencedMaterial(); const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) (FW_object_map[matuid]); const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects(); - COLLADAFW::EffectCommon *efc = commonEffects[0]; - types->material = setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS); - types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR); - types->material = setAnimType(&(efc->getDiffuse().getColor()),(types->material), MATERIAL_DIFF_COLOR); - // types->material = setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY); - types->material = setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR); + if(!commonEffects.empty()) { + COLLADAFW::EffectCommon *efc = commonEffects[0]; + types->material = setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS); + types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR); + types->material = setAnimType(&(efc->getDiffuse().getColor()),(types->material), MATERIAL_DIFF_COLOR); + // types->material = setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY); + types->material = setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR); + } } } return types; -- cgit v1.2.3 From 317908a330184799eecfe34ed47648d5323b43de Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 4 Sep 2011 11:13:41 +0000 Subject: Fix #28423: Screw-modifier crash in cunjunction with subsurf modifier Problems was caused by angle=2*pi and steps=2 in screw modifier. Such configuration produced duplicated geometry to close object and it was confusing for subsurf cache. Restrict steps=2 for screw modifier now, so now 3<=steps<=512. --- source/blender/makesrna/intern/rna_modifier.c | 2 +- source/blender/modifiers/intern/MOD_screw.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 37a629f46d0..22fdfcea29c 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2366,7 +2366,7 @@ static void rna_def_modifier_screw(BlenderRNA *brna) prop= RNA_def_property(srna, "steps", PROP_INT, PROP_UNSIGNED); RNA_def_property_range(prop, 2, 10000); - RNA_def_property_ui_range(prop, 2, 512, 1, 0); + RNA_def_property_ui_range(prop, 3, 512, 1, 0); RNA_def_property_ui_text(prop, "Steps", "Number of steps in the revolution"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index c5fdf465a0a..486c98f82a0 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -275,7 +275,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (fabsf(screw_ofs) <= (FLT_EPSILON*100.0f) && fabsf(fabsf(angle) - ((float)M_PI * 2.0f)) <= (FLT_EPSILON*100.0f)) { close= 1; step_tot--; - if(step_tot < 2) step_tot= 2; + if(step_tot < 3) step_tot= 3; maxVerts = totvert * step_tot; /* -1 because we're joining back up */ maxEdges = (totvert * step_tot) + /* these are the edges between new verts */ @@ -286,7 +286,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } else { close= 0; - if(step_tot < 2) step_tot= 2; + if(step_tot < 3) step_tot= 3; maxVerts = totvert * step_tot; /* -1 because we're joining back up */ maxEdges = (totvert * (step_tot-1)) + /* these are the edges between new verts */ -- cgit v1.2.3 From 7f5c5f8ecaf6d366293cadbd8db08d4516a9499f Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 4 Sep 2011 11:38:53 +0000 Subject: Fix #28500: Reshape in multires modifier makes blender crash Multires doesn't store displacement for base mesh and reshaping when multires subdivision level is set to zero is crappy. Add report that reshape can't work with base level and cancel reshape operator. --- source/blender/editors/object/object_modifier.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index c96d7c1fd10..8813b0027cd 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1066,7 +1066,12 @@ static int multires_reshape_exec(bContext *C, wmOperator *op) if (!mmd) return OPERATOR_CANCELLED; - + + if(mmd->lvl==0) { + BKE_report(op->reports, RPT_ERROR, "Reshape can work only with higher levels of subdivisions."); + return OPERATOR_CANCELLED; + } + CTX_DATA_BEGIN(C, Object*, selob, selected_editable_objects) { if(selob->type == OB_MESH && selob != ob) { secondob= selob; -- cgit v1.2.3 From 1cada203bcae3a65f34e5631f8e8e1ae22ce4415 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sun, 4 Sep 2011 14:31:23 +0000 Subject: [#27884] Collada import: materials mismatch when 2 instance_geometry reference the same material Reported by David Roy Multi-materials used on different meshes would get ignored (resulting in white faces in textured view). --- source/blender/collada/MeshImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index e9086f05628..01eff8069c1 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -796,7 +796,7 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri std::multimap::iterator it; it=materials_mapped_to_geom.find(*geom_uid); while(it!=materials_mapped_to_geom.end()) { - if(it->second == ma_uid) return NULL; // do nothing if already found + if(it->second == ma_uid && it->first == *geom_uid) return NULL; // do nothing if already found it++; } // first time we get geom_uid, ma_uid pair. Save for later check. -- cgit v1.2.3 From f1eab8e85365a91592bf0f369d173e4b9854619d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 4 Sep 2011 15:53:12 +0000 Subject: Fix #28503: Selecting a Grease Pencil from the Properties panel does not update 3D View Added missing notifiers. --- source/blender/makesrna/intern/rna_nodetree.c | 1 + source/blender/makesrna/intern/rna_object.c | 1 + source/blender/makesrna/intern/rna_scene.c | 1 + source/blender/makesrna/intern/rna_space.c | 1 + 4 files changed, 4 insertions(+) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 56492a52da9..d6e475fdbad 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -2736,6 +2736,7 @@ static void rna_def_nodetree(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "GreasePencil"); RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil datablock"); + RNA_def_property_update(prop, NC_NODE, NULL); prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index ad323b0aba4..4e2be7682f8 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -2297,6 +2297,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "GreasePencil"); RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil datablock"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); /* pose */ prop= RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index cc1e7d9390b..3c60a3b4cd7 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3517,6 +3517,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "GreasePencil"); RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil datablock"); + RNA_def_property_update(prop, NC_SCENE, NULL); /* Transform Orientations */ prop= RNA_def_property(srna, "orientations", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 7a7debe1bf5..35360910015 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1622,6 +1622,7 @@ static void rna_def_space_image(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "GreasePencil"); RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL); prop= RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DISPGP); -- cgit v1.2.3 From 5c5b9cf4d793e4169147201dae701ab7aef36c86 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sun, 4 Sep 2011 22:14:28 +0000 Subject: Remove NULL-checks, as they might cause infinite loops while reading a DAE containing unsupported data, i.e. geometry. --- source/blender/collada/DocumentImporter.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 3a92c95e7ee..1a91e185bac 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -410,18 +410,15 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren while (geom_done < geom.getCount()) { ob = mesh_importer.create_mesh_object(node, geom[geom_done], false, uid_material_map, material_texture_mapping_map); - if ( ob != NULL ) - ++geom_done; + ++geom_done; } while (camera_done < camera.getCount()) { ob = create_camera_object(camera[camera_done], sce); - if ( ob != NULL ) - ++camera_done; + ++camera_done; } while (lamp_done < lamp.getCount()) { ob = create_lamp_object(lamp[lamp_done], sce); - if ( ob != NULL ) - ++lamp_done; + ++lamp_done; } while (controller_done < controller.getCount()) { COLLADAFW::InstanceGeometry *geom = (COLLADAFW::InstanceGeometry*)controller[controller_done]; -- cgit v1.2.3 From 3b09c331faae4406d619bfb1fab28a01c77097b4 Mon Sep 17 00:00:00 2001 From: Daniel Salazar Date: Mon, 5 Sep 2011 05:42:49 +0000 Subject: Adding noise module by default in driver_namespace http://www.pasteall.org/blend/8677 --- source/blender/python/intern/bpy_driver.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index d68fd9a9111..f3ef55d29c4 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -76,6 +76,13 @@ int bpy_pydriver_create_dict(void) Py_DECREF(mod); } + /* add noise to global namespace */ + mod= PyImport_ImportModuleLevel((char *)"noise", NULL, NULL, NULL, 0); + if (mod) { + PyDict_SetItemString(bpy_pydriver_Dict, "noise", mod); + Py_DECREF(mod); + } + return 0; } -- cgit v1.2.3 From 919bd181b764b0cf76b7e0fee76a07cc8126fc9a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 5 Sep 2011 08:20:11 +0000 Subject: Partial revert commit 39878 "Fix #28280: Insert Hook wrong index" Such load/make edit structures introduced regression into iterators via object's geometry (vertices, edges, control points and so) when adding hooks in the body of this iterator. Fix for wrong index should be non-destructable for geometry. This will fix #28506: Unusual behavior in curves. --- source/blender/editors/object/object_hook.c | 21 ++++---------------- source/blender/editors/object/object_relations.c | 25 ++++-------------------- 2 files changed, 8 insertions(+), 38 deletions(-) diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 266556773f0..bb32869469a 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -64,7 +64,6 @@ #include "ED_curve.h" #include "ED_mesh.h" -#include "ED_lattice.h" #include "ED_screen.h" #include "WM_types.h" @@ -293,7 +292,7 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo return totvert; } -static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int **indexar, char *name, float *cent_r) +static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char *name, float *cent_r) { *indexar= NULL; *tot= 0; @@ -303,12 +302,7 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int * case OB_MESH: { Mesh *me= obedit->data; - EditMesh *em; - - load_editMesh(scene, obedit); - make_editMesh(scene, obedit); - - em = BKE_mesh_get_editmesh(me); + EditMesh *em = BKE_mesh_get_editmesh(me); /* check selected vertices first */ if( return_editmesh_indexar(em, tot, indexar, cent_r)) { @@ -322,17 +316,10 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int * } case OB_CURVE: case OB_SURF: - load_editNurb(obedit); - make_editNurb(obedit); - return return_editcurve_indexar(obedit, tot, indexar, cent_r); case OB_LATTICE: { Lattice *lt= obedit->data; - - load_editLatt(obedit); - make_editLatt(obedit); - return return_editlattice_indexar(lt->editlatt->latt, tot, indexar, cent_r); } default: @@ -440,7 +427,7 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o int tot, ok, *indexar; char name[32]; - ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent); + ok = object_hook_index_array(obedit, &tot, &indexar, name, cent); if (!ok) return; // XXX error("Requires selected vertices or active Vertex Group"); @@ -773,7 +760,7 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op) /* assign functionality */ - if(!object_hook_index_array(CTX_data_scene(C), ob, &tot, &indexar, name, cent)) { + if(!object_hook_index_array(ob, &tot, &indexar, name, cent)) { BKE_report(op->reports, RPT_WARNING, "Requires selected vertices or active vertex group"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index b9208e778c7..e9418ca9f9f 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -91,8 +91,6 @@ #include "ED_armature.h" #include "ED_curve.h" -#include "ED_lattice.h" -#include "ED_mesh.h" #include "ED_keyframing.h" #include "ED_object.h" #include "ED_screen.h" @@ -124,12 +122,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) if(obedit->type==OB_MESH) { Mesh *me= obedit->data; - EditMesh *em; - - load_editMesh(scene, obedit); - make_editMesh(scene, obedit); - - em = BKE_mesh_get_editmesh(me); + EditMesh *em = BKE_mesh_get_editmesh(me); eve= em->verts.first; while(eve) { @@ -147,12 +140,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) BKE_mesh_end_editmesh(me, em); } else if(ELEM(obedit->type, OB_SURF, OB_CURVE)) { - ListBase *editnurb; - - load_editNurb(obedit); - make_editNurb(obedit); - - editnurb= curve_get_editcurve(obedit); + ListBase *editnurb= curve_get_editcurve(obedit); cu= obedit->data; @@ -192,13 +180,8 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) } } else if(obedit->type==OB_LATTICE) { - Lattice *lt; - - load_editLatt(obedit); - make_editLatt(obedit); - - lt= obedit->data; - + Lattice *lt= obedit->data; + a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw; bp= lt->editlatt->latt->def; while(a--) { -- cgit v1.2.3 From d91587752c1a27e0569dec4ea24a682e7ea51007 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 5 Sep 2011 13:19:19 +0000 Subject: Fix #28504: lib linking errors were not shown when opening a file from the splash screen. --- source/blender/windowmanager/intern/wm_event_system.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 27586525253..5711ec899bf 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -437,9 +437,18 @@ static void wm_operator_print(bContext *C, wmOperator *op) static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int popup) { - if(popup) - if(op->reports->list.first) + if(popup) { + if(op->reports->list.first) { + /* FIXME, temp setting window, see other call to uiPupMenuReports for why */ + wmWindow *win_prev= CTX_wm_window(C); + if(win_prev==NULL) + CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first); + uiPupMenuReports(C, op->reports); + + CTX_wm_window_set(C, win_prev); + } + } if(retval & OPERATOR_FINISHED) { if(G.f & G_DEBUG) -- cgit v1.2.3 From cc1c8268f755adfcf02085251e095b0589548719 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 5 Sep 2011 15:03:31 +0000 Subject: Left debug print accidently enabled. --- source/blender/collada/MeshImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 01eff8069c1..15bd9c48f12 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -220,7 +220,7 @@ void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs, if (quad) uvs.getUV(indices[index + 3], mtface->uv[3]); -#if 1 // #ifdef COLLADA_DEBUG +#ifdef COLLADA_DEBUG if (quad) { fprintf(stderr, "face uv:\n" "((%d, %d, %d, %d))\n" -- cgit v1.2.3 From 59dbd53e72ae25edf247e49ea1e291af277fecc4 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 5 Sep 2011 15:55:53 +0000 Subject: Fix #28389: UILayout.menu function didn't emboss menu button correct in the 3d view tools region. --- source/blender/editors/interface/interface_layout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index ef88bb0bbb6..a2e65f5e4ec 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1404,7 +1404,7 @@ static void ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCre if(layout->root->type == UI_LAYOUT_HEADER) uiBlockSetEmboss(block, UI_EMBOSS); - else if(layout->root->type == UI_LAYOUT_PANEL) { + else if(ELEM(layout->root->type, UI_LAYOUT_PANEL, UI_LAYOUT_TOOLBAR)) { but->type= MENU; but->flag |= UI_TEXT_LEFT; } -- cgit v1.2.3