-- added Object.protectFlags attribute; let user get/set transform lock bits
This commit is contained in:
@@ -2844,6 +2844,8 @@ static PyObject *Object_getAttr( BPy_Object * obj, char *name )
|
|||||||
return Object_getEffects( obj );
|
return Object_getEffects( obj );
|
||||||
if( StringEqual( name, "users" ) )
|
if( StringEqual( name, "users" ) )
|
||||||
return PyInt_FromLong( obj->object->id.us );
|
return PyInt_FromLong( obj->object->id.us );
|
||||||
|
if( StringEqual( name, "protectFlags" ) )
|
||||||
|
return PyInt_FromLong( obj->object->protectflag );
|
||||||
|
|
||||||
/* not an attribute, search the methods table */
|
/* not an attribute, search the methods table */
|
||||||
return Py_FindMethod( BPy_Object_methods, ( PyObject * ) obj, name );
|
return Py_FindMethod( BPy_Object_methods, ( PyObject * ) obj, name );
|
||||||
@@ -3063,6 +3065,19 @@ static int Object_setAttr( BPy_Object * obj, char *name, PyObject * value )
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if( StringEqual( name, "protectFlags" ) ) {
|
||||||
|
int flag=0;
|
||||||
|
if( !PyArg_Parse( value, "i", &flag ) )
|
||||||
|
return EXPP_ReturnIntError ( PyExc_AttributeError,
|
||||||
|
"expected an integer" );
|
||||||
|
|
||||||
|
flag &= OB_LOCK_LOCX | OB_LOCK_LOCY | OB_LOCK_LOCZ |
|
||||||
|
OB_LOCK_ROTX | OB_LOCK_ROTY | OB_LOCK_ROTZ |
|
||||||
|
OB_LOCK_SIZEX | OB_LOCK_SIZEY | OB_LOCK_SIZEZ;
|
||||||
|
|
||||||
|
object->protectflag = flag;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* SECOND, handle all the attributes that passes the value as a tuple to another function */
|
/* SECOND, handle all the attributes that passes the value as a tuple to another function */
|
||||||
@@ -3073,7 +3088,7 @@ static int Object_setAttr( BPy_Object * obj, char *name, PyObject * value )
|
|||||||
valtuple = Py_BuildValue( "(O)", value );
|
valtuple = Py_BuildValue( "(O)", value );
|
||||||
if( !valtuple ) {
|
if( !valtuple ) {
|
||||||
return EXPP_ReturnIntError( PyExc_MemoryError,
|
return EXPP_ReturnIntError( PyExc_MemoryError,
|
||||||
"Object_setAttr: couldn't create PyTuple" );
|
"Object_setAttr: couldn't create PyTuple" );
|
||||||
}
|
}
|
||||||
/* Call the setFunctions to handle it */
|
/* Call the setFunctions to handle it */
|
||||||
if( StringEqual( name, "loc" ) )
|
if( StringEqual( name, "loc" ) )
|
||||||
|
|||||||
@@ -192,6 +192,18 @@ class Object:
|
|||||||
@ivar parentbonename: The string name of the parent bone.
|
@ivar parentbonename: The string name of the parent bone.
|
||||||
@ivar users: The number of users of the object. Read-only.
|
@ivar users: The number of users of the object. Read-only.
|
||||||
@type users: int
|
@type users: int
|
||||||
|
@ivar protectFlags: The "transform locking" bitfield flags for the object.
|
||||||
|
Setting bits lock the following attributes:
|
||||||
|
- bit 0: X location
|
||||||
|
- bit 1: Y location
|
||||||
|
- bit 2: Z location
|
||||||
|
- bit 3: X rotation
|
||||||
|
- bit 4: Y rotation
|
||||||
|
- bit 5: Z rotation
|
||||||
|
- bit 6: X size
|
||||||
|
- bit 7: Y size
|
||||||
|
- bit 8: Z size
|
||||||
|
@type protectFlags: int
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def buildParts():
|
def buildParts():
|
||||||
|
|||||||
Reference in New Issue
Block a user