Another merger of Orange branch with bf-blender, it has important fixes.

This commit is contained in:
2005-12-14 20:38:14 +00:00
6 changed files with 30 additions and 12 deletions

View File

@@ -1416,6 +1416,7 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose)
{ {
bPoseChannel *pchan; bPoseChannel *pchan;
bArmature *arm= ob->data; bArmature *arm= ob->data;
int rebuild= 0;
if (!pose) if (!pose)
return; return;
@@ -1424,6 +1425,12 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose)
// hurms... loop in a loop, but yah... later... (ton) // hurms... loop in a loop, but yah... later... (ton)
pchan->bone= get_named_bone(arm, pchan->name); pchan->bone= get_named_bone(arm, pchan->name);
pchan->custom= newlibadr(fd, arm->id.lib, pchan->custom); pchan->custom= newlibadr(fd, arm->id.lib, pchan->custom);
if(pchan->bone==NULL)
rebuild= 1;
}
if(rebuild) {
ob->recalc= OB_RECALC;
pose->flag |= POSE_RECALC;
} }
} }

View File

@@ -90,7 +90,7 @@ extern void countall(void);
static PyObject *g_nmeshmodule = NULL; static PyObject *g_nmeshmodule = NULL;
static int unlink_existingMeshData( Mesh * mesh ); static int unlink_existingMeshData( Mesh * mesh );
static int convert_NMeshToMesh( Mesh *mesh, BPy_NMesh *nmesh, int store_edges ); static int convert_NMeshToMesh( Mesh *mesh, BPy_NMesh *nmesh );
static void check_dverts(Mesh *me, int old_totverts); static void check_dverts(Mesh *me, int old_totverts);
static PyObject *NMesh_printDebug( PyObject * self ); static PyObject *NMesh_printDebug( PyObject * self );
static PyObject *NMesh_addEdge( PyObject * self, PyObject * args ); static PyObject *NMesh_addEdge( PyObject * self, PyObject * args );
@@ -1330,11 +1330,11 @@ static PyObject *NMesh_update( PyObject *self, PyObject *a, PyObject *kwd )
if( mesh ) { if( mesh ) {
old_totvert = mesh->totvert; old_totvert = mesh->totvert;
unlink_existingMeshData( mesh ); unlink_existingMeshData( mesh );
if( !convert_NMeshToMesh( mesh, nmesh, store_edges ) ) if( !convert_NMeshToMesh( mesh, nmesh ) )
return NULL; return NULL;
if (mesh->dvert) check_dverts(mesh, old_totvert); if (mesh->dvert) check_dverts(mesh, old_totvert);
} else { } else {
mesh = Mesh_fromNMesh( nmesh, store_edges ); mesh = Mesh_fromNMesh( nmesh );
/* if mesh is NULL, there was an error */ /* if mesh is NULL, there was an error */
if( !mesh ) if( !mesh )
return NULL; return NULL;
@@ -1461,7 +1461,7 @@ static PyObject *NMesh_getVertexInfluences( PyObject * self, PyObject * args )
return influence_list; return influence_list;
} }
Mesh *Mesh_fromNMesh( BPy_NMesh * nmesh , int store_edges ) Mesh *Mesh_fromNMesh( BPy_NMesh * nmesh )
{ {
Mesh *mesh = NULL; Mesh *mesh = NULL;
@@ -1476,7 +1476,7 @@ Mesh *Mesh_fromNMesh( BPy_NMesh * nmesh , int store_edges )
mesh->id.us = 0; /* no user yet */ mesh->id.us = 0; /* no user yet */
G.totmesh++; G.totmesh++;
if( !convert_NMeshToMesh( mesh, nmesh, store_edges ) ) if( !convert_NMeshToMesh( mesh, nmesh ) )
return NULL; return NULL;
return mesh; return mesh;
@@ -2890,6 +2890,14 @@ static void fill_medge_from_nmesh(Mesh * mesh, BPy_NMesh * nmesh)
} }
} }
/* tot_valid_faces_edges < 0 causes a sigsegv crash, so we
* clamp to prevent it
* (this is related to faces (correctly) requiring at least 3 verts now,
* which can break old scripts -- maybe we should also warn about the
* 'broken' mesh the user created, but for now, until we investigate
* better, this should do) */
if (tot_valid_faces_edges < 0) tot_valid_faces_edges = 0;
/* Now we have the total count of valid edges */ /* Now we have the total count of valid edges */
mesh->totedge=tot_valid_nmedges+tot_valid_faces_edges; mesh->totedge=tot_valid_nmedges+tot_valid_faces_edges;
mesh->medge=MEM_callocN(mesh->totedge*sizeof(MEdge), "make mesh edges"); mesh->medge=MEM_callocN(mesh->totedge*sizeof(MEdge), "make mesh edges");
@@ -2955,7 +2963,7 @@ static void check_dverts(Mesh *me, int old_totvert)
return; return;
} }
static int convert_NMeshToMesh( Mesh * mesh, BPy_NMesh * nmesh, int store_edges) static int convert_NMeshToMesh( Mesh * mesh, BPy_NMesh * nmesh)
{ {
MFace *newmf; MFace *newmf;
TFace *newtf; TFace *newtf;
@@ -3183,7 +3191,7 @@ static PyObject *M_NMesh_PutRaw( PyObject * self, PyObject * args )
old_totvert = mesh->totvert; old_totvert = mesh->totvert;
unlink_existingMeshData( mesh ); unlink_existingMeshData( mesh );
if( !convert_NMeshToMesh( mesh, nmesh, store_edges ) ) if( !convert_NMeshToMesh( mesh, nmesh ) )
return NULL; return NULL;
nmesh->mesh = mesh; nmesh->mesh = mesh;
@@ -3414,7 +3422,7 @@ Mesh *NMesh_FromPyObject( PyObject * pyobj, Object * ob )
if( nmesh->mesh ) { if( nmesh->mesh ) {
mesh = nmesh->mesh; mesh = nmesh->mesh;
} else { } else {
mesh = Mesh_fromNMesh( nmesh, 1 ); mesh = Mesh_fromNMesh( nmesh );
if( !mesh ) /* NULL means an PyError */ if( !mesh ) /* NULL means an PyError */
return NULL; return NULL;

View File

@@ -145,7 +145,7 @@ int NMesh_CheckPyObject( PyObject * pyobj );
void mesh_update( Mesh * mesh , Object * ob ); void mesh_update( Mesh * mesh , Object * ob );
PyObject *new_NMesh( Mesh * oldmesh ); PyObject *new_NMesh( Mesh * oldmesh );
Mesh *Mesh_fromNMesh( BPy_NMesh * nmesh , int store_edges ); Mesh *Mesh_fromNMesh( BPy_NMesh * nmesh );
PyObject *NMesh_assignMaterials_toObject( BPy_NMesh * nmesh, Object * ob ); PyObject *NMesh_assignMaterials_toObject( BPy_NMesh * nmesh, Object * ob );
Material **nmesh_updateMaterials( BPy_NMesh * nmesh ); Material **nmesh_updateMaterials( BPy_NMesh * nmesh );
Material **newMaterialList_fromPyList( PyObject * list ); Material **newMaterialList_fromPyList( PyObject * list );

View File

@@ -188,7 +188,7 @@ def PutRaw(nmesh, name = None, recalc_normals = 1, store_edges = 0):
this nmesh data. It can be an existing mesh data object or a new one. this nmesh data. It can be an existing mesh data object or a new one.
@param recalc_normals: If non-zero, the vertex normals for the mesh will @param recalc_normals: If non-zero, the vertex normals for the mesh will
be recalculated. be recalculated.
@param store_edges: if non-zero, the edges data are stored @param store_edges: deprecated, edges are always stored now.
@rtype: None or Object @rtype: None or Object
@return: It depends on the 'name' parameter: @return: It depends on the 'name' parameter:
- I{name} refers to an existing mesh data obj already linked to an - I{name} refers to an existing mesh data obj already linked to an
@@ -587,7 +587,7 @@ class NMesh:
@type recalc_normals: int (bool) @type recalc_normals: int (bool)
@param recalc_normals: if nonzero the vertex normals are recalculated. @param recalc_normals: if nonzero the vertex normals are recalculated.
@type store_edges: int (bool) @type store_edges: int (bool)
@param store_edges: if nonzero, then edge data is stored. @param store_edges: deprecated, edges are always stored now.
@type vertex_shade: int (bool) @type vertex_shade: int (bool)
@param vertex_shade: if nonzero vertices are colored based on the @param vertex_shade: if nonzero vertices are colored based on the
current lighting setup, like when there are no vertex colors and no current lighting setup, like when there are no vertex colors and no

View File

@@ -983,7 +983,7 @@ void delete_nlachannel_keys(void)
bConstraintChannel *conchan; bConstraintChannel *conchan;
bActionStrip *strip, *nextstrip; bActionStrip *strip, *nextstrip;
if (!okee("Erase selected keys")) if (!okee("Erase selected strips and/or keys"))
return; return;
for (base = G.scene->base.first; base; base=base->next){ for (base = G.scene->base.first; base; base=base->next){

View File

@@ -157,6 +157,9 @@ void do_layer_buttons(short event)
if(G.vd->scenelock) handle_view3d_lock(); if(G.vd->scenelock) handle_view3d_lock();
scrarea_queue_winredraw(curarea); scrarea_queue_winredraw(curarea);
/* new layers might need unflushed events events */
DAG_scene_update_flags(G.scene, G.vd->lay); // tags all that moves and flushes
} }
else { else {
if(G.qual & LR_ALTKEY) { if(G.qual & LR_ALTKEY) {