Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2008-07-14 17:39:48 +0400
committerCampbell Barton <ideasman42@gmail.com>2008-07-14 17:39:48 +0400
commita1fea54c185527a13aad3c3e5da81786fae3e13d (patch)
tree06cf1d93307e649b8bb7b927fe5cb208b8fc82c4
parent00c4265bda4eda13ae52c6b2082edf69239aab9f (diff)
svn merge -r15560:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender
Also topology mirror crashed when using smooth + mirror. use eve->hash rather them eve->tmp.l for storing edit vert indices's.
-rw-r--r--intern/elbeem/intern/solver_init.cpp2
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp2
-rw-r--r--source/blender/include/BIF_meshtools.h2
-rw-r--r--source/blender/render/intern/source/zbuf.c24
-rw-r--r--source/blender/src/editmesh_mods.c12
-rw-r--r--source/blender/src/meshtools.c24
-rw-r--r--source/blender/src/transform_conversions.c2
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp11
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp14
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp5
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp13
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.h1
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.cpp3
14 files changed, 67 insertions, 50 deletions
diff --git a/intern/elbeem/intern/solver_init.cpp b/intern/elbeem/intern/solver_init.cpp
index c953d2f47da..a873f3c6987 100644
--- a/intern/elbeem/intern/solver_init.cpp
+++ b/intern/elbeem/intern/solver_init.cpp
@@ -694,7 +694,7 @@ bool LbmFsgrSolver::initializeSolverMemory()
double maxDefaultMemChunk = 2.*1024.*1024.*1024.;
//std::cerr<<" memEstFine "<< memEstFine <<" maxWin:" <<maxWinMemChunk <<" maxMac:" <<maxMacMemChunk ; // DEBUG
#ifdef WIN32
- if(memEstFine> maxWinMemChunk) {
+ if(sizeof(void *)==4 && memEstFine>maxWinMemChunk) {
memBlockAllocProblem = true;
}
#endif // WIN32
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index fe352610a40..3e618a483e3 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -451,7 +451,7 @@ void IMB_exr_begin_write(void *handle, char *filename, int width, int height, in
openexr_header_compression(&header, compress);
/* header.lineOrder() = DECREASING_Y; this crashes in windows for file read! */
- header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.43"));
+ header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.43 and newer"));
data->ofile = new OutputFile(filename, header);
}
diff --git a/source/blender/include/BIF_meshtools.h b/source/blender/include/BIF_meshtools.h
index a86f83f5442..cae2c63d7cd 100644
--- a/source/blender/include/BIF_meshtools.h
+++ b/source/blender/include/BIF_meshtools.h
@@ -43,7 +43,7 @@ extern void objects_bake_render(short event, char **error_msg);
extern long mesh_octree_table(struct Object *ob, float *co, char mode);
extern long mesh_mirrtopo_table(struct Object *ob, char mode);
extern int mesh_get_x_mirror_vert(struct Object *ob, int index);
-extern struct EditVert *editmesh_get_x_mirror_vert(struct Object *ob, struct EditVert *eve);
+extern struct EditVert *editmesh_get_x_mirror_vert(struct Object *ob, struct EditVert *eve, int index);
extern float *editmesh_get_mirror_uv(int axis, float *co, float *mirrCent, float *face_cent);
extern int *mesh_get_x_mirror_faces(struct Object *ob);
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index be7678f993e..965d3548aa4 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -3545,7 +3545,7 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
float *col= NULL;
- int pixsize= 0;
+ int pixsize= 3;
switch(rpass->passtype) {
case SCE_PASS_RGBA:
@@ -3580,6 +3580,10 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
col= &shr->mist;
pixsize= 1;
break;
+ case SCE_PASS_Z:
+ col= &shr->z;
+ pixsize= 1;
+ break;
case SCE_PASS_VECTOR:
{
@@ -3612,14 +3616,18 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
for(samp= 1; samp<R.osa; samp++, fp+=delta) {
col[0]+= fp[0];
- col[1]+= fp[1];
- col[2]+= fp[2];
- if(pixsize) col[3]+= fp[3];
+ if(pixsize>1) {
+ col[1]+= fp[1];
+ col[2]+= fp[2];
+ if(pixsize==4) col[3]+= fp[3];
+ }
}
col[0]*= weight;
- col[1]*= weight;
- col[2]*= weight;
- if(pixsize) col[3]*= weight;
+ if(pixsize>1) {
+ col[1]*= weight;
+ col[2]*= weight;
+ if(pixsize==4) col[3]*= weight;
+ }
}
}
@@ -3973,7 +3981,7 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
/* general shader info, passes */
shade_sample_initialize(&ssamp, pa, rl);
- addpassflag= rl->passflag & ~(SCE_PASS_Z|SCE_PASS_COMBINED);
+ addpassflag= rl->passflag & ~(SCE_PASS_COMBINED);
addzbuf= rl->passflag & SCE_PASS_Z;
if(R.osa)
diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c
index e4a7bc6da13..0ebbaf18aee 100644
--- a/source/blender/src/editmesh_mods.c
+++ b/source/blender/src/editmesh_mods.c
@@ -117,10 +117,10 @@ void EM_select_mirrored(void)
if(G.scene->selectmode & SCE_SELECT_VERTEX) {
EditMesh *em = G.editMesh;
EditVert *eve, *v1;
-
- for(eve= em->verts.first; eve; eve= eve->next) {
+ int a;
+ for(eve= em->verts.first, a=0; eve; eve= eve->next, a++) {
if(eve->f & SELECT) {
- v1= editmesh_get_x_mirror_vert(G.obedit, eve);
+ v1= editmesh_get_x_mirror_vert(G.obedit, eve, a);
if(v1) {
eve->f &= ~SELECT;
v1->f |= SELECT;
@@ -4168,7 +4168,7 @@ void vertexsmooth(void)
EditEdge *eed;
float *adror, *adr, fac;
float fvec[3];
- int teller=0;
+ int teller=0, a;
ModifierData *md= G.obedit->modifiers.first;
if(G.obedit==0) return;
@@ -4243,13 +4243,14 @@ void vertexsmooth(void)
eed= eed->next;
}
+ a = 0;
eve= em->verts.first;
while(eve) {
if(eve->f & SELECT) {
if(eve->f1) {
if (G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR) {
- eve_mir= editmesh_get_x_mirror_vert(G.obedit, eve);
+ eve_mir= editmesh_get_x_mirror_vert(G.obedit, eve, a);
}
adr = eve->tmp.p;
@@ -4283,6 +4284,7 @@ void vertexsmooth(void)
eve->tmp.p= NULL;
}
eve= eve->next;
+ a++;
}
MEM_freeN(adror);
diff --git a/source/blender/src/meshtools.c b/source/blender/src/meshtools.c
index 9c002f1f7fb..12fc3c15625 100644
--- a/source/blender/src/meshtools.c
+++ b/source/blender/src/meshtools.c
@@ -899,7 +899,7 @@ long mesh_mirrtopo_table(Object *ob, char mode)
EditVert *eve;
totvert= 0;
for(eve= G.editMesh->verts.first; eve; eve= eve->next) {
- eve->tmp.l = totvert++;
+ eve->hash = totvert++;
}
} else {
totvert = me->totvert;
@@ -910,8 +910,8 @@ long mesh_mirrtopo_table(Object *ob, char mode)
/* Initialize the vert-edge-user counts used to detect unique topology */
if(ob==G.obedit) {
for(eed=G.editMesh->edges.first; eed; eed= eed->next) {
- MirrTopoHash[eed->v1->tmp.l]++;
- MirrTopoHash[eed->v2->tmp.l]++;
+ MirrTopoHash[eed->v1->hash]++;
+ MirrTopoHash[eed->v2->hash]++;
}
} else {
for(a=0, medge=me->medge; a<me->totedge; a++, medge++) {
@@ -928,8 +928,8 @@ long mesh_mirrtopo_table(Object *ob, char mode)
if(ob==G.obedit) {
for(eed=G.editMesh->edges.first; eed; eed= eed->next) {
- MirrTopoHash[eed->v1->tmp.l] += MirrTopoHash_Prev[eed->v2->tmp.l];
- MirrTopoHash[eed->v2->tmp.l] += MirrTopoHash_Prev[eed->v1->tmp.l];
+ MirrTopoHash[eed->v1->hash] += MirrTopoHash_Prev[eed->v2->hash];
+ MirrTopoHash[eed->v2->hash] += MirrTopoHash_Prev[eed->v1->hash];
}
} else {
for(a=0, medge=me->medge; a<me->totedge; a++, medge++) {
@@ -1086,14 +1086,16 @@ static EditVert *editmesh_get_x_mirror_vert_spacial(Object *ob, float *co)
return NULL;
}
-static EditVert *editmesh_get_x_mirror_vert_topo(Object *ob, EditVert *eve)
+static EditVert *editmesh_get_x_mirror_vert_topo(Object *ob, EditVert *eve, int index)
{
long poinval;
- int index;
if (mesh_mirrtopo_table(ob, 'u')==-1)
return NULL;
- index = BLI_findindex(&G.editMesh->verts, eve);
+ if (index!=-1) {
+ index = BLI_findindex(&G.editMesh->verts, eve);
+ }
+
if (index==-1)
return NULL;
@@ -1104,12 +1106,12 @@ static EditVert *editmesh_get_x_mirror_vert_topo(Object *ob, EditVert *eve)
return NULL;
}
-EditVert *editmesh_get_x_mirror_vert(Object *ob, EditVert *eve)
+EditVert *editmesh_get_x_mirror_vert(Object *ob, EditVert *eve, int index)
{
if (G.scene->toolsettings->editbutflag & B_MIRROR_TOPO) {
- return editmesh_get_x_mirror_vert_topo(ob, eve);
+ return editmesh_get_x_mirror_vert_topo(ob, eve, index);
} else {
- return editmesh_get_x_mirror_vert_spacial(ob, eve);
+ return editmesh_get_x_mirror_vert_spacial(ob, eve->co);
}
}
diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c
index a9cdd95a699..31a59601448 100644
--- a/source/blender/src/transform_conversions.c
+++ b/source/blender/src/transform_conversions.c
@@ -2168,7 +2168,7 @@ static void createTransEditVerts(TransInfo *t)
/* Mirror? */
if( (mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) {
- EditVert *vmir= editmesh_get_x_mirror_vert(G.obedit, eve); /* initializes octree on first call */
+ EditVert *vmir= editmesh_get_x_mirror_vert(G.obedit, eve, a); /* initializes octree on first call */
if(vmir != eve) tob->tdmir = vmir;
}
tob++;
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index 63eb3a328ee..4bba77e3e4b 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -337,6 +337,7 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
ketsjiengine->SetPythonDictionary(dictionaryobject);
initRasterizer(rasterizer, canvas);
PyObject *gameLogic = initGameLogic(startscene);
+ PyDict_SetItemString(dictionaryobject, "GameLogic", gameLogic); // Same as importing the module.
initGameKeys();
initPythonConstraintBinding();
@@ -404,7 +405,14 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
exitstring = ketsjiengine->GetExitString();
// when exiting the mainloop
- dictionaryClearByHand(gameLogic);
+
+ // Clears the dictionary by hand:
+ // This prevents, extra references to global variables
+ // inside the GameLogic dictionary when the python interpreter is finalized.
+ // which allows the scene to safely delete them :)
+ // see: (space.c)->start_game
+ PyDict_Clear(PyModule_GetDict(gameLogic));
+
ketsjiengine->StopEngine();
exitGamePythonScripting();
networkdevice->Disconnect();
@@ -596,6 +604,7 @@ extern "C" void StartKetsjiShellSimulation(struct ScrArea *area,
ketsjiengine->SetPythonDictionary(dictionaryobject);
initRasterizer(rasterizer, canvas);
PyObject *gameLogic = initGameLogic(startscene);
+ PyDict_SetItemString(dictionaryobject, "GameLogic", gameLogic); // Same as importing the module
initGameKeys();
initPythonConstraintBinding();
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index 76386079bdf..01ae4072335 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -116,7 +116,7 @@ CValue* SCA_PythonController::GetReplica()
void SCA_PythonController::SetScriptText(const STR_String& text)
{
- m_scriptText = "import GameLogic\n" + text;
+ m_scriptText = text;
m_bModified = true;
}
@@ -354,8 +354,10 @@ SCA_PythonController::PyGetSensor(PyObject* self, PyObject* value)
return sensor->AddRef();
}
}
-
- PyErr_SetString(PyExc_AttributeError, "Unable to find requested sensor");
+
+ char emsg[96];
+ PyOS_snprintf( emsg, sizeof( emsg ), "Unable to find requested sensor \"%s\"", scriptArg );
+ PyErr_SetString(PyExc_AttributeError, emsg);
return NULL;
}
@@ -382,8 +384,10 @@ SCA_PythonController::PyGetActuator(PyObject* self, PyObject* value)
return actua->AddRef();
}
}
-
- PyErr_SetString(PyExc_AttributeError, "Unable to find requested actuator");
+
+ char emsg[96];
+ PyOS_snprintf( emsg, sizeof( emsg ), "Unable to find requested actuator \"%s\"", scriptArg );
+ PyErr_SetString(PyExc_AttributeError, emsg);
return NULL;
}
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index 015d7473532..fa0bce53b1b 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -651,7 +651,7 @@ bool GPG_Application::startEngine(void)
PyObject* dictionaryobject = initGamePlayerPythonScripting("Ketsji", psl_Lowest);
m_ketsjiengine->SetPythonDictionary(dictionaryobject);
initRasterizer(m_rasterizer, m_canvas);
- PyObject *gameLogic = initGameLogic(startscene);
+ PyDict_SetItemString(dictionaryobject, "GameLogic", initGameLogic(startscene)); // Same as importing the module
initGameKeys();
initPythonConstraintBinding();
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 20187a193ba..db099d56b55 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -231,7 +231,10 @@ void KX_KetsjiEngine::SetRasterizer(RAS_IRasterizer* rasterizer)
}
-
+/*
+ * At the moment the GameLogic module is imported into 'pythondictionary' after this function is called.
+ * if this function ever changes to assign a copy, make sure the game logic module is imported into this dictionary before hand.
+ */
void KX_KetsjiEngine::SetPythonDictionary(PyObject* pythondictionary)
{
MT_assert(pythondictionary);
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 433e0636833..61ed8b6a8e4 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -828,20 +828,9 @@ PyObject* initGameLogic(KX_Scene* scene) // quick hack to get gravity hook
Py_FatalError("can't initialize module GameLogic");
}
- return d;
+ return m;
}
-void dictionaryClearByHand(PyObject *dict)
-{
- // Clears the dictionary by hand:
- // This prevents, extra references to global variables
- // inside the GameLogic dictionary when the python interpreter is finalized.
- // which allows the scene to safely delete them :)
- // see: (space.c)->start_game
- if(dict) PyDict_Clear(dict);
-}
-
-
// Python Sandbox code
// override builtin functions import() and open()
diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h
index c7d8f1b78bc..41cf7fd67b3 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.h
+++ b/source/gameengine/Ketsji/KX_PythonInit.h
@@ -47,7 +47,6 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
void exitGamePlayerPythonScripting();
PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level);
void exitGamePythonScripting();
-void dictionaryClearByHand(PyObject *dict);
void PHY_SetActiveScene(class KX_Scene* scene);
class KX_Scene* PHY_GetActiveScene();
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp
index 949156571a7..34a3baec093 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp
@@ -291,7 +291,8 @@ PyObject* KX_SoundActuator::PyGetFilename(PyObject* self, PyObject* args, PyObje
char* name = objectname.Ptr();
if (!name) {
- Py_Return; /* internal error */
+ PyErr_SetString(PyExc_RuntimeError, "Unable to get sound filename");
+ return NULL;
} else
return PyString_FromString(name);
}