miscellaneous edits from python development branch merged back into trunk

This commit is contained in:
Campbell Barton
2007-12-07 09:51:02 +00:00
parent ab02e9140e
commit 9723e3ef39
7 changed files with 23 additions and 34 deletions

View File

@@ -1078,8 +1078,6 @@ static int bpy_pydriver_create_dict(void)
PyDict_SetItemString(d, "m", mod);
Py_DECREF(mod);
}
mod = PyImport_ImportModule("Blender.Noise");
if (mod) {
@@ -1111,7 +1109,8 @@ static int bpy_pydriver_create_dict(void)
Py_DECREF(fcn);
}
}
/* TODO - change these */
/* me(meshname) == Blender.Mesh.Get(meshname) */
mod = PyImport_ImportModule("Blender.Mesh");
if (mod) {
@@ -1316,7 +1315,7 @@ void BPY_pyconstraint_eval(bPythonConstraint *con, bConstraintOb *cob, ListBase
tarmats= PyList_New(con->tarnum);
for (ct=targets->first, index=0; ct; ct=ct->next, index++) {
tarmat = newMatrixObject((float *)ct->matrix, 4, 4, Py_NEW);
PyList_SetItem(tarmats, index, tarmat);
PyList_SET_ITEM(tarmats, index, tarmat);
}
@@ -1717,7 +1716,7 @@ struct Object **BPY_pydriver_get_objects(IpoDriver *driver)
float BPY_pydriver_eval(IpoDriver *driver)
{
char *expr = NULL;
PyObject *retval, *floatval, *bpy_ob = NULL;
PyObject *retval, *bpy_ob = NULL;
float result = 0.0f; /* default return */
int setitem_retval;
@@ -1755,15 +1754,11 @@ float BPY_pydriver_eval(IpoDriver *driver)
return pydriver_error(driver);
}
floatval = PyNumber_Float(retval);
Py_DECREF(retval);
if (floatval == NULL)
result = ( float )PyFloat_AsDouble( retval );
if (result == -1 && PyErr_Occurred())
return pydriver_error(driver);
result = (float)PyFloat_AsDouble(floatval);
Py_DECREF(floatval);
/* remove 'self', since this dict is also used by py buttons */
if (setitem_retval == 0) PyDict_DelItemString(bpy_pydriver_Dict, "self");
@@ -1970,13 +1965,11 @@ void BPY_do_pyscript( ID * id, short event )
disable_where_scriptlink( (short)during_slink );
/* set globals in Blender module to identify scriptlink */
EXPP_dict_set_item_str( g_blenderdict, "bylink", EXPP_incr_ret_True() );
PyDict_SetItemString( g_blenderdict, "bylink", Py_True);
EXPP_dict_set_item_str( g_blenderdict, "link", value );
EXPP_dict_set_item_str( g_blenderdict, "event",
PyString_FromString( event_to_name
( event ) ) );
if (event == SCRIPT_POSTRENDER) event = SCRIPT_RENDER;
for( index = 0; index < scriptlink->totscript; index++ ) {
@@ -2012,10 +2005,9 @@ void BPY_do_pyscript( ID * id, short event )
/* cleanup bylink flag and clear link so PyObject
* can be released
*/
EXPP_dict_set_item_str( g_blenderdict, "bylink", EXPP_incr_ret_False() );
PyDict_SetItemString(g_blenderdict, "bylink", Py_False);
PyDict_SetItemString( g_blenderdict, "link", Py_None );
EXPP_dict_set_item_str( g_blenderdict, "event",
PyString_FromString( "" ) );
EXPP_dict_set_item_str( g_blenderdict, "event", PyString_FromString( "" ) );
}
}
@@ -2196,12 +2188,11 @@ int BPY_do_spacehandlers( ScrArea *sa, unsigned short event,
}
/* set globals in Blender module to identify space handler scriptlink */
EXPP_dict_set_item_str(g_blenderdict, "bylink", EXPP_incr_ret_True());
PyDict_SetItemString(g_blenderdict, "bylink", Py_True);
/* unlike normal scriptlinks, here Blender.link is int (space event type) */
EXPP_dict_set_item_str(g_blenderdict, "link", PyInt_FromLong(space_event));
/* note: DRAW space_events set event to 0 */
EXPP_dict_set_item_str(g_blenderdict, "event", PyInt_FromLong(event));
/* now run all assigned space handlers for this space and space_event */
for( index = 0; index < scriptlink->totscript; index++ ) {
@@ -2256,7 +2247,7 @@ int BPY_do_spacehandlers( ScrArea *sa, unsigned short event,
}
EXPP_dict_set_item_str(g_blenderdict, "bylink", EXPP_incr_ret_False());
PyDict_SetItemString(g_blenderdict, "bylink", Py_False);
PyDict_SetItemString(g_blenderdict, "link", Py_None );
EXPP_dict_set_item_str(g_blenderdict, "event", PyString_FromString(""));
}

View File

@@ -882,9 +882,9 @@ AttributeError:
static PyObject *Armature_getVertexGroups(BPy_Armature *self, void *closure)
{
if (self->armature->deformflag & ARM_DEF_VGROUP)
return EXPP_incr_ret(Py_True);
Py_RETURN_TRUE;
else
return EXPP_incr_ret(Py_False);
Py_RETURN_FALSE;
}
//------------------------Armature.vertexGroups (setter)
static int Armature_setVertexGroups(BPy_Armature *self, PyObject *value, void *closure)

View File

@@ -776,9 +776,9 @@ static PyObject *CurNurb_isNurb( BPy_CurNurb * self )
*/
if( self->nurb->bp ) {
return EXPP_incr_ret_True();
Py_RETURN_TRUE;
} else {
return EXPP_incr_ret_False();
Py_RETURN_FALSE;
}
}
@@ -792,9 +792,9 @@ static PyObject *CurNurb_isCyclic( BPy_CurNurb * self )
/* supposing that the flagu is always set */
if( self->nurb->flagu & CU_CYCLIC ) {
return EXPP_incr_ret_True();
Py_RETURN_TRUE;
} else {
return EXPP_incr_ret_False();
Py_RETURN_FALSE;
}
}

