diff options
author | Diego Borghetti <bdiego@gmail.com> | 2008-07-13 20:57:24 +0400 |
---|---|---|
committer | Diego Borghetti <bdiego@gmail.com> | 2008-07-13 20:57:24 +0400 |
commit | 83f6a9d1b4b4a746b7c098d188310c0df7a3b6cd (patch) | |
tree | 66cc1e67068154b91deaeacc72f715890f329059 /source | |
parent | c4f8536ec779546741e34e3fcf0318e78297f346 (diff) |
branches/blender-2.47
Merge from trunk:
Revision: 15521
Revision: 15523
Revision: 15524
Revision: 15527
Revision: 15529
Revision: 15537
Revision: 15543
Revision: 15545
Revision: 15548
Revision: 15553
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 16 | ||||
-rw-r--r-- | source/blender/blenlib/intern/util.c | 1 | ||||
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 1 | ||||
-rw-r--r-- | source/blender/src/buttons_editing.c | 4 | ||||
-rw-r--r-- | source/blender/src/buttons_shading.c | 6 | ||||
-rw-r--r-- | source/blender/src/editsound.c | 2 | ||||
-rw-r--r-- | source/blender/src/space.c | 9 | ||||
-rw-r--r-- | source/blender/src/vpaint.c | 36 | ||||
-rw-r--r-- | source/gameengine/Converter/KX_ConvertActuators.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp | 39 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h | 10 |
11 files changed, 87 insertions, 39 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 57ecffbb796..43805959e62 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -459,9 +459,10 @@ int BKE_ptcache_object_reset(Object *ob, int mode) PTCacheID pid; ParticleSystem *psys; ModifierData *md; - int reset; + int reset, skip; reset= 0; + skip= 0; if(ob->soft) { BKE_ptcache_id_from_softbody(&pid, ob, ob->soft); @@ -469,11 +470,18 @@ int BKE_ptcache_object_reset(Object *ob, int mode) } for(psys=ob->particlesystem.first; psys; psys=psys->next) { - BKE_ptcache_id_from_particles(&pid, ob, psys); - reset |= BKE_ptcache_id_reset(&pid, mode); - + /* Baked softbody hair has to be checked first, because we don't want to reset */ + /* particles or softbody in that case -jahka */ if(psys->soft) { BKE_ptcache_id_from_softbody(&pid, ob, psys->soft); + if(mode == PSYS_RESET_ALL || !(psys->part->type == PART_HAIR && (pid.cache->flag & PTCACHE_BAKED))) + reset |= BKE_ptcache_id_reset(&pid, mode); + else + skip = 1; + } + + if(skip == 0) { + BKE_ptcache_id_from_particles(&pid, ob, psys); reset |= BKE_ptcache_id_reset(&pid, mode); } } diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index 5a85fbfc375..48ebf770e1b 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -1722,6 +1722,7 @@ void BLI_where_am_i(char *fullname, const char *name) path = br_find_exe( NULL ); if (path) { strcpy(fullname, path); + free(path); return; } #endif diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index dbade68ba1d..acb2bd994fa 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -203,6 +203,7 @@ void RE_make_stars(Render *re, void (*initfunc)(void), else stargrid *= 1.0; /* then it draws fewer */ if(re) MTC_Mat4Invert(mat, re->viewmat); + else MTC_Mat4One(mat); /* BOUNDING BOX CALCULATION * bbox goes from z = loc_near_var | loc_far_var, diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 2e45f6f73c4..6079110175f 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -513,7 +513,6 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an } else { editmesh_deselect_by_material(G.obedit->actcol-1); } - allqueue(REDRAWVIEW3D, 0); } else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) { nu= editNurb.first; @@ -553,8 +552,9 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an nu= nu->next; } BIF_undo_push("Select material index"); - allqueue(REDRAWVIEW3D, 0); } + allqueue(REDRAWIMAGE, 0); + allqueue(REDRAWVIEW3D, 0); } countall(); break; diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index 04a497ffdea..a7bc81a81e8 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -2864,15 +2864,15 @@ static void lamp_panel_lamp(Object *ob, Lamp *la) uiBlockSetCol(block, TH_BUT_SETTING1); uiDefButS(block, MENU, B_LAMPREDRAW, "Falloff %t|Constant %x0|Inverse Linear %x1|Inverse Square %x2|Custom Curve %x3|Lin/Quad Weighted %x4|", 10,150,100,19, &la->falloff_type, 0,0,0,0, "Lamp falloff - intensity decay with distance"); - uiDefButBitS(block, TOG, LA_SPHERE, REDRAWVIEW3D,"Sphere", 10,130,100,19,&la->mode, 0, 0, 0, 0, "Sets light intensity to zero for objects beyond the distance value"); + uiDefButBitS(block, TOG, LA_SPHERE, B_LAMPPRV,"Sphere", 10,130,100,19,&la->mode, 0, 0, 0, 0, "Sets light intensity to zero for objects beyond the distance value"); } uiBlockBeginAlign(block); uiBlockSetCol(block, TH_BUT_SETTING1); uiDefButBitS(block, TOG, LA_LAYER, 0,"Layer", 10,70,100,19,&la->mode, 0, 0, 0, 0, "Illuminates objects in the same layer as the lamp only"); uiDefButBitS(block, TOG, LA_NEG, B_LAMPPRV,"Negative", 10,50,100,19,&la->mode, 0, 0, 0, 0, "Sets lamp to cast negative light"); - uiDefButBitS(block, TOG, LA_NO_DIFF, 0,"No Diffuse", 10,30,100,19,&la->mode, 0, 0, 0, 0, "Disables diffuse shading of material illuminated by this lamp"); - uiDefButBitS(block, TOG, LA_NO_SPEC, 0,"No Specular", 10,10,100,19,&la->mode, 0, 0, 0, 0, "Disables specular shading of material illuminated by this lamp"); + uiDefButBitS(block, TOG, LA_NO_DIFF, B_LAMPPRV,"No Diffuse", 10,30,100,19,&la->mode, 0, 0, 0, 0, "Disables diffuse shading of material illuminated by this lamp"); + uiDefButBitS(block, TOG, LA_NO_SPEC, B_LAMPPRV,"No Specular", 10,10,100,19,&la->mode, 0, 0, 0, 0, "Disables specular shading of material illuminated by this lamp"); uiBlockEndAlign(block); uiBlockSetCol(block, TH_AUTO); diff --git a/source/blender/src/editsound.c b/source/blender/src/editsound.c index 1cb7ec276cb..05eb094a7c2 100644 --- a/source/blender/src/editsound.c +++ b/source/blender/src/editsound.c @@ -148,7 +148,7 @@ void winqreadsoundspace(ScrArea *sa, void *spacedata, BWinEvent *evt) first= 0; CFRA= cfra; update_for_newframe(); - force_draw_plus(SPACE_VIEW3D, 1); + force_draw_all(0); } else PIL_sleep_ms(30); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 1536ec3da03..feaddd3b3e4 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -4439,7 +4439,10 @@ static void winqreadinfospace(ScrArea *sa, void *spacedata, BWinEvent *evt) switch(event) { case UI_BUT_EVENT: - if(val==REDRAWTIME) allqueue(REDRAWTIME, 0); + if(val==REDRAWTIME) { + allqueue(REDRAWTIME, 0); + addqueue(sa->win, REDRAW, 1); + } else if(val==B_ADD_THEME) { bTheme *btheme, *new; @@ -4840,9 +4843,9 @@ static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if( cfra!=CFRA || first ) { first= 0; - + CFRA= cfra; - force_draw(0); + force_draw_all(0); update_for_newframe(); /* for audio scrubbing */ } else PIL_sleep_ms(30); diff --git a/source/blender/src/vpaint.c b/source/blender/src/vpaint.c index 4e883caba55..935c546a235 100644 --- a/source/blender/src/vpaint.c +++ b/source/blender/src/vpaint.c @@ -566,9 +566,9 @@ static unsigned int mcol_blend(unsigned int col1, unsigned int col2, int fac) cp= (char *)&col; cp[0]= 255; - cp[1]= (mfac*cp1[1]+fac*cp2[1])>>8; - cp[2]= (mfac*cp1[2]+fac*cp2[2])>>8; - cp[3]= (mfac*cp1[3]+fac*cp2[3])>>8; + cp[1]= (mfac*cp1[1]+fac*cp2[1])/255; + cp[2]= (mfac*cp1[2]+fac*cp2[2])/255; + cp[3]= (mfac*cp1[3]+fac*cp2[3])/255; return col; } @@ -586,11 +586,11 @@ static unsigned int mcol_add(unsigned int col1, unsigned int col2, int fac) cp= (char *)&col; cp[0]= 255; - temp= cp1[1] + ((fac*cp2[1])>>8); + temp= cp1[1] + ((fac*cp2[1])/255); if(temp>254) cp[1]= 255; else cp[1]= temp; - temp= cp1[2] + ((fac*cp2[2])>>8); + temp= cp1[2] + ((fac*cp2[2])/255); if(temp>254) cp[2]= 255; else cp[2]= temp; - temp= cp1[3] + ((fac*cp2[3])>>8); + temp= cp1[3] + ((fac*cp2[3])/255); if(temp>254) cp[3]= 255; else cp[3]= temp; return col; @@ -609,11 +609,11 @@ static unsigned int mcol_sub(unsigned int col1, unsigned int col2, int fac) cp= (char *)&col; cp[0]= 255; - temp= cp1[1] - ((fac*cp2[1])>>8); + temp= cp1[1] - ((fac*cp2[1])/255); if(temp<0) cp[1]= 0; else cp[1]= temp; - temp= cp1[2] - ((fac*cp2[2])>>8); + temp= cp1[2] - ((fac*cp2[2])/255); if(temp<0) cp[2]= 0; else cp[2]= temp; - temp= cp1[3] - ((fac*cp2[3])>>8); + temp= cp1[3] - ((fac*cp2[3])/255); if(temp<0) cp[3]= 0; else cp[3]= temp; return col; @@ -635,9 +635,9 @@ static unsigned int mcol_mul(unsigned int col1, unsigned int col2, int fac) /* first mul, then blend the fac */ cp[0]= 255; - cp[1]= (mfac*cp1[1] + fac*((cp2[1]*cp1[1])>>8) )>>8; - cp[2]= (mfac*cp1[2] + fac*((cp2[2]*cp1[2])>>8) )>>8; - cp[3]= (mfac*cp1[3] + fac*((cp2[3]*cp1[3])>>8) )>>8; + cp[1]= (mfac*cp1[1] + fac*((cp2[1]*cp1[1])/255) )/255; + cp[2]= (mfac*cp1[2] + fac*((cp2[2]*cp1[2])/255) )/255; + cp[3]= (mfac*cp1[3] + fac*((cp2[3]*cp1[3])/255) )/255; return col; @@ -664,9 +664,9 @@ static unsigned int mcol_lighten(unsigned int col1, unsigned int col2, int fac) return col1; cp[0]= 255; - cp[1]= (mfac*cp1[1]+fac*cp2[1])>>8; - cp[2]= (mfac*cp1[2]+fac*cp2[2])>>8; - cp[3]= (mfac*cp1[3]+fac*cp2[3])>>8; + cp[1]= (mfac*cp1[1]+fac*cp2[1])/255; + cp[2]= (mfac*cp1[2]+fac*cp2[2])/255; + cp[3]= (mfac*cp1[3]+fac*cp2[3])/255; return col; } @@ -692,9 +692,9 @@ static unsigned int mcol_darken(unsigned int col1, unsigned int col2, int fac) return col1; cp[0]= 255; - cp[1]= (mfac*cp1[1]+fac*cp2[1])>>8; - cp[2]= (mfac*cp1[2]+fac*cp2[2])>>8; - cp[3]= (mfac*cp1[3]+fac*cp2[3])>>8; + cp[1]= (mfac*cp1[1]+fac*cp2[1])/255; + cp[2]= (mfac*cp1[2]+fac*cp2[2])/255; + cp[3]= (mfac*cp1[3]+fac*cp2[3])/255; return col; } diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 6b594e2e70b..80e97c3bcbc 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -506,7 +506,7 @@ void BL_ConvertActuators(char* maggiename, // does the 'original' for replication exists, and // is it in a non-active layer ? - CValue* originalval = NULL; + SCA_IObject* originalval = NULL; if (editobact->ob && !(editobact->ob->lay & activeLayerBitInfo)) originalval = converter->FindGameObject(editobact->ob); diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp index 76ce086ab97..e5ee4cbddf1 100644 --- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp @@ -48,7 +48,7 @@ /* ------------------------------------------------------------------------- */ KX_SCA_AddObjectActuator::KX_SCA_AddObjectActuator(SCA_IObject *gameobj, - CValue* original, + SCA_IObject *original, int time, SCA_IScene* scene, const MT_Vector3& linvel, @@ -61,6 +61,9 @@ KX_SCA_AddObjectActuator::KX_SCA_AddObjectActuator(SCA_IObject *gameobj, m_linear_velocity(linvel), m_localFlag(local) { + if (m_OriginalObject) + m_OriginalObject->RegisterActuator(this); + m_lastCreatedObject = NULL; m_timeProp = time; } @@ -69,6 +72,8 @@ KX_SCA_AddObjectActuator::KX_SCA_AddObjectActuator(SCA_IObject *gameobj, KX_SCA_AddObjectActuator::~KX_SCA_AddObjectActuator() { + if (m_OriginalObject) + m_OriginalObject->UnregisterActuator(this); if (m_lastCreatedObject) m_lastCreatedObject->Release(); } @@ -108,12 +113,29 @@ CValue* KX_SCA_AddObjectActuator::GetReplica() // this will copy properties and so on... replica->ProcessReplica(); - replica->m_lastCreatedObject=NULL; CValue::AddDataToReplica(replica); return replica; } +void KX_SCA_AddObjectActuator::ProcessReplica() +{ + if (m_OriginalObject) + m_OriginalObject->RegisterActuator(this); + m_lastCreatedObject=NULL; + SCA_IActuator::ProcessReplica(); +} + +bool KX_SCA_AddObjectActuator::UnlinkObject(SCA_IObject* clientobj) +{ + if (clientobj == m_OriginalObject) + { + // this object is being deleted, we cannot continue to track it. + m_OriginalObject = NULL; + return true; + } + return false; +} /* ------------------------------------------------------------------------- */ @@ -181,7 +203,11 @@ PyObject* KX_SCA_AddObjectActuator::PySetObject(PyObject* self, PyObject* gameobj; if (PyArg_ParseTuple(args, "O!", &KX_GameObject::Type, &gameobj)) { - m_OriginalObject = (CValue*)gameobj; + if (m_OriginalObject != NULL) + m_OriginalObject->UnregisterActuator(this); + m_OriginalObject = (SCA_IObject*)gameobj; + if (m_OriginalObject) + m_OriginalObject->RegisterActuator(this); Py_Return; } PyErr_Clear(); @@ -189,8 +215,11 @@ PyObject* KX_SCA_AddObjectActuator::PySetObject(PyObject* self, char* objectname; if (PyArg_ParseTuple(args, "s", &objectname)) { - m_OriginalObject= (CValue*)SCA_ILogicBrick::m_sCurrentLogicManager->GetGameObjectByName(STR_String(objectname));; - + if (m_OriginalObject != NULL) + m_OriginalObject->UnregisterActuator(this); + m_OriginalObject = (SCA_IObject*)SCA_ILogicBrick::m_sCurrentLogicManager->GetGameObjectByName(STR_String(objectname));; + if (m_OriginalObject) + m_OriginalObject->RegisterActuator(this); Py_Return; } diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h index 2126a646303..42123b94a68 100644 --- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h @@ -53,7 +53,7 @@ class KX_SCA_AddObjectActuator : public SCA_IActuator int m_timeProp; /// Original object reference (object to replicate) - CValue* m_OriginalObject; + SCA_IObject* m_OriginalObject; /// Object will be added to the following scene SCA_IScene* m_scene; @@ -75,7 +75,7 @@ public: KX_SCA_AddObjectActuator( SCA_IObject *gameobj, - CValue* original, + SCA_IObject *original, int time, SCA_IScene* scene, const MT_Vector3& linvel, @@ -89,6 +89,12 @@ public: GetReplica( ) ; + virtual void + ProcessReplica(); + + virtual bool + UnlinkObject(SCA_IObject* clientobj); + virtual bool Update(); |