branches/blender-2.47

Merge from trunk:
	Revision: 15756
	Revision: 15758
	Revision: 15766
	Revision: 15768
	Revision: 15769
	Revision: 15772 (Only constraint mesh-targets)
	Revision: 15775
	Revision: 15776
	Revision: 15787
	Revision: 15803
	Revision: 15805
This commit is contained in:
Diego Borghetti 2008-07-28 02:05:44 +00:00
parent 0fb061025c
commit 74ba250afe
12 changed files with 96 additions and 30 deletions

View File

@ -1,4 +1,3 @@
/**
* $Id$
*
@ -355,7 +354,8 @@ TimeMarker *get_frame_marker(int frame){return 0;};
/* editseq.c */
Sequence *get_forground_frame_seq(int frame){return 0;};
void set_last_seq(Sequence *seq){};
void clear_last_seq(Sequence *seq){};
/* modifier.c stub */
void harmonic_coordinates_bind(struct MeshDeformModifierData *mmd,

View File

@ -558,8 +558,8 @@ static void contarget_get_mesh_mat (Object *ob, char *substring, float mat[][4])
if (dgroup < 0) return;
/* get DerivedMesh */
if (G.obedit && G.editMesh) {
/* we are in editmode, so get a special derived mesh */
if ((G.obedit == ob) && (G.editMesh)) {
/* target is in editmode, so get a special derived mesh */
dm = CDDM_from_editmesh(G.editMesh, ob->data);
}
else {

View File

@ -2536,11 +2536,6 @@ int IsectPQ2Df(float pt[2], float v1[2], float v2[2], float v3[2], float v4[2])
}
/* copied from Geometry.c - todo - move to arithb.c or some other generic place we can reuse */
#define SIDE_OF_LINE(pa,pb,pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1]))
#define POINT_IN_TRI(p0,p1,p2,p3) ((SIDE_OF_LINE(p1,p2,p0)>=0) && (SIDE_OF_LINE(p2,p3,p0)>=0) && (SIDE_OF_LINE(p3,p1,p0)>=0))
/**
*
* @param min

View File

@ -375,11 +375,13 @@ typedef enum B_CONSTRAINT_SPACETYPES {
/* for objects (relative to parent/without parent influence),
* for bones (along normals of bone, without parent/restpositions)
*/
CONSTRAINT_SPACE_LOCAL,
CONSTRAINT_SPACE_LOCAL, /* = 1 */
/* for posechannels - pose space */
CONSTRAINT_SPACE_POSE,
/* for posechannels - local with parent */
CONSTRAINT_SPACE_PARLOCAL,
CONSTRAINT_SPACE_POSE, /* = 2 */
/* for posechannels - local with parent */
CONSTRAINT_SPACE_PARLOCAL, /* = 3 */
/* for files from between 2.43-2.46 (should have been parlocal) */
CONSTRAINT_SPACE_INVALID, /* = 4. do not exchange for anything! */
} B_CONSTRAINT_SPACETYPES;
/* bConstraintChannel.flag */

View File

@ -417,12 +417,14 @@ void BPY_rebuild_syspath( void )
mod = PyImport_ImportModule( "sys" );
if (!mod) {
printf("error: could not import python sys module. some modules may not import.\n");
PyGILState_Release(gilstate);
return;
}
if (!bpy_orig_syspath_List) { /* should never happen */
printf("error refershing python path\n");
Py_DECREF(mod);
PyGILState_Release(gilstate);
return;
}

View File

@ -56,6 +56,7 @@ struct View3D; /* keep me up here */
#include "gen_utils.h"
#include "gen_library.h"
#include "../BPY_extern.h" /* for BPY_do_all_scripts() */
#include "Scene.h"
#include "Group.h"
@ -469,19 +470,20 @@ PyObject *M_Render_EnableDispWin( PyObject * self )
PyObject *RenderData_Render( BPy_RenderData * self )
{
Scene *oldsce;
/* unlock to prevent a deadlock when there are pynodes: */
PyThreadState *tstate = NULL;
if (!G.background) {
oldsce = G.scene;
set_scene( self->scene );
tstate = PyEval_SaveThread();
BIF_do_render( 0 );
set_scene( oldsce );
}
else { /* background mode (blender -b file.blend -P script) */
int slink_flag = 0;
Render *re= RE_NewRender(G.scene->id.name);
int end_frame = G.scene->r.efra;
if (G.scene != self->scene)
@ -490,11 +492,25 @@ PyObject *RenderData_Render( BPy_RenderData * self )
G.scene->r.efra = G.scene->r.sfra;
if (G.f & G_DOSCRIPTLINKS) {
BPY_do_all_scripts(SCRIPT_RENDER);
G.f &= ~G_DOSCRIPTLINKS; /* avoid FRAMECHANGED events*/
slink_flag = 1;
}
tstate = PyEval_SaveThread();
RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
if (slink_flag) {
G.f |= G_DOSCRIPTLINKS;
BPY_do_all_scripts(SCRIPT_POSTRENDER);
}
G.scene->r.efra = end_frame;
}
PyEval_RestoreThread(tstate);
Py_RETURN_NONE;
}
@ -565,10 +581,13 @@ PyObject *RenderData_SaveRenderedImage ( BPy_RenderData * self, PyObject *args )
PyObject *RenderData_RenderAnim( BPy_RenderData * self )
{
Scene *oldsce;
/* unlock to prevent a deadlock when there are pynodes: */
PyThreadState *tstate = NULL;
if (!G.background) {
oldsce = G.scene;
set_scene( self->scene );
tstate = PyEval_SaveThread();
BIF_do_render( 1 );
set_scene( oldsce );
}
@ -582,9 +601,18 @@ PyObject *RenderData_RenderAnim( BPy_RenderData * self )
if (G.scene->r.sfra > G.scene->r.efra)
return EXPP_ReturnPyObjError (PyExc_RuntimeError,
"start frame must be less or equal to end frame");
if (G.f & G_DOSCRIPTLINKS)
BPY_do_all_scripts(SCRIPT_RENDER);
tstate = PyEval_SaveThread();
RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
if (G.f & G_DOSCRIPTLINKS)
BPY_do_all_scripts(SCRIPT_POSTRENDER);
}
PyEval_RestoreThread(tstate);
Py_RETURN_NONE;
}

