Camera.c refactor, moved to getsetattrs. deprecated get/set functions. and added access to all camera settings.
cam.type now uses 'ortho' and 'persp' rather then 0 and 1 group.c and object.c, minor cleanup
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -217,7 +217,7 @@ static int Group_compare( BPy_Group * a, BPy_Group * b );
|
||||
static int Group_setName( BPy_Group * self, PyObject * value )
|
||||
{
|
||||
char *name = NULL;
|
||||
char buf[21];
|
||||
char buf[22];
|
||||
|
||||
GROUP_DEL_CHECK_INT(self);
|
||||
|
||||
@@ -234,7 +234,7 @@ static int Group_setName( BPy_Group * self, PyObject * value )
|
||||
}
|
||||
|
||||
|
||||
static PyObject *Group_getName( BPy_Group * self, PyObject * args )
|
||||
static PyObject *Group_getName( BPy_Group * self )
|
||||
{
|
||||
PyObject *attr;
|
||||
GROUP_DEL_CHECK_PY(self);
|
||||
@@ -315,7 +315,7 @@ static PyGetSetDef BPy_Group_getseters[] = {
|
||||
NULL},
|
||||
{"fakeUser",
|
||||
(getter)Group_getFakeUser, (setter)Group_setFakeUser,
|
||||
"Number of group users",
|
||||
"Groups fake user state",
|
||||
NULL},
|
||||
{"layers",
|
||||
(getter)Group_getLayers, (setter)Group_setLayers,
|
||||
|
||||
@@ -3898,31 +3898,31 @@ static PyObject *getFloatAttr( BPy_Object *self, void *type )
|
||||
param = self->object->soft->mediafrict;
|
||||
break;
|
||||
case EXPP_OBJ_ATTR_SB_RKLIMIT:
|
||||
param = self->object->soft->rklimit;
|
||||
param = object->soft->rklimit;
|
||||
break;
|
||||
case EXPP_OBJ_ATTR_SB_PHYSICSSPEED:
|
||||
param = self->object->soft->physics_speed;
|
||||
param = object->soft->physics_speed;
|
||||
break;
|
||||
case EXPP_OBJ_ATTR_SB_GOALSPRING:
|
||||
param = self->object->soft->goalspring;
|
||||
param = object->soft->goalspring;
|
||||
break;
|
||||
case EXPP_OBJ_ATTR_SB_GOALFRICT:
|
||||
param = self->object->soft->goalfrict;
|
||||
param = object->soft->goalfrict;
|
||||
break;
|
||||
case EXPP_OBJ_ATTR_SB_MINGOAL:
|
||||
param = self->object->soft->mingoal;
|
||||
param = object->soft->mingoal;
|
||||
break;
|
||||
case EXPP_OBJ_ATTR_SB_MAXGOAL:
|
||||
param = self->object->soft->maxgoal;
|
||||
param = object->soft->maxgoal;
|
||||
break;
|
||||
case EXPP_OBJ_ATTR_SB_DEFGOAL:
|
||||
param = self->object->soft->defgoal;
|
||||
param = object->soft->defgoal;
|
||||
break;
|
||||
case EXPP_OBJ_ATTR_SB_INSPRING:
|
||||
param = self->object->soft->inspring;
|
||||
param = object->soft->inspring;
|
||||
break;
|
||||
case EXPP_OBJ_ATTR_SB_INFRICT:
|
||||
param = self->object->soft->infrict;
|
||||
param = object->soft->infrict;
|
||||
break;
|
||||
default:
|
||||
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
@@ -4439,10 +4439,8 @@ static int Object_setIpo( BPy_Object * self, PyObject * value )
|
||||
/* assign new Ipo and increment user count, or set to NULL if deleting */
|
||||
|
||||
self->object->ipo = ipo;
|
||||
if ( ipo ) {
|
||||
id = &ipo->id;
|
||||
id->us++;
|
||||
}
|
||||
if ( ipo )
|
||||
id_us_plus(&ipo->id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ Example::
|
||||
from Blender import Camera, Object, Scene
|
||||
c = Camera.New('ortho') # create new ortho camera data
|
||||
c.scale = 6.0 # set scale value
|
||||
cur = Scene.getCurrent() # get current scene
|
||||
cur = Scene.GetCurrent() # get current scene
|
||||
ob = Object.New('Camera') # make camera object
|
||||
ob.link(c) # link camera data with this object
|
||||
cur.link(ob) # link object into scene
|
||||
@@ -50,18 +50,27 @@ class Camera:
|
||||
======================
|
||||
This object gives access to Camera-specific data in Blender.
|
||||
@ivar name: The Camera Data name.
|
||||
@ivar type: The Camera type: 'persp':0 or 'ortho':1.
|
||||
@ivar type: The Camera type: 'persp' or 'ortho'
|
||||
@ivar mode: The mode flags: B{ORed value}: 'showLimits':1, 'showMist':2.
|
||||
@ivar lens: The lens value in [1.0, 250.0], only relevant to *persp*
|
||||
cameras.
|
||||
@ivar scale: The scale value in [0.01, 1000.00], only relevant to *ortho*
|
||||
cameras.
|
||||
@ivar lens: The lens value in [1.0, 250.0], only relevant to *persp* cameras.
|
||||
@ivar scale: The scale value in [0.01, 1000.00], only relevant to *ortho* cameras.
|
||||
@ivar clipStart: The clip start value in [0.0, 100.0].
|
||||
@ivar clipEnd: The clip end value in [1.0, 5000.0].
|
||||
@ivar dofDist: The dofDist value in [0.0, 5000.0].
|
||||
@ivar drawSize: The draw size value in [0.1, 10.0].
|
||||
@ivar shiftx: The horizontal offset of the camera [-2.0, 2.0].
|
||||
@ivar shifty: The vertical offset of the camera [-2.0, 2.0].
|
||||
@ivar alpha: The PassePart alpha [0.0, 1.0].
|
||||
@ivar drawSize: The display size for the camera an the 3d view [0.1, 10.0].
|
||||
@type ipo: Blender Ipo
|
||||
@ivar ipo: The "camera data" ipo linked to this camera data object.
|
||||
Set to None to clear the ipo.
|
||||
|
||||
@ivar drawLimits: Toggle the option to show limits in the 3d view.
|
||||
@ivar drawName: Toggle the option to show the camera name in the 3d view.
|
||||
@ivar drawMist: Toggle the option to show mist in the 3d view.
|
||||
@ivar drawTileSafe: Toggle the option to show tile safe in the 3d view.
|
||||
@ivar drawPassepartout: Toggle the option to show pass part out in the 3d view.
|
||||
|
||||
@warning: Most member variables assume values in some [Min, Max] interval.
|
||||
When trying to set them, the given parameter will be clamped to lie in
|
||||
that range: if val < Min, then val = Min, if val > Max, then val = Max.
|
||||
@@ -69,54 +78,54 @@ class Camera:
|
||||
|
||||
def getName():
|
||||
"""
|
||||
Get the name of this Camera Data object.
|
||||
Get the name of this Camera Data object. (B{deprecated}) See the L{name} attribute.
|
||||
@rtype: string
|
||||
"""
|
||||
|
||||
def setName(name):
|
||||
"""
|
||||
Set the name of this Camera Data object.
|
||||
Set the name of this Camera Data object. (B{deprecated}) See the L{name} attribute.
|
||||
@type name: string
|
||||
@param name: The new name.
|
||||
"""
|
||||
|
||||
def getIpo():
|
||||
"""
|
||||
Get the Ipo associated with this camera data object, if any.
|
||||
Get the Ipo associated with this camera data object, if any. (B{deprecated})
|
||||
@rtype: Ipo
|
||||
@return: the wrapped ipo or None.
|
||||
@return: the wrapped ipo or None. (B{deprecated}) See the L{ipo} attribute.
|
||||
"""
|
||||
|
||||
def setIpo(ipo):
|
||||
"""
|
||||
Link an ipo to this camera data object.
|
||||
Link an ipo to this camera data object. (B{deprecated}) See the L{ipo} attribute.
|
||||
@type ipo: Blender Ipo
|
||||
@param ipo: a "camera data" ipo.
|
||||
"""
|
||||
|
||||
def clearIpo():
|
||||
"""
|
||||
Unlink the ipo from this camera data object.
|
||||
Unlink the ipo from this camera data object. (B{deprecated}) See the L{ipo} attribute.
|
||||
@return: True if there was an ipo linked or False otherwise.
|
||||
"""
|
||||
|
||||
def getType():
|
||||
"""
|
||||
Get this Camera's type.
|
||||
Get this Camera's type. (B{deprecated}) See the L{type} attribute.
|
||||
@rtype: int
|
||||
@return: 0 for 'persp' or 1 for 'ortho'.
|
||||
"""
|
||||
|
||||
def setType(type):
|
||||
"""
|
||||
Set this Camera's type.
|
||||
Set this Camera's type. (B{deprecated}) See the L{type} attribute.
|
||||
@type type: string
|
||||
@param type: The Camera type: 'persp' or 'ortho'.
|
||||
"""
|
||||
|
||||
def getMode():
|
||||
"""
|
||||
Get this Camera's mode flags.
|
||||
Get this Camera's mode flags. (B{deprecated}) See the L{mode} attribute.
|
||||
@rtype: int
|
||||
@return: B{OR'ed value}: 'showLimits' is 1, 'showMist' is 2, or
|
||||
respectively, 01 and 10 in binary.
|
||||
@@ -124,7 +133,7 @@ class Camera:
|
||||
|
||||
def setMode(mode1 = None, mode2 = None):
|
||||
"""
|
||||
Set this Camera's mode flags. Mode strings given are turned 'on'.
|
||||
Set this Camera's mode flags. Mode strings given are turned 'on'. (B{deprecated}) See the L{mode} attribute.
|
||||
Those not provided are turned 'off', so cam.setMode() -- without
|
||||
arguments -- turns off all mode flags for Camera cam.
|
||||
@type mode1: string
|
||||
@@ -135,29 +144,29 @@ class Camera:
|
||||
|
||||
def getLens():
|
||||
"""
|
||||
Get the lens value.
|
||||
Get the lens value. (B{deprecated}) See the L{lens} attribute.
|
||||
@rtype: float
|
||||
@warn: lens is only relevant for perspective (L{getType}) cameras.
|
||||
"""
|
||||
|
||||
def setLens(lens):
|
||||
"""
|
||||
Set the lens value.
|
||||
Set the lens value. (B{deprecated}) See the L{lens} attribute.
|
||||
@type lens: float
|
||||
@param lens: The new lens value.
|
||||
@warn: lens is only relevant for perspective (L{getType}) cameras.
|
||||
@warn: lens is only relevant for perspective (L{type}) cameras.
|
||||
"""
|
||||
|
||||
def getScale():
|
||||
"""
|
||||
Get the scale value.
|
||||
Get the scale value. (B{deprecated}) See the L{scale} attribute.
|
||||
@rtype: float
|
||||
@warn: scale is only relevant for ortho (L{getType}) cameras.
|
||||
@warn: scale is only relevant for ortho (L{type}) cameras.
|
||||
"""
|
||||
|
||||
def setScale(scale):
|
||||
"""
|
||||
Set the scale value.
|
||||
Set the scale value. (B{deprecated}) See the L{scale} attribute.
|
||||
@type scale: float
|
||||
@param scale: The new scale value in [0.01, 1000.00].
|
||||
@warn: scale is only relevant for ortho (L{getType}) cameras.
|
||||
@@ -165,52 +174,39 @@ class Camera:
|
||||
|
||||
def getClipStart():
|
||||
"""
|
||||
Get the clip start value.
|
||||
Get the clip start value. (B{deprecated}) See the L{clipStart} attribute.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setClipStart(clipstart):
|
||||
"""
|
||||
Set the clip start value.
|
||||
Set the clip start value. (B{deprecated}) See the L{clipStart} attribute.
|
||||
@type clipstart: float
|
||||
@param clipstart: The new lens value.
|
||||
"""
|
||||
|
||||
def getClipEnd():
|
||||
"""
|
||||
Get the clip end value.
|
||||
Get the clip end value. (B{deprecated}) See the L{clipEnd} attribute.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setClipEnd(clipend):
|
||||
"""
|
||||
Set the clip end value.
|
||||
Set the clip end value. (B{deprecated}) See the L{clipEnd} attribute.
|
||||
@type clipend: float
|
||||
@param clipend: The new clip end value.
|
||||
"""
|
||||
|
||||
def getDofDist():
|
||||
"""
|
||||
Get the dofDist value.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setDofDist(dist):
|
||||
"""
|
||||
Set the dofDist value.
|
||||
@type dist: float
|
||||
@param dist: The new dof distance value.
|
||||
"""
|
||||
|
||||
def getDrawSize():
|
||||
"""
|
||||
Get the draw size value.
|
||||
Get the draw size value. (B{deprecated}) See the L{drawSize} attribute.
|
||||
@rtype: float
|
||||
"""
|
||||
|
||||
def setDrawSize(drawsize):
|
||||
"""
|
||||
Set the draw size value.
|
||||
Set the draw size value. (B{deprecated}) See the L{drawSize} attribute.
|
||||
@type drawsize: float
|
||||
@param drawsize: The new draw size value.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user