soc-2008-mxcurioni: merged changes to revision 14747, cosmetic changes for source/blender/freestyle
This commit is contained in:
@@ -246,7 +246,8 @@ static PyObject *Blender_Set( PyObject * self, PyObject * args )
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"expected an integer" );
|
||||
|
||||
G.scene->r.cfra = (short)PyInt_AsLong( arg ) ;
|
||||
G.scene->r.cfra = (int)PyInt_AsLong( arg ) ;
|
||||
CLAMP(G.scene->r.cfra, 1, MAXFRAME);
|
||||
|
||||
/* update all objects, so python scripts can export all objects
|
||||
in a scene without worrying about the view layers */
|
||||
@@ -545,8 +546,12 @@ static PyObject *Blender_Get( PyObject * self, PyObject * value )
|
||||
else if(StringEqual( str, "compressfile" ))
|
||||
ret = PyInt_FromLong( (U.flag & USER_FILECOMPRESS) >> 15 );
|
||||
else if(StringEqual( str, "mipmap" ))
|
||||
ret = PyInt_FromLong( (U.gameflags & USER_DISABLE_MIPMAP) == 0 );
|
||||
else
|
||||
ret = PyInt_FromLong( (U.gameflags & USER_DISABLE_MIPMAP)!=0 );
|
||||
else if(StringEqual( str, "add_view_align" ))
|
||||
ret = PyInt_FromLong( ((U.flag & USER_ADD_VIEWALIGNED)!=0) );
|
||||
else if(StringEqual( str, "add_editmode" ))
|
||||
ret = PyInt_FromLong( ((U.flag & USER_ADD_EDITMODE)!=0) );
|
||||
else
|
||||
return EXPP_ReturnPyObjError( PyExc_AttributeError, "unknown attribute" );
|
||||
|
||||
if (ret) return ret;
|
||||
|
||||
@@ -128,6 +128,14 @@
|
||||
#define EXPP_MAT_FRESNELMIRR_MAX 5.0
|
||||
#define EXPP_MAT_FRESNELMIRRFAC_MIN 1.0
|
||||
#define EXPP_MAT_FRESNELMIRRFAC_MAX 5.0
|
||||
#define EXPP_MAT_RAYMIRRGLOSS_MIN 0.0
|
||||
#define EXPP_MAT_RAYMIRRGLOSS_MAX 1.0
|
||||
#define EXPP_MAT_RAYMIRRGLOSSSAMPLES_MIN 0
|
||||
#define EXPP_MAT_RAYMIRRGLOSSSAMPLES_MAX 255
|
||||
#define EXPP_MAT_RAYTRANSPGLOSS_MIN 0.0
|
||||
#define EXPP_MAT_RAYTRANSPGLOSS_MAX 1.0
|
||||
#define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MIN 0
|
||||
#define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MAX 255
|
||||
#define EXPP_MAT_FILTER_MIN 0.0
|
||||
#define EXPP_MAT_FILTER_MAX 1.0
|
||||
#define EXPP_MAT_TRANSLUCENCY_MIN 0.0
|
||||
@@ -516,6 +524,10 @@ static int Material_setIOR( BPy_Material * self, PyObject * value );
|
||||
static int Material_setTransDepth( BPy_Material * self, PyObject * value );
|
||||
static int Material_setFresnelTrans( BPy_Material * self, PyObject * value );
|
||||
static int Material_setFresnelTransFac( BPy_Material * self, PyObject * value );
|
||||
static int Material_setGlossMirr( BPy_Material * self, PyObject * value );
|
||||
static int Material_setGlossMirrSamples( BPy_Material * self, PyObject * value );
|
||||
static int Material_setGlossTrans( BPy_Material * self, PyObject * value );
|
||||
static int Material_setGlossTransSamples( BPy_Material * self, PyObject * value );
|
||||
static int Material_setRigidBodyFriction( BPy_Material * self, PyObject * value );
|
||||
static int Material_setRigidBodyRestitution( BPy_Material * self, PyObject * value );
|
||||
|
||||
@@ -600,6 +612,10 @@ static PyObject *Material_getIOR( BPy_Material * self );
|
||||
static PyObject *Material_getTransDepth( BPy_Material * self );
|
||||
static PyObject *Material_getFresnelTrans( BPy_Material * self );
|
||||
static PyObject *Material_getFresnelTransFac( BPy_Material * self );
|
||||
static PyObject *Material_getGlossMirr( BPy_Material * self );
|
||||
static PyObject *Material_getGlossMirrSamples( BPy_Material * self );
|
||||
static PyObject *Material_getGlossTrans( BPy_Material * self );
|
||||
static PyObject *Material_getGlossTransSamples( BPy_Material * self );
|
||||
static PyObject *Material_getRigidBodyFriction( BPy_Material * self );
|
||||
static PyObject *Material_getRigidBodyRestitution( BPy_Material * self );
|
||||
|
||||
@@ -720,6 +736,10 @@ static PyMethodDef BPy_Material_methods[] = {
|
||||
"() - Return fresnel power for refractions"},
|
||||
{"getFresnelMirrFac", ( PyCFunction ) Material_getFresnelMirrFac, METH_NOARGS,
|
||||
"() - Return fresnel power for refractions factor"},
|
||||
{"getRayTransGloss", ( PyCFunction ) Material_getGlossTrans, METH_NOARGS,
|
||||
"() - Return amount refraction glossiness"},
|
||||
{"getRayMirrGlossSamples", ( PyCFunction ) Material_getGlossMirrSamples, METH_NOARGS,
|
||||
"() - Return amount mirror glossiness"},
|
||||
{"getFilter", ( PyCFunction ) Material_getFilter, METH_NOARGS,
|
||||
"() - Return the amount of filtering when transparent raytrace is enabled"},
|
||||
{"getTranslucency", ( PyCFunction ) Material_getTranslucency, METH_NOARGS,
|
||||
@@ -825,6 +845,10 @@ static PyMethodDef BPy_Material_methods[] = {
|
||||
"(f) - Set fresnel power for mirror - [0.0, 5.0]"},
|
||||
{"setFresnelMirrFac", ( PyCFunction ) Matr_oldsetFresnelMirrFac, METH_VARARGS,
|
||||
"(f) - Set blend fac for mirror fresnel - [1.0, 5.0]"},
|
||||
{"setRayTransGloss", ( PyCFunction ) Material_setGlossTrans, METH_VARARGS,
|
||||
"(f) - Set amount refraction glossiness - [0.0, 1.0]"},
|
||||
{"setRayMirrGlossSamples", ( PyCFunction ) Material_setGlossMirrSamples, METH_VARARGS,
|
||||
"(f) - Set amount mirror glossiness - [0.0, 1.0]"},
|
||||
{"setFilter", ( PyCFunction ) Matr_oldsetFilter, METH_VARARGS,
|
||||
"(f) - Set the amount of filtering when transparent raytrace is enabled"},
|
||||
{"setTranslucency", ( PyCFunction ) Matr_oldsetTranslucency, METH_VARARGS,
|
||||
@@ -1030,6 +1054,22 @@ static PyGetSetDef BPy_Material_getseters[] = {
|
||||
(getter)Material_getRefracIndex, (setter)Material_setRefracIndex,
|
||||
"Material's Index of Refraction (applies to the \"Blinn\" Specular Shader only",
|
||||
NULL},
|
||||
{"glossMir",
|
||||
(getter)Material_getGlossMirr, (setter)Material_setGlossMirr,
|
||||
"Reflection glossiness",
|
||||
NULL},
|
||||
{"sampGlossMir",
|
||||
(getter)Material_getGlossMirrSamples, (setter)Material_setGlossMirrSamples,
|
||||
"Reflection glossiness",
|
||||
NULL},
|
||||
{"glossTra",
|
||||
(getter)Material_getGlossTrans, (setter)Material_setGlossTrans,
|
||||
"Refraction glossiness",
|
||||
NULL},
|
||||
{"sampGlossTra",
|
||||
(getter)Material_getGlossMirrSamples, (setter)Material_setGlossMirrSamples,
|
||||
"Refraction glossiness",
|
||||
NULL},
|
||||
{"rgbCol",
|
||||
(getter)Material_getRGBCol, (setter)Material_setRGBCol,
|
||||
"Diffuse RGB color triplet",
|
||||
@@ -1578,6 +1618,26 @@ static PyObject *Material_getFresnelTransFac( BPy_Material * self )
|
||||
return PyFloat_FromDouble( ( double ) self->material->fresnel_tra_i );
|
||||
}
|
||||
|
||||
static PyObject *Material_getGlossMirr( BPy_Material * self )
|
||||
{
|
||||
return PyFloat_FromDouble( ( double ) self->material->gloss_mir );
|
||||
}
|
||||
|
||||
static PyObject *Material_getGlossMirrSamples( BPy_Material * self )
|
||||
{
|
||||
return PyInt_FromLong( ( long ) self->material->samp_gloss_mir );
|
||||
}
|
||||
|
||||
static PyObject *Material_getGlossTrans( BPy_Material * self )
|
||||
{
|
||||
return PyFloat_FromDouble( ( double ) self->material->gloss_tra );
|
||||
}
|
||||
|
||||
static PyObject *Material_getGlossTransSamples( BPy_Material * self )
|
||||
{
|
||||
return PyInt_FromLong( ( long ) self->material->samp_gloss_tra );
|
||||
}
|
||||
|
||||
static PyObject* Material_getRigidBodyFriction( BPy_Material * self )
|
||||
{
|
||||
return PyFloat_FromDouble( ( double ) self->material->friction );
|
||||
@@ -2058,6 +2118,34 @@ static int Material_setFresnelTransFac( BPy_Material * self, PyObject * value )
|
||||
EXPP_MAT_FRESNELTRANSFAC_MAX );
|
||||
}
|
||||
|
||||
static int Material_setGlossMirr( BPy_Material * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setFloatClamped ( value, &self->material->gloss_mir,
|
||||
EXPP_MAT_RAYMIRRGLOSS_MIN,
|
||||
EXPP_MAT_RAYMIRRGLOSS_MAX );
|
||||
}
|
||||
|
||||
static int Material_setGlossMirrSamples( BPy_Material * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setIValueClamped ( value, &self->material->samp_gloss_mir,
|
||||
EXPP_MAT_RAYMIRRGLOSSSAMPLES_MIN,
|
||||
EXPP_MAT_RAYMIRRGLOSSSAMPLES_MAX, 'h' );
|
||||
}
|
||||
|
||||
static int Material_setGlossTrans( BPy_Material * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setFloatClamped ( value, &self->material->gloss_tra,
|
||||
EXPP_MAT_RAYTRANSPGLOSS_MIN,
|
||||
EXPP_MAT_RAYTRANSPGLOSS_MAX );
|
||||
}
|
||||
|
||||
static int Material_setGlossTransSamples( BPy_Material * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setIValueClamped ( value, &self->material->samp_gloss_tra,
|
||||
EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MIN,
|
||||
EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MAX, 'h' );
|
||||
}
|
||||
|
||||
static int Material_setRigidBodyFriction( BPy_Material * self, PyObject * value )
|
||||
{
|
||||
return EXPP_setFloatClamped ( value, &self->material->friction,
|
||||
|
||||
@@ -58,6 +58,7 @@ static PyObject *M_sys_exists( PyObject * self, PyObject * value );
|
||||
static PyObject *M_sys_time( PyObject * self );
|
||||
static PyObject *M_sys_sleep( PyObject * self, PyObject * args );
|
||||
static PyObject *M_sys_expandpath( PyObject *self, PyObject *value);
|
||||
static PyObject *M_sys_cleanpath( PyObject *self, PyObject *value);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* The following string definitions are used for documentation strings. */
|
||||
@@ -120,10 +121,13 @@ static char M_sys_expandpath_doc[] =
|
||||
(path) - the string path to convert.\n\n\
|
||||
Note: internally Blender paths can contain two special character sequences:\n\
|
||||
- '//' (at start) for base path directory (the current .blend's dir path);\n\
|
||||
- '#' (at ending) for current frame number.\n\n\
|
||||
- '#' characters in the filename will be replaced by the frame number.\n\n\
|
||||
This function expands these to their actual content, returning a valid path.\n\
|
||||
If the special chars are not found in the given path, it is simply returned.";
|
||||
|
||||
static char M_sys_cleanpath_doc[] =
|
||||
"(path) - Removes parts of a path that are not needed paths such as '../foo/../bar/' and '//./././'";
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python method structure definition for Blender.sys module: */
|
||||
/*****************************************************************************/
|
||||
@@ -139,6 +143,7 @@ struct PyMethodDef M_sys_methods[] = {
|
||||
{"sleep", M_sys_sleep, METH_VARARGS, M_sys_sleep_doc},
|
||||
{"time", ( PyCFunction ) M_sys_time, METH_NOARGS, M_sys_time_doc},
|
||||
{"expandpath", M_sys_expandpath, METH_O, M_sys_expandpath_doc},
|
||||
{"cleanpath", M_sys_cleanpath, METH_O, M_sys_cleanpath_doc},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -396,3 +401,24 @@ static PyObject *M_sys_expandpath( PyObject * self, PyObject * value )
|
||||
|
||||
return PyString_FromString(expanded);
|
||||
}
|
||||
|
||||
static PyObject *M_sys_cleanpath( PyObject * self, PyObject * value )
|
||||
{
|
||||
char *path = PyString_AsString(value);
|
||||
char cleaned[FILE_MAXDIR + FILE_MAXFILE];
|
||||
int trailing_slash = 0;
|
||||
if (!path)
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected string argument" );
|
||||
if (strstr(path, "/") || strstr(path, "\\")) {
|
||||
trailing_slash = 1;
|
||||
}
|
||||
BLI_strncpy(cleaned, path, FILE_MAXDIR + FILE_MAXFILE);
|
||||
BLI_cleanup_file(NULL, cleaned);
|
||||
|
||||
if (trailing_slash) {
|
||||
BLI_add_slash(cleaned);
|
||||
}
|
||||
|
||||
return PyString_FromString(cleaned);
|
||||
}
|
||||
|
||||
@@ -237,6 +237,18 @@ class Material:
|
||||
@ivar rayMirr: Mirror reflection amount for raytrace.
|
||||
Value is clamped to the range [0.0,1.0].
|
||||
@type rayMirr: float
|
||||
@ivar glossMir: Amount of reflection glossy.
|
||||
Value is clamped to the range [0.0,1.0].
|
||||
@type glossMir: float
|
||||
@ivar sampGloss_mir: Reflection glossy samples.
|
||||
Value is clamped to the range [1,1024].
|
||||
@type sampGloss_mir: int
|
||||
@ivar glossTra: Amount of refraction glossy.
|
||||
Value is clamped to the range [0.0,1.0].
|
||||
@type glossTra: float
|
||||
@ivar sampGlossTra: Refraction glossy samples.
|
||||
Value is clamped to the range [1,1024].
|
||||
@type sampGlossTra: int
|
||||
@ivar rayMirrDepth: Amount of raytrace inter-reflections.
|
||||
Value is clamped to the range [0,10].
|
||||
@type rayMirrDepth: int
|
||||
|
||||
@@ -153,7 +153,7 @@ def expandpath (path):
|
||||
Internally, Blender recognizes two special character sequences in paths:
|
||||
- '//' (used at the beginning): means base path -- the current .blend file's
|
||||
dir;
|
||||
- '#' (used at the end): means current frame number.
|
||||
- '#' characters in the filename will be replaced by the frame number.
|
||||
The expanded string can be passed to generic python functions that don't
|
||||
understand Blender's internal relative paths.
|
||||
@note: this function is also useful for obtaining the name of the image
|
||||
@@ -165,3 +165,12 @@ def expandpath (path):
|
||||
@rtype: string
|
||||
@return: the expanded (if necessary) path.
|
||||
"""
|
||||
|
||||
def cleanpath (path):
|
||||
"""
|
||||
Clean the given 'path' by removing unneeded components such as "/./" and "/test/../"
|
||||
@type path: string
|
||||
@param path: a path name.
|
||||
@rtype: string
|
||||
@return: the cleaned (if necessary) path.
|
||||
"""
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# epy_docgen.sh
|
||||
# generates blender python doc using epydoc
|
||||
# requires epydoc in your PATH.
|
||||
# run from the doc directory containing the .py files
|
||||
# usage: sh epy_docgen.sh
|
||||
|
||||
# set posix locale so regex works properly for [A-Z]*.py
|
||||
LC_ALL=POSIX
|
||||
|
||||
epydoc -v -o BPY_API --url "http://www.blender.org" --top API_intro \
|
||||
--name "Blender" --no-private --no-frames \
|
||||
$( ls [A-Z]*.py )
|
||||
@@ -7,6 +7,5 @@
|
||||
# set posix locale so regex works properly for [A-Z]*.py
|
||||
LC_ALL=POSIX
|
||||
|
||||
epydoc -o BPY_API --url "http://www.blender.org" -t API_intro.py \
|
||||
-n "Blender" --no-private --no-frames \
|
||||
$( ls [A-Z]*.py )
|
||||
epydoc -v -o BPY_API --url "http://www.blender.org" --top API_intro \
|
||||
--name "Blender" --no-private --no-frames [A-Z]*.py
|
||||
|
||||
Reference in New Issue
Block a user