View File

@ -480,7 +480,7 @@ static void draw_constraint_spaceselect (uiBlock *block, bConstraint *con, short
/* Target-Space */
if (target == 1) {
uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Target Space %t|World Space %x0|Pose Space %x3|Local with Parent %x4|Local Space %x1",
uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Target Space %t|World Space %x0|Pose Space %x2|Local with Parent %x3|Local Space %x1",
tarx, yco, bwidth, 18, &con->tarspace, 0, 0, 0, 0, "Choose space that target is evaluated in");
}
else if (target == 0) {
@ -490,7 +490,7 @@ static void draw_constraint_spaceselect (uiBlock *block, bConstraint *con, short
/* Owner-Space */
if (owner == 1) {
uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Owner Space %t|World Space %x0|Pose Space %x3|Local with Parent %x4|Local Space %x1",
uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Owner Space %t|World Space %x0|Pose Space %x2|Local with Parent %x3|Local Space %x1",
ownx, yco, bwidth, 18, &con->ownspace, 0, 0, 0, 0, "Choose space that owner is evaluated in");
}
else if (owner == 0) {

View File

@ -532,7 +532,7 @@ static int ui_but_copy_paste(uiBut *but, char mode)
/* give butfunc the original text too */
/* feature used for bone renaming, channels, etc */
if(but->func_arg2==NULL) {
strncpy(backstr, but->drawstr, UI_MAX_DRAW_STR);
strncpy(backstr, but->poin, UI_MAX_DRAW_STR);
but->func_arg2= backstr;
}
strncpy(but->poin, but_copypaste_str, but->max);

View File

@ -1470,8 +1470,8 @@ static void input_preprocess(Sequence * seq, TStripElem* se, int cfra)
dy = sy;
if (seq->flag & SEQ_USE_TRANSFORM) {
dx = seqrectx;
dy = seqrecty;
dx = G.scene->r.xsch;
dy = G.scene->r.ysch;
}
if (c.top + c.bottom >= se->ibuf->y ||

View File

@ -618,8 +618,23 @@ int main(int argc, char **argv)
if (G.scene) {
if (a < argc) {
int frame= MIN2(MAXFRAME, MAX2(1, atoi(argv[a])));
int slink_flag= 0;
Render *re= RE_NewRender(G.scene->id.name);
if (G.f & G_DOSCRIPTLINKS) {
BPY_do_all_scripts(SCRIPT_RENDER);
/* avoid FRAMECHANGED slink event
* (should only be triggered in anims): */
G.f &= ~G_DOSCRIPTLINKS;
slink_flag= 1;
}
RE_BlenderAnim(re, G.scene, frame, frame);
if (slink_flag) {
G.f |= G_DOSCRIPTLINKS;
BPY_do_all_scripts(SCRIPT_POSTRENDER);
}
}
} else {
printf("\nError: no blend loaded. cannot use '-f'.\n");
@ -628,7 +643,14 @@ int main(int argc, char **argv)
case 'a':
if (G.scene) {
Render *re= RE_NewRender(G.scene->id.name);
if (G.f & G_DOSCRIPTLINKS)
BPY_do_all_scripts(SCRIPT_RENDER);
RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
if (G.f & G_DOSCRIPTLINKS)
BPY_do_all_scripts(SCRIPT_POSTRENDER);
} else {
printf("\nError: no blend loaded. cannot use '-a'.\n");
}

View File

@ -84,7 +84,10 @@ bool PyMatTo(PyObject* pymat, T& mat)
}
} else
noerror = false;
if (noerror==false)
PyErr_SetString(PyExc_TypeError, "could not be converted to a matrix (sequence of sequences)");
return noerror;
}
@ -97,9 +100,13 @@ bool PyVecTo(PyObject* pyval, T& vec)
if (PySequence_Check(pyval))
{
unsigned int numitems = PySequence_Size(pyval);
if (numitems != Size(vec))
if (numitems != Size(vec)) {
char err[128];
sprintf(err, "error setting vector, %d args, should be %d", numitems, Size(vec));
PyErr_SetString(PyExc_AttributeError, err);
return false;
}
for (unsigned int x = 0; x < numitems; x++)
{
PyObject *item = PySequence_GetItem(pyval, x); /* new ref */
@ -107,7 +114,17 @@ bool PyVecTo(PyObject* pyval, T& vec)
Py_DECREF(item);
}
if (PyErr_Occurred()) {
PyErr_SetString(PyExc_AttributeError, "one or more of the items in the sequence was not a float");
return false;
}
return true;
} else
{
char err[128];
sprintf(err, "not a sequence type, expected a sequence of numbers size %d", Size(vec));
PyErr_SetString(PyExc_AttributeError, err);
}
return false;

View File

@ -146,19 +146,19 @@ void compatible_eulFast(float *eul, float *oldrot)
{
float dx, dy, dz;
/* verschillen van ong 360 graden corrigeren */
/* angular difference of 360 degrees */
dx= eul[0] - oldrot[0];
dy= eul[1] - oldrot[1];
dz= eul[2] - oldrot[2];
if( fabs(dx) > 5.1) {
if( fabs(dx) > MT_PI) {
if(dx > 0.0) eul[0] -= MT_2_PI; else eul[0]+= MT_2_PI;
}
if( fabs(dy) > 5.1) {
if( fabs(dy) > MT_PI) {
if(dy > 0.0) eul[1] -= MT_2_PI; else eul[1]+= MT_2_PI;
}
if( fabs(dz) > 5.1 ) {
if( fabs(dz) > MT_PI ) {
if(dz > 0.0) eul[2] -= MT_2_PI; else eul[2]+= MT_2_PI;
}
}