View File

@@ -197,7 +197,6 @@ static char M_Window_EditMode_doc[] =
Returns the current status. This function is mostly useful to leave\n\
edit mode before applying changes to a mesh (otherwise the changes will\n\
be lost) and then returning to it upon leaving.";
static char M_Window_PoseMode_doc[] =
"() - Get the current status -- 0: not in pose mode; 1: in edit mode";
@@ -1508,8 +1507,7 @@ static PyObject *M_Window_SetPivot( PyObject * self, PyObject * value)
G.vd->around = pivot;
}
Py_RETURN_NONE;
}
}
/*****************************************************************************/

View File

@@ -293,11 +293,11 @@ class RenderData:
@type oversampling: boolean
@ivar fps: Frames per second.
Values are clamped to the range [1,120].
@ivar fps_base: Frames per second base: used to generate fractional frames
@ivar fpsBase: Frames per second base: used to generate fractional frames
per second values. For example, setting fps to 30 and fps_base to 1.001
will approximate the NTSC frame rate of 29.97 fps.
Values are clamped to the range [1,120].
@type fps_base: float
@type fpsBase: float
@ivar timeCode: Get the current frame in HH:MM:SS:FF format. Read-only.
@type timeCode: string
@ivar environmentMap: Environment map rendering enabled.

View File

@@ -2566,7 +2566,7 @@ static PyGetSetDef BPy_RenderData_getseters[] = {
(getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp,
"Frames per second",
(void *)EXPP_RENDER_ATTR_FPS},
{"fps_base",
{"fpsBase",
(getter)RenderData_getFloatAttr, (setter)RenderData_setFloatAttrClamp,
"Frames per second base",
(void *)EXPP_RENDER_ATTR_FPS_BASE},

View File

@@ -569,7 +569,7 @@ static PyObject *getIntAttr( BPy_Sequence *self, void *type )
break;
default:
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"undefined type in getFloatAttr" );
"undefined type in getIntAttr" );
}
return PyInt_FromLong( param );