2008-10-31 23:50:02 +00:00
/**
2002-10-12 11:37:38 +00:00
* $ Id $
*
2008-01-07 19:13:47 +00:00
* * * * * * BEGIN GPL LICENSE BLOCK * * * * *
2002-10-12 11:37:38 +00:00
*
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
2008-01-07 19:13:47 +00:00
* of the License , or ( at your option ) any later version .
2002-10-12 11:37:38 +00:00
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software Foundation ,
2010-02-12 13:34:04 +00:00
* Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA .
2002-10-12 11:37:38 +00:00
*
2008-10-31 23:50:02 +00:00
* Contributor ( s ) : Blender Foundation ( 2008 ) .
2002-10-12 11:37:38 +00:00
*
2008-01-07 19:13:47 +00:00
* * * * * * END GPL LICENSE BLOCK * * * * *
2002-10-12 11:37:38 +00:00
*/
2009-06-03 23:22:43 +00:00
# include <stdio.h>
2008-10-31 23:50:02 +00:00
# include <stdlib.h>
2009-07-03 15:23:33 +00:00
# include "RNA_access.h"
2008-10-31 23:50:02 +00:00
# include "RNA_define.h"
2009-11-13 16:08:03 +00:00
# include "RNA_enum_types.h"
2008-10-31 23:50:02 +00:00
2008-11-07 02:58:25 +00:00
# include "rna_internal.h"
2009-09-28 10:19:20 +00:00
# include "DNA_action_types.h"
2009-01-08 13:57:29 +00:00
# include "DNA_customdata_types.h"
2010-05-05 00:12:31 +00:00
# include "DNA_controller_types.h"
2009-06-03 23:22:43 +00:00
# include "DNA_material_types.h"
2009-01-08 13:57:29 +00:00
# include "DNA_mesh_types.h"
2009-06-27 13:20:19 +00:00
# include "DNA_object_force.h"
2008-10-31 23:50:02 +00:00
# include "DNA_object_types.h"
2008-12-02 01:05:23 +00:00
# include "DNA_property_types.h"
2009-01-02 13:47:33 +00:00
# include "DNA_scene_types.h"
2008-10-31 23:50:02 +00:00
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
# include "WM_api.h"
2009-01-01 15:52:51 +00:00
# include "WM_types.h"
2009-08-16 05:48:07 +00:00
EnumPropertyItem object_mode_items [ ] = {
{ OB_MODE_OBJECT , " OBJECT " , ICON_OBJECT_DATAMODE , " Object " , " " } ,
{ OB_MODE_EDIT , " EDIT " , ICON_EDITMODE_HLT , " Edit " , " " } ,
{ OB_MODE_SCULPT , " SCULPT " , ICON_SCULPTMODE_HLT , " Sculpt " , " " } ,
{ OB_MODE_VERTEX_PAINT , " VERTEX_PAINT " , ICON_VPAINT_HLT , " Vertex Paint " , " " } ,
{ OB_MODE_WEIGHT_PAINT , " WEIGHT_PAINT " , ICON_WPAINT_HLT , " Weight Paint " , " " } ,
{ OB_MODE_TEXTURE_PAINT , " TEXTURE_PAINT " , ICON_TPAINT_HLT , " Texture Paint " , " " } ,
{ OB_MODE_PARTICLE_EDIT , " PARTICLE_EDIT " , ICON_PARTICLEMODE , " Particle Edit " , " " } ,
{ OB_MODE_POSE , " POSE " , ICON_POSE_HLT , " Pose " , " " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-07-14 20:27:28 +00:00
static EnumPropertyItem parent_type_items [ ] = {
{ PAROBJECT , " OBJECT " , 0 , " Object " , " " } ,
{ PARCURVE , " CURVE " , 0 , " Curve " , " " } ,
2009-07-24 11:24:00 +00:00
{ PARKEY , " KEY " , 0 , " Key " , " " } ,
2009-07-14 20:27:28 +00:00
{ PARSKEL , " ARMATURE " , 0 , " Armature " , " " } ,
{ PARSKEL , " LATTICE " , 0 , " Lattice " , " " } , // PARSKEL reuse will give issues
{ PARVERT1 , " VERTEX " , 0 , " Vertex " , " " } ,
{ PARVERT3 , " VERTEX_3 " , 0 , " 3 Vertices " , " " } ,
{ PARBONE , " BONE " , 0 , " Bone " , " " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-12-04 19:06:17 +00:00
static EnumPropertyItem collision_bounds_items [ ] = {
{ OB_BOUND_BOX , " BOX " , 0 , " Box " , " " } ,
{ OB_BOUND_SPHERE , " SPHERE " , 0 , " Sphere " , " " } ,
{ OB_BOUND_CYLINDER , " CYLINDER " , 0 , " Cylinder " , " " } ,
{ OB_BOUND_CONE , " CONE " , 0 , " Cone " , " " } ,
{ OB_BOUND_POLYT , " CONVEX_HULL " , 0 , " Convex Hull " , " " } ,
{ OB_BOUND_POLYH , " TRIANGLE_MESH " , 0 , " Triangle Mesh " , " " } ,
//{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""},
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-07-14 20:27:28 +00:00
2010-03-23 14:58:36 +00:00
/* used for 2 enums */
# define OBTYPE_CU_CURVE {OB_CURVE, "CURVE", 0, "Curve", ""}
# define OBTYPE_CU_SURF {OB_SURF, "SURFACE", 0, "Surface", ""}
# define OBTYPE_CU_TEXT {OB_FONT, "TEXT", 0, "Text", ""}
2.5: Object module
* Split object_edit.c into multiple files:
object_add.c, object_edit.c, object_hook.c, object_relations.c,
object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
* vertex group menu and set active
* apply location, rotation, scale, visual transform (location is new)
* make local
* make vertex parent
* move to layer
* convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
up here...
2009-09-09 11:52:56 +00:00
EnumPropertyItem object_type_items [ ] = {
{ OB_MESH , " MESH " , 0 , " Mesh " , " " } ,
2010-03-23 14:58:36 +00:00
OBTYPE_CU_CURVE ,
OBTYPE_CU_SURF ,
2.5: Object module
* Split object_edit.c into multiple files:
object_add.c, object_edit.c, object_hook.c, object_relations.c,
object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
* vertex group menu and set active
* apply location, rotation, scale, visual transform (location is new)
* make local
* make vertex parent
* move to layer
* convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
up here...
2009-09-09 11:52:56 +00:00
{ OB_MBALL , " META " , 0 , " Meta " , " " } ,
2010-03-23 14:58:36 +00:00
OBTYPE_CU_TEXT ,
2.5: Object module
* Split object_edit.c into multiple files:
object_add.c, object_edit.c, object_hook.c, object_relations.c,
object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
* vertex group menu and set active
* apply location, rotation, scale, visual transform (location is new)
* make local
* make vertex parent
* move to layer
* convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
up here...
2009-09-09 11:52:56 +00:00
{ 0 , " " , 0 , NULL , NULL } ,
{ OB_ARMATURE , " ARMATURE " , 0 , " Armature " , " " } ,
{ OB_LATTICE , " LATTICE " , 0 , " Lattice " , " " } ,
{ OB_EMPTY , " EMPTY " , 0 , " Empty " , " " } ,
{ 0 , " " , 0 , NULL , NULL } ,
{ OB_CAMERA , " CAMERA " , 0 , " Camera " , " " } ,
{ OB_LAMP , " LAMP " , 0 , " Lamp " , " " } ,
2009-12-04 19:06:17 +00:00
{ 0 , NULL , 0 , NULL , NULL } } ;
2.5: Object module
* Split object_edit.c into multiple files:
object_add.c, object_edit.c, object_hook.c, object_relations.c,
object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
* vertex group menu and set active
* apply location, rotation, scale, visual transform (location is new)
* make local
* make vertex parent
* move to layer
* convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
up here...
2009-09-09 11:52:56 +00:00
2010-03-23 14:58:36 +00:00
EnumPropertyItem object_type_curve_items [ ] = {
OBTYPE_CU_CURVE ,
OBTYPE_CU_SURF ,
OBTYPE_CU_TEXT ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2008-10-31 23:50:02 +00:00
# ifdef RNA_RUNTIME
2008-12-02 23:45:11 +00:00
2009-11-10 20:43:45 +00:00
# include "BLI_math.h"
2009-09-28 10:19:20 +00:00
2009-07-02 03:32:57 +00:00
# include "DNA_key_types.h"
2009-11-11 19:58:30 +00:00
# include "DNA_constraint_types.h"
2009-07-02 03:32:57 +00:00
2009-06-07 13:09:18 +00:00
# include "BKE_armature.h"
2009-08-04 09:20:48 +00:00
# include "BKE_bullet.h"
2009-11-13 16:08:03 +00:00
# include "BKE_constraint.h"
2009-01-01 15:52:51 +00:00
# include "BKE_context.h"
2009-06-07 13:09:18 +00:00
# include "BKE_curve.h"
2009-01-01 15:52:51 +00:00
# include "BKE_depsgraph.h"
2009-07-02 19:41:31 +00:00
# include "BKE_effect.h"
2009-07-02 03:32:57 +00:00
# include "BKE_key.h"
2009-11-04 23:14:20 +00:00
# include "BKE_object.h"
2009-01-04 19:25:24 +00:00
# include "BKE_material.h"
2009-06-07 13:09:18 +00:00
# include "BKE_mesh.h"
2009-06-01 11:39:11 +00:00
# include "BKE_particle.h"
2009-07-14 20:27:28 +00:00
# include "BKE_scene.h"
2009-10-07 15:16:08 +00:00
# include "BLI_editVert.h" /* for EditMesh->mat_nr */
2009-12-08 17:23:48 +00:00
# include "ED_mesh.h"
2009-07-14 20:27:28 +00:00
# include "ED_object.h"
2009-10-09 13:25:54 +00:00
# include "ED_particle.h"
2009-01-01 15:52:51 +00:00
2010-08-03 06:51:36 +00:00
static void rna_Object_internal_update ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-01-01 15:52:51 +00:00
{
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
DAG_id_flush_update ( ptr - > id . data , OB_RECALC_OB ) ;
2009-01-01 15:52:51 +00:00
}
2010-08-03 06:51:36 +00:00
static void rna_Object_matrix_world_update ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-08-13 11:14:06 +00:00
{
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
object_apply_mat4 ( ptr - > id . data , ( ( Object * ) ptr - > id . data ) - > obmat ) ;
2010-06-09 08:24:31 +00:00
rna_Object_internal_update ( bmain , scene , ptr ) ;
2009-08-13 11:14:06 +00:00
}
2010-08-03 06:51:36 +00:00
static void rna_Object_matrix_local_get ( PointerRNA * ptr , float values [ 16 ] )
2010-07-03 17:39:29 +00:00
{
Object * ob = ptr - > id . data ;
if ( ob - > parent ) {
float invmat [ 4 ] [ 4 ] ; /* for inverse of parent's matrix */
invert_m4_m4 ( invmat , ob - > parent - > obmat ) ;
mul_m4_m4m4 ( ( float ( * ) [ 4 ] ) values , ob - > obmat , invmat ) ;
}
else {
copy_m4_m4 ( ( float ( * ) [ 4 ] ) values , ob - > obmat ) ;
}
}
2010-08-03 06:51:36 +00:00
static void rna_Object_matrix_local_set ( PointerRNA * ptr , const float values [ 16 ] )
2010-07-03 17:39:29 +00:00
{
Object * ob = ptr - > id . data ;
/* localspace matrix is truly relative to the parent, but parameters
* stored in object are relative to parentinv matrix . Undo the parent
* inverse part before updating obmat and calling apply_obmat ( ) */
if ( ob - > parent ) {
float invmat [ 4 ] [ 4 ] ;
invert_m4_m4 ( invmat , ob - > parentinv ) ;
mul_m4_m4m4 ( ob - > obmat , ( float ( * ) [ 4 ] ) values , invmat ) ;
}
else {
copy_m4_m4 ( ob - > obmat , ( float ( * ) [ 4 ] ) values ) ;
}
object_apply_mat4 ( ob , ob - > obmat ) ;
}
2010-06-09 08:24:31 +00:00
void rna_Object_internal_update_data ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-06-07 13:09:18 +00:00
{
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
DAG_id_flush_update ( ptr - > id . data , OB_RECALC_DATA ) ;
2009-12-08 17:23:48 +00:00
WM_main_add_notifier ( NC_OBJECT | ND_DRAW , ptr - > id . data ) ;
2009-06-07 13:09:18 +00:00
}
2009-12-08 17:23:48 +00:00
void rna_Object_active_shape_update ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-10-22 17:12:28 +00:00
{
Object * ob = ptr - > id . data ;
int editmode = ( scene - > obedit = = ob & & ob - > type = = OB_MESH ) ;
if ( editmode ) {
/* exit/enter editmode to get new shape */
2009-12-08 17:23:48 +00:00
load_editMesh ( scene , ob ) ;
make_editMesh ( scene , ob ) ;
2009-10-22 17:12:28 +00:00
}
2010-06-09 08:24:31 +00:00
rna_Object_internal_update_data ( bmain , scene , ptr ) ;
2009-10-22 17:12:28 +00:00
}
2009-12-08 17:23:48 +00:00
static void rna_Object_dependency_update ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-04-11 01:43:50 +00:00
{
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
DAG_id_flush_update ( ptr - > id . data , OB_RECALC_OB ) ;
2010-08-01 12:47:49 +00:00
DAG_scene_sort ( bmain , scene ) ;
2009-04-11 01:43:50 +00:00
}
2009-10-08 07:54:20 +00:00
/* when changing the selection flag the scene needs updating */
2009-12-08 17:23:48 +00:00
static void rna_Object_select_update ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-10-08 07:54:20 +00:00
{
Object * ob = ( Object * ) ptr - > id . data ;
short mode = ob - > flag & SELECT ? BA_SELECT : BA_DESELECT ;
2009-12-08 17:23:48 +00:00
ED_base_object_select ( object_in_scene ( ob , scene ) , mode ) ;
2009-10-08 07:54:20 +00:00
}
2009-12-08 17:23:48 +00:00
static void rna_Base_select_update ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-11-02 11:14:22 +00:00
{
Base * base = ( Base * ) ptr - > data ;
short mode = base - > flag & BA_SELECT ? BA_SELECT : BA_DESELECT ;
ED_base_object_select ( base , mode ) ;
}
2010-08-01 12:47:49 +00:00
static void rna_Object_layer_update__internal ( Main * bmain , Scene * scene , Base * base , Object * ob )
2009-11-02 11:14:22 +00:00
{
/* try to avoid scene sort */
if ( ( ob - > lay & scene - > lay ) & & ( base - > lay & scene - > lay ) ) {
2010-03-22 09:30:00 +00:00
/* pass */
2009-11-02 11:14:22 +00:00
} else if ( ( ob - > lay & scene - > lay ) = = 0 & & ( base - > lay & scene - > lay ) = = 0 ) {
/* pass */
} else {
2010-08-01 12:47:49 +00:00
DAG_scene_sort ( bmain , scene ) ;
2009-11-02 11:14:22 +00:00
}
}
2009-12-08 17:23:48 +00:00
static void rna_Object_layer_update ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-07-14 20:27:28 +00:00
{
Object * ob = ( Object * ) ptr - > id . data ;
Base * base ;
base = object_in_scene ( ob , scene ) ;
if ( ! base )
return ;
2009-12-21 10:50:32 +00:00
SWAP ( int , base - > lay , ob - > lay ) ;
2009-07-14 20:27:28 +00:00
2010-08-01 12:47:49 +00:00
rna_Object_layer_update__internal ( bmain , scene , base , ob ) ;
2009-12-21 10:50:32 +00:00
ob - > lay = base - > lay ;
2009-11-02 11:14:22 +00:00
}
2009-12-08 17:23:48 +00:00
static void rna_Base_layer_update ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-11-02 11:14:22 +00:00
{
2010-06-09 15:56:50 +00:00
Base * base = ( Base * ) ptr - > data ;
2009-11-02 11:14:22 +00:00
Object * ob = ( Object * ) base - > object ;
2010-08-01 12:47:49 +00:00
rna_Object_layer_update__internal ( bmain , scene , base , ob ) ;
2009-12-21 10:50:32 +00:00
ob - > lay = base - > lay ;
2009-07-14 20:27:28 +00:00
}
2009-06-07 13:09:18 +00:00
static int rna_Object_data_editable ( PointerRNA * ptr )
{
Object * ob = ( Object * ) ptr - > data ;
return ( ob - > type = = OB_EMPTY ) ? 0 : PROP_EDITABLE ;
}
static void rna_Object_data_set ( PointerRNA * ptr , PointerRNA value )
{
Object * ob = ( Object * ) ptr - > data ;
ID * id = value . data ;
2009-10-24 22:41:40 +00:00
if ( ob - > type = = OB_EMPTY | | id = = NULL | | ob - > mode & OB_MODE_EDIT )
2009-06-07 13:09:18 +00:00
return ;
if ( ob - > type = = OB_MESH ) {
set_mesh ( ob , ( Mesh * ) id ) ;
}
else {
if ( ob - > data )
id_us_min ( ( ID * ) ob - > data ) ;
if ( id )
id_us_plus ( id ) ;
ob - > data = id ;
test_object_materials ( id ) ;
2009-06-20 15:06:18 +00:00
if ( GS ( id - > name ) = = ID_CU )
2009-06-07 13:09:18 +00:00
test_curve_type ( ob ) ;
else if ( ob - > type = = OB_ARMATURE )
armature_rebuild_pose ( ob , ob - > data ) ;
}
}
static StructRNA * rna_Object_data_typef ( PointerRNA * ptr )
{
Object * ob = ( Object * ) ptr - > data ;
switch ( ob - > type ) {
case OB_MESH : return & RNA_Mesh ;
case OB_CURVE : return & RNA_Curve ;
case OB_SURF : return & RNA_Curve ;
case OB_FONT : return & RNA_Curve ;
case OB_MBALL : return & RNA_MetaBall ;
case OB_LAMP : return & RNA_Lamp ;
case OB_CAMERA : return & RNA_Camera ;
case OB_LATTICE : return & RNA_Lattice ;
case OB_ARMATURE : return & RNA_Armature ;
default : return & RNA_ID ;
}
}
2009-07-14 20:27:28 +00:00
static void rna_Object_parent_set ( PointerRNA * ptr , PointerRNA value )
{
Object * ob = ( Object * ) ptr - > data ;
Object * par = ( Object * ) value . data ;
ED_object_parent ( ob , par , ob - > partype , ob - > parsubstr ) ;
}
static void rna_Object_parent_type_set ( PointerRNA * ptr , int value )
{
Object * ob = ( Object * ) ptr - > data ;
ED_object_parent ( ob , ob - > parent , value , ob - > parsubstr ) ;
}
static EnumPropertyItem * rna_Object_parent_type_itemf ( bContext * C , PointerRNA * ptr , int * free )
{
Object * ob = ( Object * ) ptr - > data ;
EnumPropertyItem * item = NULL ;
int totitem = 0 ;
RNA_enum_items_add_value ( & item , & totitem , parent_type_items , PAROBJECT ) ;
2009-07-19 14:57:20 +00:00
if ( ob - > parent ) {
Object * par = ob - > parent ;
2009-07-14 20:27:28 +00:00
if ( par - > type = = OB_CURVE )
RNA_enum_items_add_value ( & item , & totitem , parent_type_items , PARCURVE ) ;
else if ( par - > type = = OB_LATTICE )
2009-07-24 11:24:00 +00:00
RNA_enum_items_add_value ( & item , & totitem , & parent_type_items [ 4 ] , PARSKEL ) ; // special hack: prevents this overriding others
2009-07-14 20:27:28 +00:00
else if ( par - > type = = OB_ARMATURE ) {
2009-07-24 11:24:00 +00:00
RNA_enum_items_add_value ( & item , & totitem , & parent_type_items [ 3 ] , PARSKEL ) ; // special hack: prevents this being overrided
2009-07-14 20:27:28 +00:00
RNA_enum_items_add_value ( & item , & totitem , parent_type_items , PARBONE ) ;
}
else if ( par - > type = = OB_MESH ) {
RNA_enum_items_add_value ( & item , & totitem , parent_type_items , PARVERT1 ) ;
RNA_enum_items_add_value ( & item , & totitem , parent_type_items , PARVERT3 ) ;
}
}
RNA_enum_item_end ( & item , & totitem ) ;
* free = 1 ;
return item ;
}
2009-12-04 19:06:17 +00:00
static EnumPropertyItem * rna_Object_collision_bounds_itemf ( bContext * C , PointerRNA * ptr , int * free )
{
Object * ob = ( Object * ) ptr - > data ;
EnumPropertyItem * item = NULL ;
int totitem = 0 ;
RNA_enum_items_add_value ( & item , & totitem , collision_bounds_items , OB_BOUND_POLYH ) ;
RNA_enum_items_add_value ( & item , & totitem , collision_bounds_items , OB_BOUND_POLYT ) ;
if ( ob - > body_type ! = OB_BODY_TYPE_SOFT ) {
RNA_enum_items_add_value ( & item , & totitem , collision_bounds_items , OB_BOUND_CONE ) ;
RNA_enum_items_add_value ( & item , & totitem , collision_bounds_items , OB_BOUND_CYLINDER ) ;
RNA_enum_items_add_value ( & item , & totitem , collision_bounds_items , OB_BOUND_SPHERE ) ;
RNA_enum_items_add_value ( & item , & totitem , collision_bounds_items , OB_BOUND_BOX ) ;
}
RNA_enum_item_end ( & item , & totitem ) ;
* free = 1 ;
return item ;
}
2009-07-14 20:27:28 +00:00
static void rna_Object_parent_bone_set ( PointerRNA * ptr , const char * value )
{
Object * ob = ( Object * ) ptr - > data ;
ED_object_parent ( ob , ob - > parent , ob - > partype , value ) ;
}
2009-01-01 20:44:40 +00:00
static int rna_VertexGroup_index_get ( PointerRNA * ptr )
{
2009-01-04 19:25:24 +00:00
Object * ob = ( Object * ) ptr - > id . data ;
2009-01-01 20:44:40 +00:00
return BLI_findindex ( & ob - > defbase , ptr - > data ) ;
}
2009-02-02 19:57:57 +00:00
static PointerRNA rna_Object_active_vertex_group_get ( PointerRNA * ptr )
2009-01-01 20:44:40 +00:00
{
2009-01-04 19:25:24 +00:00
Object * ob = ( Object * ) ptr - > id . data ;
2009-07-21 00:55:20 +00:00
return rna_pointer_inherit_refine ( ptr , & RNA_VertexGroup , BLI_findlink ( & ob - > defbase , ob - > actdef - 1 ) ) ;
2009-01-01 20:44:40 +00:00
}
2009-07-02 03:32:57 +00:00
static int rna_Object_active_vertex_group_index_get ( PointerRNA * ptr )
{
Object * ob = ( Object * ) ptr - > id . data ;
return MAX2 ( ob - > actdef - 1 , 0 ) ;
}
static void rna_Object_active_vertex_group_index_set ( PointerRNA * ptr , int value )
{
Object * ob = ( Object * ) ptr - > id . data ;
ob - > actdef = value + 1 ;
}
static void rna_Object_active_vertex_group_index_range ( PointerRNA * ptr , int * min , int * max )
{
Object * ob = ( Object * ) ptr - > id . data ;
* min = 0 ;
* max = BLI_countlist ( & ob - > defbase ) - 1 ;
* max = MAX2 ( 0 , * max ) ;
}
2009-01-04 19:25:24 +00:00
void rna_object_vgroup_name_index_get ( PointerRNA * ptr , char * value , int index )
{
Object * ob = ( Object * ) ptr - > id . data ;
bDeformGroup * dg ;
dg = BLI_findlink ( & ob - > defbase , index - 1 ) ;
if ( dg ) BLI_strncpy ( value , dg - > name , sizeof ( dg - > name ) ) ;
else BLI_strncpy ( value , " " , sizeof ( dg - > name ) ) ;
}
int rna_object_vgroup_name_index_length ( PointerRNA * ptr , int index )
{
Object * ob = ( Object * ) ptr - > id . data ;
bDeformGroup * dg ;
dg = BLI_findlink ( & ob - > defbase , index - 1 ) ;
return ( dg ) ? strlen ( dg - > name ) : 0 ;
}
void rna_object_vgroup_name_index_set ( PointerRNA * ptr , const char * value , short * index )
{
Object * ob = ( Object * ) ptr - > id . data ;
bDeformGroup * dg ;
int a ;
for ( a = 1 , dg = ob - > defbase . first ; dg ; dg = dg - > next , a + + ) {
if ( strcmp ( dg - > name , value ) = = 0 ) {
* index = a ;
return ;
}
}
* index = 0 ;
}
void rna_object_vgroup_name_set ( PointerRNA * ptr , const char * value , char * result , int maxlen )
{
Object * ob = ( Object * ) ptr - > id . data ;
bDeformGroup * dg ;
for ( dg = ob - > defbase . first ; dg ; dg = dg - > next ) {
if ( strcmp ( dg - > name , value ) = = 0 ) {
BLI_strncpy ( result , value , maxlen ) ;
return ;
}
}
BLI_strncpy ( result , " " , maxlen ) ;
}
void rna_object_uvlayer_name_set ( PointerRNA * ptr , const char * value , char * result , int maxlen )
{
Object * ob = ( Object * ) ptr - > id . data ;
Mesh * me ;
CustomDataLayer * layer ;
int a ;
if ( ob - > type = = OB_MESH & & ob - > data ) {
me = ( Mesh * ) ob - > data ;
for ( a = 0 ; a < me - > fdata . totlayer ; a + + ) {
layer = & me - > fdata . layers [ a ] ;
if ( layer - > type = = CD_MTFACE & & strcmp ( layer - > name , value ) = = 0 ) {
BLI_strncpy ( result , value , maxlen ) ;
return ;
}
}
}
BLI_strncpy ( result , " " , maxlen ) ;
}
void rna_object_vcollayer_name_set ( PointerRNA * ptr , const char * value , char * result , int maxlen )
{
Object * ob = ( Object * ) ptr - > id . data ;
Mesh * me ;
CustomDataLayer * layer ;
int a ;
if ( ob - > type = = OB_MESH & & ob - > data ) {
me = ( Mesh * ) ob - > data ;
for ( a = 0 ; a < me - > fdata . totlayer ; a + + ) {
layer = & me - > fdata . layers [ a ] ;
if ( layer - > type = = CD_MCOL & & strcmp ( layer - > name , value ) = = 0 ) {
BLI_strncpy ( result , value , maxlen ) ;
return ;
}
}
}
BLI_strncpy ( result , " " , maxlen ) ;
}
2009-07-02 03:32:57 +00:00
static int rna_Object_active_material_index_get ( PointerRNA * ptr )
{
Object * ob = ( Object * ) ptr - > id . data ;
return MAX2 ( ob - > actcol - 1 , 0 ) ;
}
static void rna_Object_active_material_index_set ( PointerRNA * ptr , int value )
{
Object * ob = ( Object * ) ptr - > id . data ;
ob - > actcol = value + 1 ;
2009-10-07 15:16:08 +00:00
2010-04-04 10:37:47 +00:00
if ( ob - > type = = OB_MESH ) {
2009-10-07 15:16:08 +00:00
Mesh * me = ob - > data ;
if ( me - > edit_mesh )
me - > edit_mesh - > mat_nr = value ;
}
2009-07-02 03:32:57 +00:00
}
2009-01-04 19:25:24 +00:00
static void rna_Object_active_material_index_range ( PointerRNA * ptr , int * min , int * max )
2009-01-02 13:47:33 +00:00
{
Object * ob = ( Object * ) ptr - > id . data ;
2009-07-02 03:32:57 +00:00
* min = 0 ;
* max = MAX2 ( ob - > totcol - 1 , 0 ) ;
2009-01-02 13:47:33 +00:00
}
2009-02-02 19:57:57 +00:00
static PointerRNA rna_Object_active_material_get ( PointerRNA * ptr )
2009-01-04 19:25:24 +00:00
{
Object * ob = ( Object * ) ptr - > id . data ;
2009-07-28 18:54:02 +00:00
Material * ma ;
ma = ( ob - > totcol ) ? give_current_material ( ob , ob - > actcol ) : NULL ;
return rna_pointer_inherit_refine ( ptr , & RNA_Material , ma ) ;
}
static void rna_Object_active_material_set ( PointerRNA * ptr , PointerRNA value )
{
Object * ob = ( Object * ) ptr - > id . data ;
assign_material ( ob , value . data , ob - > actcol ) ;
2009-01-04 19:25:24 +00:00
}
2009-06-27 15:41:47 +00:00
static void rna_Object_active_particle_system_index_range ( PointerRNA * ptr , int * min , int * max )
{
Object * ob = ( Object * ) ptr - > id . data ;
2009-07-02 03:32:57 +00:00
* min = 0 ;
* max = BLI_countlist ( & ob - > particlesystem ) - 1 ;
* max = MAX2 ( 0 , * max ) ;
2009-06-27 15:41:47 +00:00
}
static int rna_Object_active_particle_system_index_get ( PointerRNA * ptr )
{
Object * ob = ( Object * ) ptr - > id . data ;
2009-07-02 03:32:57 +00:00
return psys_get_current_num ( ob ) ;
2009-06-27 15:41:47 +00:00
}
2009-10-09 13:25:54 +00:00
static void rna_Object_active_particle_system_index_set ( PointerRNA * ptr , int value )
2009-06-27 15:41:47 +00:00
{
Object * ob = ( Object * ) ptr - > id . data ;
psys_set_current_num ( ob , value ) ;
}
2009-12-08 17:23:48 +00:00
static void rna_Object_particle_update ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-10-09 13:25:54 +00:00
{
Object * ob = ( Object * ) ptr - > id . data ;
PE_current_changed ( scene , ob ) ;
}
2009-10-08 00:57:00 +00:00
/* rotation - axis-angle */
static void rna_Object_rotation_axis_angle_get ( PointerRNA * ptr , float * value )
{
Object * ob = ptr - > data ;
/* for now, assume that rotation mode is axis-angle */
value [ 0 ] = ob - > rotAngle ;
2009-11-10 20:43:45 +00:00
copy_v3_v3 ( & value [ 1 ] , ob - > rotAxis ) ;
2009-10-08 00:57:00 +00:00
}
/* rotation - axis-angle */
static void rna_Object_rotation_axis_angle_set ( PointerRNA * ptr , const float * value )
{
Object * ob = ptr - > data ;
/* for now, assume that rotation mode is axis-angle */
ob - > rotAngle = value [ 0 ] ;
2009-11-10 20:43:45 +00:00
copy_v3_v3 ( ob - > rotAxis , ( float * ) & value [ 1 ] ) ;
2009-10-08 00:57:00 +00:00
// TODO: validate axis?
}
2009-09-28 10:19:20 +00:00
static void rna_Object_rotation_mode_set ( PointerRNA * ptr , int value )
{
Object * ob = ptr - > data ;
/* use API Method for conversions... */
2009-10-08 00:57:00 +00:00
BKE_rotMode_change_values ( ob - > quat , ob - > rot , ob - > rotAxis , & ob - > rotAngle , ob - > rotmode , ( short ) value ) ;
2009-09-28 10:19:20 +00:00
/* finally, set the new rotation type */
ob - > rotmode = value ;
}
2009-11-04 23:14:20 +00:00
static void rna_Object_dimensions_get ( PointerRNA * ptr , float * value )
2009-10-10 16:17:33 +00:00
{
2009-11-04 23:14:20 +00:00
Object * ob = ptr - > data ;
2010-03-25 06:27:25 +00:00
object_get_dimensions ( ob , value ) ;
2009-10-10 16:17:33 +00:00
}
2009-11-04 23:14:20 +00:00
static void rna_Object_dimensions_set ( PointerRNA * ptr , const float * value )
2009-10-10 16:17:33 +00:00
{
2009-11-04 23:14:20 +00:00
Object * ob = ptr - > data ;
2010-03-25 06:27:25 +00:00
object_set_dimensions ( ob , value ) ;
2009-10-10 16:17:33 +00:00
}
2009-11-25 12:00:31 +00:00
static int rna_Object_location_editable ( PointerRNA * ptr , int index )
{
Object * ob = ( Object * ) ptr - > data ;
/* only if the axis in question is locked, not editable... */
if ( ( index = = 0 ) & & ( ob - > protectflag & OB_LOCK_LOCX ) )
return 0 ;
else if ( ( index = = 1 ) & & ( ob - > protectflag & OB_LOCK_LOCY ) )
return 0 ;
else if ( ( index = = 2 ) & & ( ob - > protectflag & OB_LOCK_LOCZ ) )
return 0 ;
else
return PROP_EDITABLE ;
}
static int rna_Object_scale_editable ( PointerRNA * ptr , int index )
{
Object * ob = ( Object * ) ptr - > data ;
/* only if the axis in question is locked, not editable... */
if ( ( index = = 0 ) & & ( ob - > protectflag & OB_LOCK_SCALEX ) )
return 0 ;
else if ( ( index = = 1 ) & & ( ob - > protectflag & OB_LOCK_SCALEY ) )
return 0 ;
else if ( ( index = = 2 ) & & ( ob - > protectflag & OB_LOCK_SCALEZ ) )
return 0 ;
else
return PROP_EDITABLE ;
}
static int rna_Object_rotation_euler_editable ( PointerRNA * ptr , int index )
{
Object * ob = ( Object * ) ptr - > data ;
/* only if the axis in question is locked, not editable... */
if ( ( index = = 0 ) & & ( ob - > protectflag & OB_LOCK_ROTX ) )
return 0 ;
else if ( ( index = = 1 ) & & ( ob - > protectflag & OB_LOCK_ROTY ) )
return 0 ;
else if ( ( index = = 2 ) & & ( ob - > protectflag & OB_LOCK_ROTZ ) )
return 0 ;
else
return PROP_EDITABLE ;
}
static int rna_Object_rotation_4d_editable ( PointerRNA * ptr , int index )
{
Object * ob = ( Object * ) ptr - > data ;
/* only consider locks if locking components individually... */
if ( ob - > protectflag & OB_LOCK_ROT4D ) {
/* only if the axis in question is locked, not editable... */
if ( ( index = = 0 ) & & ( ob - > protectflag & OB_LOCK_ROTW ) )
return 0 ;
else if ( ( index = = 1 ) & & ( ob - > protectflag & OB_LOCK_ROTX ) )
return 0 ;
else if ( ( index = = 2 ) & & ( ob - > protectflag & OB_LOCK_ROTY ) )
return 0 ;
else if ( ( index = = 3 ) & & ( ob - > protectflag & OB_LOCK_ROTZ ) )
return 0 ;
}
return PROP_EDITABLE ;
}
2009-10-10 16:17:33 +00:00
2009-06-03 23:22:43 +00:00
static PointerRNA rna_MaterialSlot_material_get ( PointerRNA * ptr )
2009-01-02 16:58:09 +00:00
{
Object * ob = ( Object * ) ptr - > id . data ;
2009-06-03 23:22:43 +00:00
Material * ma ;
int index = ( Material * * ) ptr - > data - ob - > mat ;
ma = give_current_material ( ob , index + 1 ) ;
return rna_pointer_inherit_refine ( ptr , & RNA_Material , ma ) ;
2009-01-02 16:58:09 +00:00
}
2009-06-03 23:22:43 +00:00
static void rna_MaterialSlot_material_set ( PointerRNA * ptr , PointerRNA value )
2009-01-02 16:58:09 +00:00
{
Object * ob = ( Object * ) ptr - > id . data ;
2009-06-03 23:22:43 +00:00
int index = ( Material * * ) ptr - > data - ob - > mat ;
assign_material ( ob , value . data , index + 1 ) ;
}
static int rna_MaterialSlot_link_get ( PointerRNA * ptr )
{
Object * ob = ( Object * ) ptr - > id . data ;
int index = ( Material * * ) ptr - > data - ob - > mat ;
2009-07-13 00:40:20 +00:00
return ob - > matbits [ index ] ! = 0 ;
2009-06-03 23:22:43 +00:00
}
static void rna_MaterialSlot_link_set ( PointerRNA * ptr , int value )
{
Object * ob = ( Object * ) ptr - > id . data ;
int index = ( Material * * ) ptr - > data - ob - > mat ;
2009-01-02 16:58:09 +00:00
2009-07-13 00:40:20 +00:00
if ( value ) {
ob - > matbits [ index ] = 1 ;
2009-06-03 23:22:43 +00:00
ob - > colbits | = ( 1 < < index ) ;
2009-07-13 00:40:20 +00:00
}
else {
ob - > matbits [ index ] = 0 ;
2009-06-03 23:22:43 +00:00
ob - > colbits & = ~ ( 1 < < index ) ;
2009-07-13 00:40:20 +00:00
}
2009-06-03 23:22:43 +00:00
}
static int rna_MaterialSlot_name_length ( PointerRNA * ptr )
{
Object * ob = ( Object * ) ptr - > id . data ;
Material * ma ;
int index = ( Material * * ) ptr - > data - ob - > mat ;
ma = give_current_material ( ob , index + 1 ) ;
if ( ma )
2009-06-07 13:09:18 +00:00
return strlen ( ma - > id . name + 2 ) ;
2009-06-03 23:22:43 +00:00
2009-06-07 13:09:18 +00:00
return 0 ;
2009-06-03 23:22:43 +00:00
}
static void rna_MaterialSlot_name_get ( PointerRNA * ptr , char * str )
{
Object * ob = ( Object * ) ptr - > id . data ;
Material * ma ;
int index = ( Material * * ) ptr - > data - ob - > mat ;
ma = give_current_material ( ob , index + 1 ) ;
2009-06-07 13:09:18 +00:00
2009-06-03 23:22:43 +00:00
if ( ma )
2009-06-07 13:09:18 +00:00
strcpy ( str , ma - > id . name + 2 ) ;
else
strcpy ( str , " " ) ;
2009-01-02 16:58:09 +00:00
}
2009-08-04 09:20:48 +00:00
/* why does this have to be so complicated?, can't all this crap be
* moved to in BGE conversion function ? - Campbell *
*
* logic from check_body_type ( )
* */
static int rna_GameObjectSettings_physics_type_get ( PointerRNA * ptr )
{
Object * ob = ( Object * ) ptr - > id . data ;
/* determine the body_type setting based on flags */
if ( ! ( ob - > gameflag & OB_COLLISION ) ) {
if ( ob - > gameflag & OB_OCCLUDER ) {
ob - > body_type = OB_BODY_TYPE_OCCLUDER ;
} else {
ob - > body_type = OB_BODY_TYPE_NO_COLLISION ;
}
} else if ( ob - > gameflag & OB_SENSOR ) {
ob - > body_type = OB_BODY_TYPE_SENSOR ;
} else if ( ! ( ob - > gameflag & OB_DYNAMIC ) ) {
ob - > body_type = OB_BODY_TYPE_STATIC ;
} else if ( ! ( ob - > gameflag & ( OB_RIGID_BODY | OB_SOFT_BODY ) ) ) {
ob - > body_type = OB_BODY_TYPE_DYNAMIC ;
} else if ( ob - > gameflag & OB_RIGID_BODY ) {
ob - > body_type = OB_BODY_TYPE_RIGID ;
} else {
ob - > body_type = OB_BODY_TYPE_SOFT ;
/* create the structure here because we display soft body buttons in the main panel */
if ( ! ob - > bsoft )
ob - > bsoft = bsbNew ( ) ;
}
return ob - > body_type ;
}
static void rna_GameObjectSettings_physics_type_set ( PointerRNA * ptr , int value )
{
Object * ob = ( Object * ) ptr - > id . data ;
ob - > body_type = value ;
switch ( ob - > body_type ) {
case OB_BODY_TYPE_SENSOR :
ob - > gameflag | = OB_SENSOR | OB_COLLISION | OB_GHOST ;
ob - > gameflag & = ~ ( OB_OCCLUDER | OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR | OB_ANISOTROPIC_FRICTION | OB_DO_FH | OB_ROT_FH | OB_COLLISION_RESPONSE ) ;
break ;
case OB_BODY_TYPE_OCCLUDER :
ob - > gameflag | = OB_OCCLUDER ;
ob - > gameflag & = ~ ( OB_SENSOR | OB_COLLISION | OB_DYNAMIC ) ;
break ;
case OB_BODY_TYPE_NO_COLLISION :
ob - > gameflag & = ~ ( OB_SENSOR | OB_COLLISION | OB_OCCLUDER | OB_DYNAMIC ) ;
break ;
case OB_BODY_TYPE_STATIC :
ob - > gameflag | = OB_COLLISION ;
ob - > gameflag & = ~ ( OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_OCCLUDER | OB_SENSOR ) ;
break ;
case OB_BODY_TYPE_DYNAMIC :
ob - > gameflag | = OB_COLLISION | OB_DYNAMIC | OB_ACTOR ;
ob - > gameflag & = ~ ( OB_RIGID_BODY | OB_SOFT_BODY | OB_OCCLUDER | OB_SENSOR ) ;
break ;
case OB_BODY_TYPE_RIGID :
ob - > gameflag | = OB_COLLISION | OB_DYNAMIC | OB_RIGID_BODY | OB_ACTOR ;
ob - > gameflag & = ~ ( OB_SOFT_BODY | OB_OCCLUDER | OB_SENSOR ) ;
break ;
default :
case OB_BODY_TYPE_SOFT :
ob - > gameflag | = OB_COLLISION | OB_DYNAMIC | OB_SOFT_BODY | OB_ACTOR ;
ob - > gameflag & = ~ ( OB_RIGID_BODY | OB_OCCLUDER | OB_SENSOR ) ;
/* assume triangle mesh, if no bounds chosen for soft body */
if ( ( ob - > gameflag & OB_BOUNDS ) & & ( ob - > boundtype < OB_BOUND_POLYH ) )
{
ob - > boundtype = OB_BOUND_POLYH ;
}
/* create a BulletSoftBody structure if not already existing */
if ( ! ob - > bsoft )
ob - > bsoft = bsbNew ( ) ;
break ;
}
}
2009-06-01 11:39:11 +00:00
static PointerRNA rna_Object_active_particle_system_get ( PointerRNA * ptr )
{
Object * ob = ( Object * ) ptr - > id . data ;
ParticleSystem * psys = psys_get_current ( ob ) ;
return rna_pointer_inherit_refine ( ptr , & RNA_ParticleSystem , psys ) ;
}
2009-02-02 19:57:57 +00:00
static PointerRNA rna_Object_game_settings_get ( PointerRNA * ptr )
2009-01-01 20:44:40 +00:00
{
2009-02-02 19:57:57 +00:00
return rna_pointer_inherit_refine ( ptr , & RNA_GameObjectSettings , ptr - > id . data ) ;
2009-01-01 20:44:40 +00:00
}
2009-11-02 11:14:22 +00:00
static unsigned int rna_Object_layer_validate__internal ( const int * values , unsigned int lay )
2009-01-01 20:44:40 +00:00
{
2009-11-05 17:28:10 +00:00
int i , tot = 0 ;
2009-02-02 19:57:57 +00:00
/* ensure we always have some layer selected */
for ( i = 0 ; i < 20 ; i + + )
if ( values [ i ] )
tot + + ;
2009-11-02 11:14:22 +00:00
2009-02-02 19:57:57 +00:00
if ( tot = = 0 )
2009-11-02 11:14:22 +00:00
return 0 ;
2009-01-01 20:44:40 +00:00
2009-02-02 19:57:57 +00:00
for ( i = 0 ; i < 20 ; i + + ) {
2009-11-02 11:14:22 +00:00
if ( values [ i ] ) lay | = ( 1 < < i ) ;
else lay & = ~ ( 1 < < i ) ;
2009-01-01 20:44:40 +00:00
}
2009-11-02 11:14:22 +00:00
return lay ;
}
static void rna_Object_layer_set ( PointerRNA * ptr , const int * values )
{
Object * ob = ( Object * ) ptr - > data ;
unsigned int lay ;
lay = rna_Object_layer_validate__internal ( values , ob - > lay ) ;
if ( lay )
ob - > lay = lay ;
}
static void rna_Base_layer_set ( PointerRNA * ptr , const int * values )
{
Base * base = ( Base * ) ptr - > data ;
unsigned int lay ;
lay = rna_Object_layer_validate__internal ( values , base - > lay ) ;
if ( lay )
base - > lay = lay ;
/* rna_Base_layer_update updates the objects layer */
2009-01-01 20:44:40 +00:00
}
2010-05-14 23:09:55 +00:00
static void rna_GameObjectSettings_state_get ( PointerRNA * ptr , int * values )
{
Object * ob = ( Object * ) ptr - > data ;
int i ;
int all_states = ( ob - > scaflag & OB_ALLSTATE ? 1 : 0 ) ;
memset ( values , 0 , sizeof ( int ) * OB_MAX_STATES ) ;
for ( i = 0 ; i < OB_MAX_STATES ; i + + )
values [ i ] = ( ob - > state & ( 1 < < i ) ) | all_states ;
}
2009-02-02 19:57:57 +00:00
static void rna_GameObjectSettings_state_set ( PointerRNA * ptr , const int * values )
2009-01-01 20:44:40 +00:00
{
Object * ob = ( Object * ) ptr - > data ;
2009-02-03 10:14:29 +00:00
int i , tot = 0 ;
2009-02-02 19:57:57 +00:00
2009-06-07 13:09:18 +00:00
/* ensure we always have some state selected */
2010-05-05 00:12:31 +00:00
for ( i = 0 ; i < OB_MAX_STATES ; i + + )
2009-02-02 19:57:57 +00:00
if ( values [ i ] )
tot + + ;
if ( tot = = 0 )
return ;
2009-01-01 20:44:40 +00:00
2010-05-05 00:12:31 +00:00
for ( i = 0 ; i < OB_MAX_STATES ; i + + ) {
2009-02-02 19:57:57 +00:00
if ( values [ i ] ) ob - > state | = ( 1 < < i ) ;
else ob - > state & = ~ ( 1 < < i ) ;
2009-01-01 20:44:40 +00:00
}
}
2010-05-05 00:12:31 +00:00
static void rna_GameObjectSettings_used_state_get ( PointerRNA * ptr , int * values )
{
Object * ob = ( Object * ) ptr - > data ;
bController * cont ;
memset ( values , 0 , sizeof ( int ) * OB_MAX_STATES ) ;
for ( cont = ob - > controllers . first ; cont ; cont = cont - > next ) {
int i ;
for ( i = 0 ; i < OB_MAX_STATES ; i + + ) {
if ( cont - > state_mask & ( 1 < < i ) )
values [ i ] = 1 ;
}
}
}
2009-07-02 03:32:57 +00:00
static void rna_Object_active_shape_key_index_range ( PointerRNA * ptr , int * min , int * max )
{
Object * ob = ( Object * ) ptr - > id . data ;
Key * key = ob_get_key ( ob ) ;
* min = 0 ;
* max = ( key ) ? BLI_countlist ( & key - > block ) - 1 : 0 ;
* max = MAX2 ( 0 , * max ) ;
}
static int rna_Object_active_shape_key_index_get ( PointerRNA * ptr )
{
Object * ob = ( Object * ) ptr - > id . data ;
return MAX2 ( ob - > shapenr - 1 , 0 ) ;
}
static void rna_Object_active_shape_key_index_set ( PointerRNA * ptr , int value )
{
Object * ob = ( Object * ) ptr - > id . data ;
ob - > shapenr = value + 1 ;
}
2009-07-03 15:23:33 +00:00
static PointerRNA rna_Object_active_shape_key_get ( PointerRNA * ptr )
{
Object * ob = ( Object * ) ptr - > id . data ;
Key * key = ob_get_key ( ob ) ;
KeyBlock * kb ;
PointerRNA keyptr ;
if ( key = = NULL )
return PointerRNA_NULL ;
kb = BLI_findlink ( & key - > block , ob - > shapenr - 1 ) ;
2010-02-03 10:27:31 +00:00
RNA_pointer_create ( ( ID * ) key , & RNA_ShapeKey , kb , & keyptr ) ;
2009-07-03 15:23:33 +00:00
return keyptr ;
}
2009-07-02 19:41:31 +00:00
static PointerRNA rna_Object_field_get ( PointerRNA * ptr )
{
Object * ob = ( Object * ) ptr - > id . data ;
/* weak */
if ( ! ob - > pd )
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
ob - > pd = object_add_collision_fields ( 0 ) ;
2009-07-02 19:41:31 +00:00
return rna_pointer_inherit_refine ( ptr , & RNA_FieldSettings , ob - > pd ) ;
}
static PointerRNA rna_Object_collision_get ( PointerRNA * ptr )
{
Object * ob = ( Object * ) ptr - > id . data ;
/* weak */
if ( ! ob - > pd )
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
ob - > pd = object_add_collision_fields ( 0 ) ;
2009-07-02 19:41:31 +00:00
return rna_pointer_inherit_refine ( ptr , & RNA_CollisionSettings , ob - > pd ) ;
}
2009-11-11 19:58:30 +00:00
static PointerRNA rna_Object_active_constraint_get ( PointerRNA * ptr )
{
Object * ob = ( Object * ) ptr - > id . data ;
2009-11-16 12:33:42 +00:00
bConstraint * con = constraints_get_active ( & ob - > constraints ) ;
2009-11-11 19:58:30 +00:00
return rna_pointer_inherit_refine ( ptr , & RNA_Constraint , con ) ;
}
static void rna_Object_active_constraint_set ( PointerRNA * ptr , PointerRNA value )
{
Object * ob = ( Object * ) ptr - > id . data ;
2009-11-16 12:33:42 +00:00
constraints_set_active ( & ob - > constraints , ( bConstraint * ) value . data ) ;
2009-11-11 19:58:30 +00:00
}
2010-04-06 01:28:39 +00:00
static bConstraint * rna_Object_constraint_new ( Object * object , int type )
2009-11-13 16:08:03 +00:00
{
2009-12-08 17:23:48 +00:00
WM_main_add_notifier ( NC_OBJECT | ND_CONSTRAINT | NA_ADDED , object ) ;
2009-11-13 16:08:03 +00:00
return add_ob_constraint ( object , NULL , type ) ;
}
2010-04-06 01:28:39 +00:00
static int rna_Object_constraint_remove ( Object * object , int index )
2009-11-13 16:08:03 +00:00
{
2009-11-16 11:11:16 +00:00
int ok = remove_constraint_index ( & object - > constraints , index ) ;
if ( ok ) {
2009-11-13 16:08:03 +00:00
ED_object_constraint_set_active ( object , NULL ) ;
2009-12-08 17:23:48 +00:00
WM_main_add_notifier ( NC_OBJECT | ND_CONSTRAINT , object ) ;
2009-11-13 16:08:03 +00:00
}
2009-11-16 11:11:16 +00:00
return ok ;
2009-11-13 16:08:03 +00:00
}
2009-11-28 13:33:56 +00:00
static ModifierData * rna_Object_modifier_new ( Object * object , bContext * C , ReportList * reports , char * name , int type )
{
2010-08-01 12:47:49 +00:00
return ED_object_modifier_add ( reports , CTX_data_main ( C ) , CTX_data_scene ( C ) , object , name , type ) ;
2009-11-28 13:33:56 +00:00
}
static void rna_Object_modifier_remove ( Object * object , bContext * C , ReportList * reports , ModifierData * md )
{
2010-08-01 12:47:49 +00:00
ED_object_modifier_remove ( reports , CTX_data_main ( C ) , CTX_data_scene ( C ) , object , md ) ;
2009-11-28 13:33:56 +00:00
}
2010-02-10 20:29:40 +00:00
static void rna_Object_boundbox_get ( PointerRNA * ptr , float * values )
{
Object * ob = ( Object * ) ptr - > id . data ;
BoundBox * bb = object_get_boundbox ( ob ) ;
if ( bb ) {
memcpy ( values , bb - > vec , sizeof ( bb - > vec ) ) ;
}
else {
memset ( values , - 1.0f , sizeof ( bb - > vec ) ) ;
}
}
2010-08-03 06:51:36 +00:00
/* generic poll functions */
int rna_Lattice_object_poll ( PointerRNA * ptr , PointerRNA value )
{
return ( ( Object * ) value . id . data ) - > type = = OB_LATTICE ;
}
int rna_Curve_object_poll ( PointerRNA * ptr , PointerRNA value )
{
return ( ( Object * ) value . id . data ) - > type = = OB_CURVE ;
}
int rna_Armature_object_poll ( PointerRNA * ptr , PointerRNA value )
{
return ( ( Object * ) value . id . data ) - > type = = OB_ARMATURE ;
}
int rna_Mesh_object_poll ( PointerRNA * ptr , PointerRNA value )
{
return ( ( Object * ) value . id . data ) - > type = = OB_MESH ;
}
int rna_Camera_object_poll ( PointerRNA * ptr , PointerRNA value )
{
return ( ( Object * ) value . id . data ) - > type = = OB_CAMERA ;
}
2008-10-31 23:50:02 +00:00
# else
2009-01-01 20:44:40 +00:00
static void rna_def_vertex_group ( BlenderRNA * brna )
{
StructRNA * srna ;
PropertyRNA * prop ;
srna = RNA_def_struct ( brna , " VertexGroup " , NULL ) ;
RNA_def_struct_sdna ( srna , " bDeformGroup " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_struct_ui_text ( srna , " Vertex Group " , " Group of vertices, used for armature deform and other purposes " ) ;
2009-06-03 23:16:51 +00:00
RNA_def_struct_ui_icon ( srna , ICON_GROUP_VERTEX ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " name " , PROP_STRING , PROP_NONE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Name " , " Vertex group name " ) ;
2009-01-01 20:44:40 +00:00
RNA_def_struct_name_property ( srna , prop ) ;
2009-12-17 06:06:30 +00:00
RNA_def_property_update ( prop , NC_GEOM | ND_DATA | NA_RENAME , NULL ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " index " , PROP_INT , PROP_UNSIGNED ) ;
2009-03-23 13:24:48 +00:00
RNA_def_property_clear_flag ( prop , PROP_EDITABLE ) ;
2009-01-01 20:44:40 +00:00
RNA_def_property_int_funcs ( prop , " rna_VertexGroup_index_get " , NULL , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Index " , " Index number of the vertex group " ) ;
2009-01-01 20:44:40 +00:00
}
2009-06-03 23:22:43 +00:00
static void rna_def_material_slot ( BlenderRNA * brna )
{
StructRNA * srna ;
PropertyRNA * prop ;
static EnumPropertyItem link_items [ ] = {
2009-06-16 00:52:21 +00:00
{ 1 , " OBJECT " , 0 , " Object " , " " } ,
2009-07-13 00:40:20 +00:00
{ 0 , " DATA " , 0 , " Data " , " " } ,
2009-06-16 00:52:21 +00:00
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-06-03 23:22:43 +00:00
/* NOTE: there is no MaterialSlot equivalent in DNA, so the internal
* pointer data points to ob - > mat + index , and we manually implement
* get / set for the properties . */
srna = RNA_def_struct ( brna , " MaterialSlot " , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_struct_ui_text ( srna , " Material Slot " , " Material slot in an object " ) ;
2009-06-03 23:22:43 +00:00
RNA_def_struct_ui_icon ( srna , ICON_MATERIAL_DATA ) ;
prop = RNA_def_property ( srna , " material " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_struct_type ( prop , " Material " ) ;
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
2010-08-03 05:14:59 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_MaterialSlot_material_get " , " rna_MaterialSlot_material_set " , NULL , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Material " , " Material datablock used by this material slot " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_internal_update " ) ;
2009-06-03 23:22:43 +00:00
prop = RNA_def_property ( srna , " link " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_items ( prop , link_items ) ;
RNA_def_property_enum_funcs ( prop , " rna_MaterialSlot_link_get " , " rna_MaterialSlot_link_set " , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Link " , " Link material to object or the object's data " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_internal_update " ) ;
2009-06-03 23:22:43 +00:00
prop = RNA_def_property ( srna , " name " , PROP_STRING , PROP_NONE ) ;
RNA_def_property_string_funcs ( prop , " rna_MaterialSlot_name_get " , " rna_MaterialSlot_name_length " , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Name " , " Material slot name " ) ;
2009-06-03 23:22:43 +00:00
RNA_def_property_clear_flag ( prop , PROP_EDITABLE ) ;
RNA_def_struct_name_property ( srna , prop ) ;
}
2009-01-10 22:57:33 +00:00
static void rna_def_object_game_settings ( BlenderRNA * brna )
2009-01-01 20:44:40 +00:00
{
StructRNA * srna ;
PropertyRNA * prop ;
static EnumPropertyItem body_type_items [ ] = {
2009-08-04 09:20:48 +00:00
{ OB_BODY_TYPE_NO_COLLISION , " NO_COLLISION " , 0 , " No Collision " , " Disable colision for this object " } ,
{ OB_BODY_TYPE_STATIC , " STATIC " , 0 , " Static " , " Stationary object " } ,
{ OB_BODY_TYPE_DYNAMIC , " DYNAMIC " , 0 , " Dynamic " , " Linear physics " } ,
{ OB_BODY_TYPE_RIGID , " RIGID_BODY " , 0 , " Rigid Body " , " Linear and angular physics " } ,
{ OB_BODY_TYPE_SOFT , " SOFT_BODY " , 0 , " Soft Body " , " Soft body " } ,
{ OB_BODY_TYPE_OCCLUDER , " OCCLUDE " , 0 , " Occlude " , " Occluder for optimizing scene rendering " } ,
{ OB_BODY_TYPE_SENSOR , " SENSOR " , 0 , " Sensor " , " Collision Sensor, detects static and dynamic objects but not the other collision sensor objects " } ,
2009-06-16 00:52:21 +00:00
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-01-01 20:44:40 +00:00
2009-01-10 22:57:33 +00:00
srna = RNA_def_struct ( brna , " GameObjectSettings " , NULL ) ;
2009-01-01 20:44:40 +00:00
RNA_def_struct_sdna ( srna , " Object " ) ;
2009-01-10 22:57:33 +00:00
RNA_def_struct_nested ( brna , srna , " Object " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_struct_ui_text ( srna , " Game Object Settings " , " Game engine related settings for the object " ) ;
2009-06-03 23:16:51 +00:00
RNA_def_struct_ui_icon ( srna , ICON_GAME ) ;
2009-01-01 20:44:40 +00:00
2009-01-02 16:58:09 +00:00
/* logic */
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " sensors " , PROP_COLLECTION , PROP_NONE ) ;
RNA_def_property_struct_type ( prop , " Sensor " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Sensors " , " Game engine sensor to detect events " ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " controllers " , PROP_COLLECTION , PROP_NONE ) ;
RNA_def_property_struct_type ( prop , " Controller " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Controllers " , " Game engine controllers to process events, connecting sensor to actuators " ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " actuators " , PROP_COLLECTION , PROP_NONE ) ;
RNA_def_property_struct_type ( prop , " Actuator " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Actuators " , " Game engine actuators to act on events " ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " properties " , PROP_COLLECTION , PROP_NONE ) ;
RNA_def_property_collection_sdna ( prop , NULL , " prop " , NULL ) ;
2009-07-20 16:21:55 +00:00
RNA_def_property_struct_type ( prop , " GameProperty " ) ; /* rna_property.c */
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Properties " , " Game engine properties " ) ;
2009-01-01 20:44:40 +00:00
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " show_sensors " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " scaflag " , OB_SHOWSENS ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Show Sensors " , " Shows sensors for this object in the user interface " ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " show_controllers " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " scaflag " , OB_SHOWCONT ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Show Controllers " , " Shows controllers for this object in the user interface " ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " show_actuators " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " scaflag " , OB_SHOWACT ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Show Actuators " , " Shows actuators for this object in the user interface " ) ;
2009-01-02 16:58:09 +00:00
/* physics */
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " physics_type " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " body_type " ) ;
RNA_def_property_enum_items ( prop , body_type_items ) ;
2009-08-04 09:20:48 +00:00
RNA_def_property_enum_funcs ( prop , " rna_GameObjectSettings_physics_type_get " , " rna_GameObjectSettings_physics_type_set " , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Physics Type " , " Selects the type of physical representation " ) ;
2010-05-06 01:38:17 +00:00
RNA_def_property_update ( prop , NC_LOGIC , NULL ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " actor " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " gameflag " , OB_ACTOR ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Actor " , " Object is detected by the Near and Radar sensor " ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " ghost " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " gameflag " , OB_GHOST ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Ghost " , " Object does not restitute collisions, like a ghost " ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " mass " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_range ( prop , 0.01 , 10000.0 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Mass " , " Mass of the object " ) ;
2009-01-01 20:44:40 +00:00
user interface units, off by default.
- currently only distances work.
- user preferences, edit section to set the units and scale.
- option to display pairs (nicer for imperial display?)
- support for evaluating multiple comma separated values eg: 2',11" ..or.. 5ft, 4mil
- comma separated expressions/values accumulate 1+1,2**3,4cm/3
- attempted fast conversion from a value to a string so button drawing isn't too slow.
* imperial long/short *
- mile, mi
- yard, yd
- foot, '
- inch, "
- thou, mil
* metric long/short *
kilometer, km
meter, m
centimeter, cm
millimeter, mm
micrometer, um
nanometer, nm
picometer, pm
2009-08-11 18:53:01 +00:00
prop = RNA_def_property ( srna , " radius " , PROP_FLOAT , PROP_NONE | PROP_UNIT_LENGTH ) ;
2009-01-01 20:44:40 +00:00
RNA_def_property_float_sdna ( prop , NULL , " inertia " ) ;
RNA_def_property_range ( prop , 0.01 , 10.0 ) ;
2009-08-16 09:47:33 +00:00
RNA_def_property_ui_text ( prop , " Radius " , " Radius of bounding sphere and material physics " ) ;
2009-01-03 05:41:58 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " no_sleeping " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " gameflag " , OB_COLLISION_RESPONSE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " No Sleeping " , " Disable auto (de)activation in physics simulation " ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " damping " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " damping " ) ;
RNA_def_property_range ( prop , 0.0 , 1.0 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Damping " , " General movement damping " ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " rotation_damping " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " rdamping " ) ;
RNA_def_property_range ( prop , 0.0 , 1.0 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Rotation Damping " , " General rotation damping " ) ;
2009-01-01 20:44:40 +00:00
2009-06-20 06:06:13 +00:00
prop = RNA_def_property ( srna , " minimum_velocity " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " min_vel " ) ;
RNA_def_property_range ( prop , 0.0 , 1000.0 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Velocity Min " , " Clamp velocity to this minimum speed (except when totally still) " ) ;
2009-06-20 06:06:13 +00:00
prop = RNA_def_property ( srna , " maximum_velocity " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " max_vel " ) ;
RNA_def_property_range ( prop , 0.0 , 1000.0 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Velocity Max " , " Clamp velocity to this maximum speed " ) ;
2009-06-20 06:06:13 +00:00
/* lock position */
prop = RNA_def_property ( srna , " lock_x_axis " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " gameflag2 " , OB_LOCK_RIGID_BODY_X_AXIS ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Lock X Axis " , " Disable simulation of linear motion along the X axis " ) ;
2009-06-20 06:06:13 +00:00
prop = RNA_def_property ( srna , " lock_y_axis " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " gameflag2 " , OB_LOCK_RIGID_BODY_Y_AXIS ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Lock Y Axis " , " Disable simulation of linear motion along the Y axis " ) ;
2009-06-20 06:06:13 +00:00
prop = RNA_def_property ( srna , " lock_z_axis " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " gameflag2 " , OB_LOCK_RIGID_BODY_Z_AXIS ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Lock Z Axis " , " Disable simulation of linear motion along the Z axis " ) ;
2009-06-20 06:06:13 +00:00
/* lock rotation */
prop = RNA_def_property ( srna , " lock_x_rot_axis " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " gameflag2 " , OB_LOCK_RIGID_BODY_X_ROT_AXIS ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Lock X Rotation Axis " , " Disable simulation of angular motion along the X axis " ) ;
2009-06-20 06:06:13 +00:00
prop = RNA_def_property ( srna , " lock_y_rot_axis " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " gameflag2 " , OB_LOCK_RIGID_BODY_Y_ROT_AXIS ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Lock Y Rotation Axis " , " Disable simulation of angular motion along the Y axis " ) ;
2009-06-20 06:06:13 +00:00
prop = RNA_def_property ( srna , " lock_z_rot_axis " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " gameflag2 " , OB_LOCK_RIGID_BODY_Z_ROT_AXIS ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Lock Z Rotation Axis " , " Disable simulation of angular motion along the Z axis " ) ;
2009-06-20 06:06:13 +00:00
/* is this used anywhere ? */
prop = RNA_def_property ( srna , " use_activity_culling " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_negative_sdna ( prop , NULL , " gameflag2 " , OB_NEVER_DO_ACTIVITY_CULLING ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Lock Z Rotation Axis " , " Disable simulation of angular motion along the Z axis " ) ;
2009-06-20 06:06:13 +00:00
2009-08-16 09:47:33 +00:00
prop = RNA_def_property ( srna , " material_physics " , PROP_BOOLEAN , PROP_NONE ) ;
2009-01-01 20:44:40 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " gameflag " , OB_DO_FH ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Use Material Physics " , " Use physics settings in materials " ) ;
2009-01-01 20:44:40 +00:00
2009-08-16 09:47:33 +00:00
prop = RNA_def_property ( srna , " rotate_from_normal " , PROP_BOOLEAN , PROP_NONE ) ;
2009-01-01 20:44:40 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " gameflag " , OB_ROT_FH ) ;
2009-08-16 09:47:33 +00:00
RNA_def_property_ui_text ( prop , " Rotate From Normal " , " Use face normal to rotate object, so that it points away from the surface " ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " form_factor " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " formfactor " ) ;
RNA_def_property_range ( prop , 0.0 , 1.0 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Form Factor " , " Form factor scales the inertia tensor " ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " anisotropic_friction " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " gameflag " , OB_ANISOTROPIC_FRICTION ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Anisotropic Friction " , " Enable anisotropic friction " ) ;
2009-01-01 20:44:40 +00:00
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 21:31:05 +00:00
prop = RNA_def_property ( srna , " friction_coefficients " , PROP_FLOAT , PROP_NONE ) ;
2009-01-01 20:44:40 +00:00
RNA_def_property_float_sdna ( prop , NULL , " anisotropicFriction " ) ;
RNA_def_property_range ( prop , 0.0 , 1.0 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Friction Coefficients " , " Relative friction coefficient in the in the X, Y and Z directions, when anisotropic friction is enabled " ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " use_collision_bounds " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " gameflag " , OB_BOUNDS ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Use Collision Bounds " , " Specify a collision bounds type other than the default " ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " collision_bounds " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " boundtype " ) ;
RNA_def_property_enum_items ( prop , collision_bounds_items ) ;
2009-12-04 19:06:17 +00:00
RNA_def_property_enum_funcs ( prop , NULL , NULL , " rna_Object_collision_bounds_itemf " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Collision Bounds " , " Selects the collision type " ) ;
2009-10-19 12:19:19 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " collision_compound " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " gameflag " , OB_CHILD ) ;
2010-05-04 05:15:53 +00:00
RNA_def_property_ui_text ( prop , " Collision Compound " , " Add children to form a compound collision object " ) ;
2009-01-01 20:44:40 +00:00
user interface units, off by default.
- currently only distances work.
- user preferences, edit section to set the units and scale.
- option to display pairs (nicer for imperial display?)
- support for evaluating multiple comma separated values eg: 2',11" ..or.. 5ft, 4mil
- comma separated expressions/values accumulate 1+1,2**3,4cm/3
- attempted fast conversion from a value to a string so button drawing isn't too slow.
* imperial long/short *
- mile, mi
- yard, yd
- foot, '
- inch, "
- thou, mil
* metric long/short *
kilometer, km
meter, m
centimeter, cm
millimeter, mm
micrometer, um
nanometer, nm
picometer, pm
2009-08-11 18:53:01 +00:00
prop = RNA_def_property ( srna , " collision_margin " , PROP_FLOAT , PROP_NONE | PROP_UNIT_LENGTH ) ;
2009-01-01 20:44:40 +00:00
RNA_def_property_float_sdna ( prop , NULL , " margin " ) ;
RNA_def_property_range ( prop , 0.0 , 1.0 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Collision Margin " , " Extra margin around object for collision detection, small amount required for stability " ) ;
2009-01-01 20:44:40 +00:00
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " soft_body " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_pointer_sdna ( prop , NULL , " bsoft " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Soft Body Settings " , " Settings for Bullet soft body simulation " ) ;
2009-01-02 16:58:09 +00:00
/* state */
2010-06-16 08:29:40 +00:00
prop = RNA_def_property ( srna , " visible_state " , PROP_BOOLEAN , PROP_LAYER_MEMBER ) ;
2009-01-01 20:44:40 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " state " , 1 ) ;
2010-05-05 00:12:31 +00:00
RNA_def_property_array ( prop , OB_MAX_STATES ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " State " , " State determining which controllers are displayed " ) ;
2010-05-14 23:09:55 +00:00
RNA_def_property_boolean_funcs ( prop , " rna_GameObjectSettings_state_get " , " rna_GameObjectSettings_state_set " ) ;
2009-01-01 20:44:40 +00:00
2010-05-05 00:12:31 +00:00
prop = RNA_def_property ( srna , " used_state " , PROP_BOOLEAN , PROP_LAYER_MEMBER ) ;
RNA_def_property_array ( prop , OB_MAX_STATES ) ;
RNA_def_property_ui_text ( prop , " Used State " , " States which are being used by controllers " ) ;
RNA_def_property_clear_flag ( prop , PROP_EDITABLE ) ;
RNA_def_property_boolean_funcs ( prop , " rna_GameObjectSettings_used_state_get " , NULL ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " initial_state " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " init_state " , 1 ) ;
2010-05-05 00:12:31 +00:00
RNA_def_property_array ( prop , OB_MAX_STATES ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Initial State " , " Initial state when the game starts " ) ;
2009-01-02 13:47:33 +00:00
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " debug_state " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " scaflag " , OB_DEBUGSTATE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Debug State " , " Print state debug info in the game engine " ) ;
2010-05-12 08:34:15 +00:00
RNA_def_property_ui_icon ( prop , ICON_INFO , 0 ) ;
prop = RNA_def_property ( srna , " all_states " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " scaflag " , OB_ALLSTATE ) ;
RNA_def_property_ui_text ( prop , " All " , " Set all state bits " ) ;
prop = RNA_def_property ( srna , " show_state_panel " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " scaflag " , OB_SHOWSTATE ) ;
RNA_def_property_ui_text ( prop , " States " , " Show state panel " ) ;
RNA_def_property_ui_icon ( prop , ICON_DISCLOSURE_TRI_RIGHT , 1 ) ;
2009-01-01 20:44:40 +00:00
}
2009-11-13 16:08:03 +00:00
static void rna_def_object_constraints ( BlenderRNA * brna , PropertyRNA * cprop )
{
StructRNA * srna ;
2009-11-14 08:50:02 +00:00
PropertyRNA * prop ;
2009-11-13 16:08:03 +00:00
FunctionRNA * func ;
PropertyRNA * parm ;
2009-11-16 11:11:16 +00:00
RNA_def_property_srna ( cprop , " ObjectConstraints " ) ;
2009-11-13 16:08:03 +00:00
srna = RNA_def_struct ( brna , " ObjectConstraints " , NULL ) ;
RNA_def_struct_sdna ( srna , " Object " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_struct_ui_text ( srna , " Object Constraints " , " Collection of object constraints " ) ;
2009-11-13 16:08:03 +00:00
/* Collection active property */
2009-11-14 08:50:02 +00:00
prop = RNA_def_property ( srna , " active " , PROP_POINTER , PROP_NONE ) ;
2009-11-13 18:47:20 +00:00
RNA_def_property_struct_type ( prop , " Constraint " ) ;
2010-08-03 05:14:59 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_Object_active_constraint_get " , " rna_Object_active_constraint_set " , NULL , NULL ) ;
2009-11-13 18:47:20 +00:00
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Active Constraint " , " Active Object constraint " ) ;
2009-11-13 16:08:03 +00:00
/* Constraint collection */
2009-11-28 13:33:56 +00:00
func = RNA_def_function ( srna , " new " , " rna_Object_constraint_new " ) ;
2009-11-16 11:11:16 +00:00
RNA_def_function_ui_description ( func , " Add a new constraint to this object " ) ;
2009-11-13 16:08:03 +00:00
/* return type */
parm = RNA_def_pointer ( func , " constraint " , " Constraint " , " " , " New constraint. " ) ;
RNA_def_function_return ( func , parm ) ;
/* object to add */
parm = RNA_def_enum ( func , " type " , constraint_type_items , 1 , " " , " Constraint type to add. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
2009-11-28 13:33:56 +00:00
func = RNA_def_function ( srna , " remove " , " rna_Object_constraint_remove " ) ;
2009-11-13 16:08:03 +00:00
RNA_def_function_ui_description ( func , " Remove a constraint from this object. " ) ;
/* return type */
parm = RNA_def_boolean ( func , " success " , 0 , " Success " , " Removed the constraint successfully. " ) ;
RNA_def_function_return ( func , parm ) ;
/* object to add */
parm = RNA_def_int ( func , " index " , 0 , 0 , INT_MAX , " Index " , " " , 0 , INT_MAX ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
}
2009-11-28 13:33:56 +00:00
/* armature.bones.* */
static void rna_def_object_modifiers ( BlenderRNA * brna , PropertyRNA * cprop )
{
StructRNA * srna ;
FunctionRNA * func ;
PropertyRNA * parm ;
RNA_def_property_srna ( cprop , " ObjectModifiers " ) ;
srna = RNA_def_struct ( brna , " ObjectModifiers " , NULL ) ;
RNA_def_struct_sdna ( srna , " Object " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_struct_ui_text ( srna , " Object Modifiers " , " Collection of object modifiers " ) ;
2009-11-28 13:33:56 +00:00
#if 0
prop = RNA_def_property ( srna , " active " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_struct_type ( prop , " EditBone " ) ;
RNA_def_property_pointer_sdna ( prop , NULL , " act_edbone " ) ;
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Active EditBone " , " Armatures active edit bone " ) ;
2009-11-28 13:33:56 +00:00
//RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update");
2010-08-03 05:14:59 +00:00
RNA_def_property_pointer_funcs ( prop , NULL , " rna_Armature_act_edit_bone_set " , NULL , NULL ) ;
2009-11-28 13:33:56 +00:00
/* todo, redraw */
// RNA_def_property_collection_active(prop, prop_act);
# endif
/* add target */
func = RNA_def_function ( srna , " new " , " rna_Object_modifier_new " ) ;
RNA_def_function_flag ( func , FUNC_USE_CONTEXT | FUNC_USE_REPORTS ) ;
2010-04-15 10:28:32 +00:00
RNA_def_function_ui_description ( func , " Add a new modifier. " ) ;
2009-11-28 13:33:56 +00:00
parm = RNA_def_string ( func , " name " , " Name " , 0 , " " , " New name for the bone. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
/* modifier to add */
parm = RNA_def_enum ( func , " type " , modifier_type_items , 1 , " " , " Modifier type to add. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
/* return type */
parm = RNA_def_pointer ( func , " modifier " , " Modifier " , " " , " Newly created modifier. " ) ;
RNA_def_function_return ( func , parm ) ;
/* remove target */
func = RNA_def_function ( srna , " remove " , " rna_Object_modifier_remove " ) ;
RNA_def_function_flag ( func , FUNC_USE_CONTEXT | FUNC_USE_REPORTS ) ;
RNA_def_function_ui_description ( func , " Remove an existing modifier from the object. " ) ;
/* target to remove*/
parm = RNA_def_pointer ( func , " modifier " , " Modifier " , " " , " Modifier to remove. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
}
2009-06-18 19:48:55 +00:00
static void rna_def_object ( BlenderRNA * brna )
2008-10-31 23:50:02 +00:00
{
2008-11-07 02:58:25 +00:00
StructRNA * srna ;
2008-10-31 23:50:02 +00:00
PropertyRNA * prop ;
2009-01-02 13:47:33 +00:00
2009-04-24 01:17:54 +00:00
static EnumPropertyItem object_type_items [ ] = {
2009-06-16 00:52:21 +00:00
{ OB_EMPTY , " EMPTY " , 0 , " Empty " , " " } ,
{ OB_MESH , " MESH " , 0 , " Mesh " , " " } ,
{ OB_CURVE , " CURVE " , 0 , " Curve " , " " } ,
{ OB_SURF , " SURFACE " , 0 , " Surface " , " " } ,
{ OB_FONT , " TEXT " , 0 , " Text " , " " } ,
{ OB_MBALL , " META " , 0 , " Meta " , " " } ,
{ OB_LAMP , " LAMP " , 0 , " Lamp " , " " } ,
{ OB_CAMERA , " CAMERA " , 0 , " Camera " , " " } ,
{ OB_LATTICE , " LATTICE " , 0 , " Lattice " , " " } ,
{ OB_ARMATURE , " ARMATURE " , 0 , " Armature " , " " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-01-02 13:47:33 +00:00
static EnumPropertyItem empty_drawtype_items [ ] = {
2009-06-16 00:52:21 +00:00
{ OB_ARROWS , " ARROWS " , 0 , " Arrows " , " " } ,
{ OB_SINGLE_ARROW , " SINGLE_ARROW " , 0 , " Single Arrow " , " " } ,
{ OB_PLAINAXES , " PLAIN_AXES " , 0 , " Plain Axes " , " " } ,
{ OB_CIRCLE , " CIRCLE " , 0 , " Circle " , " " } ,
{ OB_CUBE , " CUBE " , 0 , " Cube " , " " } ,
{ OB_EMPTY_SPHERE , " SPHERE " , 0 , " Sphere " , " " } ,
{ OB_EMPTY_CONE , " CONE " , 0 , " Cone " , " " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-01-02 16:58:09 +00:00
static EnumPropertyItem track_items [ ] = {
2010-01-27 15:29:21 +00:00
{ OB_POSX , " POS_X " , 0 , " +X " , " " } ,
{ OB_POSY , " POS_Y " , 0 , " +Y " , " " } ,
{ OB_POSZ , " POS_Z " , 0 , " +Z " , " " } ,
{ OB_NEGX , " NEG_X " , 0 , " -X " , " " } ,
{ OB_NEGY , " NEG_Y " , 0 , " -Y " , " " } ,
{ OB_NEGZ , " NEG_Z " , 0 , " -Z " , " " } ,
2009-06-16 00:52:21 +00:00
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-01-02 16:58:09 +00:00
static EnumPropertyItem up_items [ ] = {
2009-06-16 00:52:21 +00:00
{ OB_POSX , " X " , 0 , " X " , " " } ,
{ OB_POSY , " Y " , 0 , " Y " , " " } ,
{ OB_POSZ , " Z " , 0 , " Z " , " " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-01-02 16:58:09 +00:00
static EnumPropertyItem drawtype_items [ ] = {
2009-06-16 00:52:21 +00:00
{ OB_BOUNDBOX , " BOUNDS " , 0 , " Bounds " , " " } ,
{ OB_WIRE , " WIRE " , 0 , " Wire " , " " } ,
{ OB_SOLID , " SOLID " , 0 , " Solid " , " " } ,
2009-11-26 06:25:25 +00:00
// disabled {OB_SHADED, "SHADED", 0, "Shaded", ""},
2009-06-16 00:52:21 +00:00
{ OB_TEXTURE , " TEXTURED " , 0 , " Textured " , " " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-01-02 13:47:33 +00:00
2009-01-02 16:58:09 +00:00
static EnumPropertyItem boundtype_items [ ] = {
2009-06-16 00:52:21 +00:00
{ OB_BOUND_BOX , " BOX " , 0 , " Box " , " " } ,
{ OB_BOUND_SPHERE , " SPHERE " , 0 , " Sphere " , " " } ,
{ OB_BOUND_CYLINDER , " CYLINDER " , 0 , " Cylinder " , " " } ,
{ OB_BOUND_CONE , " CONE " , 0 , " Cone " , " " } ,
2010-07-09 23:14:07 +00:00
{ OB_BOUND_POLYH , " POLYHEDRON " , 0 , " Polyhedron " , " " } ,
2009-06-16 00:52:21 +00:00
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-01-02 16:58:09 +00:00
2009-04-11 01:43:50 +00:00
static EnumPropertyItem dupli_items [ ] = {
2009-06-16 00:52:21 +00:00
{ 0 , " NONE " , 0 , " None " , " " } ,
2010-02-10 22:18:00 +00:00
{ OB_DUPLIFRAMES , " FRAMES " , 0 , " Frames " , " Make copy of object for every frame " } ,
{ OB_DUPLIVERTS , " VERTS " , 0 , " Verts " , " Duplicate child objects on all vertices " } ,
{ OB_DUPLIFACES , " FACES " , 0 , " Faces " , " Duplicate child objects on all faces " } ,
{ OB_DUPLIGROUP , " GROUP " , 0 , " Group " , " Enable group instancing " } ,
2009-06-16 00:52:21 +00:00
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-09-28 10:19:20 +00:00
// XXX: this RNA enum define is currently duplicated for objects, since there is some text here which is not applicable
static EnumPropertyItem prop_rotmode_items [ ] = {
2010-02-11 01:11:52 +00:00
{ ROT_MODE_QUAT , " QUATERNION " , 0 , " Quaternion (WXYZ) " , " No Gimbal Lock " } ,
2009-09-28 10:19:20 +00:00
{ ROT_MODE_XYZ , " XYZ " , 0 , " XYZ Euler " , " XYZ Rotation Order. Prone to Gimbal Lock. (Default) " } ,
{ ROT_MODE_XZY , " XZY " , 0 , " XZY Euler " , " XZY Rotation Order. Prone to Gimbal Lock " } ,
{ ROT_MODE_YXZ , " YXZ " , 0 , " YXZ Euler " , " YXZ Rotation Order. Prone to Gimbal Lock " } ,
{ ROT_MODE_YZX , " YZX " , 0 , " YZX Euler " , " YZX Rotation Order. Prone to Gimbal Lock " } ,
{ ROT_MODE_ZXY , " ZXY " , 0 , " ZXY Euler " , " ZXY Rotation Order. Prone to Gimbal Lock " } ,
{ ROT_MODE_ZYX , " ZYX " , 0 , " ZYX Euler " , " ZYX Rotation Order. Prone to Gimbal Lock " } ,
2010-02-10 22:18:00 +00:00
{ ROT_MODE_AXISANGLE , " AXIS_ANGLE " , 0 , " Axis Angle " , " Axis Angle (W+XYZ). Defines a rotation around some axis defined by 3D-Vector " } ,
2009-09-28 10:19:20 +00:00
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-12-28 03:45:24 +00:00
static float default_quat [ 4 ] = { 1 , 0 , 0 , 0 } ; /* default quaternion values */
static float default_axisAngle [ 4 ] = { 0 , 0 , 1 , 0 } ; /* default axis-angle rotation values */
2010-02-23 05:02:00 +00:00
static float default_scale [ 3 ] = { 1 , 1 , 1 } ; /* default scale values */
2009-09-09 19:40:46 +00:00
int matrix_dimsize [ ] = { 4 , 4 } ;
2010-02-10 20:29:40 +00:00
int boundbox_dimsize [ ] = { 8 , 3 } ;
Implemented dynamic and multidimensional array support in RNA.
Example code: http://www.pasteall.org/7332/c.
New API functions: http://www.pasteall.org/7330/c.
Maximum number of dimensions is currently limited to 3, but can be increased arbitrarily if needed.
What this means for ID property access:
* MeshFace.verts - dynamic array, size 3 or 4 depending on MFace.v4
* MeshTextureFace.uv - dynamic, 2-dimensional array, size depends on MFace.v4
* Object.matrix - 2-dimensional array
What this means for functions:
* more intuitive API possibility, for example:
Mesh.add_vertices([(x, y, z), (x, y, z), ...])
Mesh.add_faces([(1, 2, 3), (4, 5, 6), ...])
Python part is not complete yet, e.g. it is possible to:
MeshFace.verts = (1, 2, 3) # even if Mesh.verts is (1, 2, 3, 4) and vice-versa
MeshTextureFace.uv = [(0.0, 0.0)] * 4 # only if a corresponding MFace is a quad
but the following won't work:
MeshTextureFace.uv[3] = (0.0, 0.0) # setting uv[3] modifies MTFace.uv[1][0] instead of MTFace.uv[3]
2009-08-25 17:06:36 +00:00
2008-12-19 04:06:24 +00:00
srna = RNA_def_struct ( brna , " Object " , " ID " ) ;
2010-02-10 22:18:00 +00:00
RNA_def_struct_ui_text ( srna , " Object " , " Object datablock defining an object in a scene " ) ;
2009-05-29 15:12:31 +00:00
RNA_def_struct_clear_flag ( srna , STRUCT_ID_REFCOUNT ) ;
2009-06-03 23:16:51 +00:00
RNA_def_struct_ui_icon ( srna , ICON_OBJECT_DATA ) ;
2008-11-07 02:58:25 +00:00
2008-11-18 10:57:06 +00:00
prop = RNA_def_property ( srna , " data " , PROP_POINTER , PROP_NONE ) ;
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
RNA_def_property_struct_type ( prop , " ID " ) ;
2010-08-03 05:14:59 +00:00
RNA_def_property_pointer_funcs ( prop , NULL , " rna_Object_data_set " , " rna_Object_data_typef " , NULL ) ;
2009-06-07 13:09:18 +00:00
RNA_def_property_editable_func ( prop , " rna_Object_data_editable " ) ;
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Data " , " Object data " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , 0 , " rna_Object_internal_update_data " ) ;
2008-10-31 23:50:02 +00:00
2009-07-14 20:27:28 +00:00
prop = RNA_def_property ( srna , " type " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " type " ) ;
RNA_def_property_enum_items ( prop , object_type_items ) ;
RNA_def_property_clear_flag ( prop , PROP_EDITABLE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Type " , " Type of Object " ) ;
2009-07-14 20:27:28 +00:00
2009-08-15 22:35:00 +00:00
prop = RNA_def_property ( srna , " mode " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " mode " ) ;
2009-08-16 05:48:07 +00:00
RNA_def_property_enum_items ( prop , object_mode_items ) ;
RNA_def_property_clear_flag ( prop , PROP_EDITABLE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Mode " , " Object interaction mode " ) ;
2009-08-15 22:35:00 +00:00
2009-09-09 17:39:19 +00:00
prop = RNA_def_property ( srna , " layers " , PROP_BOOLEAN , PROP_LAYER_MEMBER ) ;
2009-01-01 20:44:40 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " lay " , 1 ) ;
RNA_def_property_array ( prop , 20 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Layers " , " Layers the object is on " ) ;
2009-01-01 20:44:40 +00:00
RNA_def_property_boolean_funcs ( prop , NULL , " rna_Object_layer_set " ) ;
2009-12-14 13:15:23 +00:00
RNA_def_property_flag ( prop , PROP_LIB_EXCEPTION ) ;
2009-07-14 20:27:28 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_layer_update " ) ;
2009-01-01 20:44:40 +00:00
2010-07-15 16:56:04 +00:00
prop = RNA_def_property ( srna , " select " , PROP_BOOLEAN , PROP_NONE ) ;
2009-01-02 16:58:09 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , SELECT ) ;
2010-07-15 16:56:04 +00:00
RNA_def_property_ui_text ( prop , " Select " , " Object selection state " ) ;
2009-10-08 07:54:20 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_select_update " ) ;
2009-01-02 16:58:09 +00:00
2010-02-10 20:29:40 +00:00
/* for data access */
prop = RNA_def_property ( srna , " bound_box " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_multi_array ( prop , 2 , boundbox_dimsize ) ;
RNA_def_property_clear_flag ( prop , PROP_EDITABLE ) ;
RNA_def_property_float_funcs ( prop , " rna_Object_boundbox_get " , NULL , NULL ) ;
2010-05-04 05:15:53 +00:00
RNA_def_property_ui_text ( prop , " Bound Box " , " Objects bound box in object-space coordinates " ) ;
2010-02-10 20:29:40 +00:00
2010-03-26 02:57:49 +00:00
/* parent */
2008-11-07 02:58:25 +00:00
prop = RNA_def_property ( srna , " parent " , PROP_POINTER , PROP_NONE ) ;
2010-08-03 05:14:59 +00:00
RNA_def_property_pointer_funcs ( prop , NULL , " rna_Object_parent_set " , NULL , NULL ) ;
2009-10-19 12:13:32 +00:00
RNA_def_property_flag ( prop , PROP_EDITABLE | PROP_ID_SELF_CHECK ) ;
2008-11-14 17:05:25 +00:00
RNA_def_property_ui_text ( prop , " Parent " , " Parent Object " ) ;
2009-07-14 20:27:28 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_dependency_update " ) ;
2009-04-24 01:17:54 +00:00
2009-01-02 13:47:33 +00:00
prop = RNA_def_property ( srna , " parent_type " , PROP_ENUM , PROP_NONE ) ;
2009-07-14 20:27:28 +00:00
RNA_def_property_enum_bitflag_sdna ( prop , NULL , " partype " ) ;
2009-01-02 13:47:33 +00:00
RNA_def_property_enum_items ( prop , parent_type_items ) ;
2009-07-14 20:27:28 +00:00
RNA_def_property_enum_funcs ( prop , NULL , " rna_Object_parent_type_set " , " rna_Object_parent_type_itemf " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Parent Type " , " Type of parent relation " ) ;
2009-07-14 20:27:28 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_dependency_update " ) ;
2009-01-02 13:47:33 +00:00
prop = RNA_def_property ( srna , " parent_vertices " , PROP_INT , PROP_UNSIGNED ) ;
RNA_def_property_int_sdna ( prop , NULL , " par1 " ) ;
RNA_def_property_array ( prop , 3 ) ;
2009-03-23 13:24:48 +00:00
RNA_def_property_clear_flag ( prop , PROP_EDITABLE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Parent Vertices " , " Indices of vertices in cases of a vertex parenting relation " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_internal_update " ) ;
2009-01-02 13:47:33 +00:00
prop = RNA_def_property ( srna , " parent_bone " , PROP_STRING , PROP_NONE ) ;
RNA_def_property_string_sdna ( prop , NULL , " parsubstr " ) ;
2009-07-14 20:27:28 +00:00
RNA_def_property_string_funcs ( prop , NULL , NULL , " rna_Object_parent_bone_set " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Parent Bone " , " Name of parent bone in case of a bone parenting relation " ) ;
2009-07-14 20:27:28 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_dependency_update " ) ;
2010-03-26 02:57:49 +00:00
/* Track and Up flags */
// XXX: these have been saved here for a bit longer (after old track was removed), since some other tools still refer to this
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " track_axis " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " trackflag " ) ;
RNA_def_property_enum_items ( prop , track_items ) ;
2010-03-26 02:57:49 +00:00
RNA_def_property_ui_text ( prop , " Track Axis " , " Axis that points in 'forward' direction " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_internal_update " ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " up_axis " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " upflag " ) ;
RNA_def_property_enum_items ( prop , up_items ) ;
2010-02-17 16:18:41 +00:00
RNA_def_property_ui_text ( prop , " Up Axis " , " Axis that points in the upward direction " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_internal_update " ) ;
2010-03-26 02:57:49 +00:00
2009-01-02 13:47:33 +00:00
/* proxy */
prop = RNA_def_property ( srna , " proxy " , PROP_POINTER , PROP_NONE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Proxy " , " Library object this proxy object controls " ) ;
2009-01-02 13:47:33 +00:00
prop = RNA_def_property ( srna , " proxy_group " , PROP_POINTER , PROP_NONE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Proxy Group " , " Library group duplicator object this proxy object controls " ) ;
2009-01-02 13:47:33 +00:00
/* materials */
2010-02-07 12:51:47 +00:00
prop = RNA_def_property ( srna , " material_slots " , PROP_COLLECTION , PROP_NONE ) ;
2009-01-02 13:47:33 +00:00
RNA_def_property_collection_sdna ( prop , NULL , " mat " , " totcol " ) ;
2009-06-03 23:22:43 +00:00
RNA_def_property_struct_type ( prop , " MaterialSlot " ) ;
2009-11-13 16:08:03 +00:00
RNA_def_property_collection_funcs ( prop , NULL , NULL , NULL , " rna_iterator_array_get " , 0 , 0 , 0 ) ; /* don't dereference pointer! */
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Material Slots " , " Material slots in the object " ) ;
2009-01-02 13:47:33 +00:00
2009-01-04 19:25:24 +00:00
prop = RNA_def_property ( srna , " active_material " , PROP_POINTER , PROP_NONE ) ;
2009-07-28 18:54:02 +00:00
RNA_def_property_struct_type ( prop , " Material " ) ;
2010-08-03 05:14:59 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_Object_active_material_get " , " rna_Object_active_material_set " , NULL , NULL ) ;
2009-07-28 18:54:02 +00:00
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Active Material " , " Active material being displayed " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_internal_update " ) ;
2009-01-04 19:25:24 +00:00
prop = RNA_def_property ( srna , " active_material_index " , PROP_INT , PROP_UNSIGNED ) ;
2009-01-02 13:47:33 +00:00
RNA_def_property_int_sdna ( prop , NULL , " actcol " ) ;
2009-07-02 03:32:57 +00:00
RNA_def_property_int_funcs ( prop , " rna_Object_active_material_index_get " , " rna_Object_active_material_index_set " , " rna_Object_active_material_index_range " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Active Material Index " , " Index of active material slot " ) ;
2009-12-09 22:58:08 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-08-29 18:02:37 +00:00
2009-01-01 20:44:40 +00:00
/* transform */
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 21:31:05 +00:00
prop = RNA_def_property ( srna , " location " , PROP_FLOAT , PROP_TRANSLATION ) ;
2009-01-01 20:44:40 +00:00
RNA_def_property_float_sdna ( prop , NULL , " loc " ) ;
2009-11-25 12:00:31 +00:00
RNA_def_property_editable_array_func ( prop , " rna_Object_location_editable " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Location " , " Location of the object " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-09-28 10:19:20 +00:00
prop = RNA_def_property ( srna , " rotation_quaternion " , PROP_FLOAT , PROP_QUATERNION ) ;
RNA_def_property_float_sdna ( prop , NULL , " quat " ) ;
2009-11-25 12:00:31 +00:00
RNA_def_property_editable_array_func ( prop , " rna_Object_rotation_4d_editable " ) ;
2009-12-28 03:45:24 +00:00
RNA_def_property_float_array_default ( prop , default_quat ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Quaternion Rotation " , " Rotation in Quaternions " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-09-28 10:19:20 +00:00
/* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
* having a single one is better for Keyframing and other property - management situations . . .
*/
prop = RNA_def_property ( srna , " rotation_axis_angle " , PROP_FLOAT , PROP_AXISANGLE ) ;
2010-01-07 22:54:05 +00:00
RNA_def_property_array ( prop , 4 ) ;
2009-10-08 00:57:00 +00:00
RNA_def_property_float_funcs ( prop , " rna_Object_rotation_axis_angle_get " , " rna_Object_rotation_axis_angle_set " , NULL ) ;
2009-11-25 12:00:31 +00:00
RNA_def_property_editable_array_func ( prop , " rna_Object_rotation_4d_editable " ) ;
2009-12-28 03:45:24 +00:00
RNA_def_property_float_array_default ( prop , default_axisAngle ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Axis-Angle Rotation " , " Angle of Rotation for Axis-Angle rotation representation " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2008-12-02 10:10:07 +00:00
2009-09-28 10:19:20 +00:00
prop = RNA_def_property ( srna , " rotation_euler " , PROP_FLOAT , PROP_EULER ) ;
2009-01-01 20:44:40 +00:00
RNA_def_property_float_sdna ( prop , NULL , " rot " ) ;
2009-11-25 12:00:31 +00:00
RNA_def_property_editable_array_func ( prop , " rna_Object_rotation_euler_editable " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Euler Rotation " , " Rotation in Eulers " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-09-28 10:19:20 +00:00
prop = RNA_def_property ( srna , " rotation_mode " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " rotmode " ) ;
RNA_def_property_enum_items ( prop , prop_rotmode_items ) ; // XXX move to using a single define of this someday
RNA_def_property_enum_funcs ( prop , NULL , " rna_Object_rotation_mode_set " , NULL ) ;
RNA_def_property_ui_text ( prop , " Rotation Mode " , " " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2008-12-02 10:10:07 +00:00
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 21:31:05 +00:00
prop = RNA_def_property ( srna , " scale " , PROP_FLOAT , PROP_XYZ ) ;
2009-01-01 20:44:40 +00:00
RNA_def_property_float_sdna ( prop , NULL , " size " ) ;
2009-11-25 12:00:31 +00:00
RNA_def_property_editable_array_func ( prop , " rna_Object_scale_editable " ) ;
2010-02-23 05:02:00 +00:00
RNA_def_property_float_array_default ( prop , default_scale ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Scale " , " Scaling of the object " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-10-10 16:17:33 +00:00
2010-06-05 15:31:55 +00:00
prop = RNA_def_property ( srna , " dimensions " , PROP_FLOAT , PROP_XYZ_LENGTH ) ;
2009-11-04 23:14:20 +00:00
RNA_def_property_array ( prop , 3 ) ;
RNA_def_property_float_funcs ( prop , " rna_Object_dimensions_get " , " rna_Object_dimensions_set " , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Dimensions " , " Absolute bounding box dimensions of the object " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-11-04 23:14:20 +00:00
2009-10-10 16:17:33 +00:00
2009-09-28 10:19:20 +00:00
/* delta transforms */
prop = RNA_def_property ( srna , " delta_location " , PROP_FLOAT , PROP_TRANSLATION ) ;
RNA_def_property_float_sdna ( prop , NULL , " dloc " ) ;
2010-02-17 16:18:41 +00:00
RNA_def_property_ui_text ( prop , " Delta Location " , " Extra translation added to the location of the object " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-09-28 10:19:20 +00:00
prop = RNA_def_property ( srna , " delta_rotation_euler " , PROP_FLOAT , PROP_EULER ) ;
RNA_def_property_float_sdna ( prop , NULL , " drot " ) ;
2010-02-17 16:18:41 +00:00
RNA_def_property_ui_text ( prop , " Delta Rotation (Euler) " , " Extra rotation added to the rotation of the object (when using Euler rotations) " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-09-28 10:19:20 +00:00
prop = RNA_def_property ( srna , " delta_rotation_quaternion " , PROP_FLOAT , PROP_QUATERNION ) ;
RNA_def_property_float_sdna ( prop , NULL , " dquat " ) ;
2009-12-28 03:45:24 +00:00
RNA_def_property_float_array_default ( prop , default_quat ) ;
2010-02-17 16:18:41 +00:00
RNA_def_property_ui_text ( prop , " Delta Rotation (Quaternion) " , " Extra rotation added to the rotation of the object (when using Quaternion rotations) " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-09-28 10:19:20 +00:00
#if 0 // XXX not supported well yet...
prop = RNA_def_property ( srna , " delta_rotation_axis_angle " , PROP_FLOAT , PROP_AXISANGLE ) ;
2009-10-08 00:57:00 +00:00
RNA_def_property_float_sdna ( prop , NULL , " dquat " ) ; // FIXME: this is not a single field any more! (drotAxis and drotAngle)
2009-12-28 03:45:24 +00:00
RNA_def_property_float_array_default ( prop , default_axisAngle ) ;
2010-02-17 16:18:41 +00:00
RNA_def_property_ui_text ( prop , " Delta Rotation (Axis Angle) " , " Extra rotation added to the rotation of the object (when using Axis-Angle rotations) " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-09-28 10:19:20 +00:00
# endif
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 21:31:05 +00:00
prop = RNA_def_property ( srna , " delta_scale " , PROP_FLOAT , PROP_XYZ ) ;
2009-01-01 20:44:40 +00:00
RNA_def_property_float_sdna ( prop , NULL , " dsize " ) ;
2010-02-17 16:18:41 +00:00
RNA_def_property_ui_text ( prop , " Delta Scale " , " Extra scaling added to the scale of the object " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-09-28 10:19:20 +00:00
/* transform locks */
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 21:31:05 +00:00
prop = RNA_def_property ( srna , " lock_location " , PROP_BOOLEAN , PROP_XYZ ) ;
2009-01-02 13:47:33 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " protectflag " , OB_LOCK_LOCX ) ;
RNA_def_property_array ( prop , 3 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Lock Location " , " Lock editing of location in the interface " ) ;
2010-05-07 04:52:10 +00:00
RNA_def_property_ui_icon ( prop , ICON_UNLOCKED , 1 ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-01-02 13:47:33 +00:00
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 21:31:05 +00:00
prop = RNA_def_property ( srna , " lock_rotation " , PROP_BOOLEAN , PROP_XYZ ) ;
2009-01-02 13:47:33 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " protectflag " , OB_LOCK_ROTX ) ;
RNA_def_property_array ( prop , 3 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Lock Rotation " , " Lock editing of rotation in the interface " ) ;
2010-05-07 04:52:10 +00:00
RNA_def_property_ui_icon ( prop , ICON_UNLOCKED , 1 ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-10-01 14:41:45 +00:00
2009-09-28 10:19:20 +00:00
// XXX this is sub-optimal - it really should be included above, but due to technical reasons we can't do this!
prop = RNA_def_property ( srna , " lock_rotation_w " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " protectflag " , OB_LOCK_ROTW ) ;
2010-05-07 04:52:10 +00:00
RNA_def_property_ui_icon ( prop , ICON_UNLOCKED , 1 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Lock Rotation (4D Angle) " , " Lock editing of 'angle' component of four-component rotations in the interface " ) ;
2009-09-28 10:19:20 +00:00
// XXX this needs a better name
prop = RNA_def_property ( srna , " lock_rotations_4d " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " protectflag " , OB_LOCK_ROT4D ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Lock Rotations (4D) " , " Lock editing of four component rotations by components (instead of as Eulers) " ) ;
2009-01-02 13:47:33 +00:00
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 21:31:05 +00:00
prop = RNA_def_property ( srna , " lock_scale " , PROP_BOOLEAN , PROP_XYZ ) ;
2009-01-02 13:47:33 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " protectflag " , OB_LOCK_SCALEX ) ;
RNA_def_property_array ( prop , 3 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Lock Scale " , " Lock editing of scale in the interface " ) ;
2010-05-07 04:52:10 +00:00
RNA_def_property_ui_icon ( prop , ICON_UNLOCKED , 1 ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-01-02 13:47:33 +00:00
2009-06-18 19:48:55 +00:00
/* matrix */
2010-07-03 17:39:29 +00:00
prop = RNA_def_property ( srna , " matrix_world " , PROP_FLOAT , PROP_MATRIX ) ;
2009-06-18 19:48:55 +00:00
RNA_def_property_float_sdna ( prop , NULL , " obmat " ) ;
2009-09-09 19:40:46 +00:00
RNA_def_property_multi_array ( prop , 2 , matrix_dimsize ) ;
2010-07-03 17:39:29 +00:00
RNA_def_property_ui_text ( prop , " Matrix World " , " Worldspace transformation matrix " ) ;
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_matrix_world_update " ) ;
prop = RNA_def_property ( srna , " matrix_local " , PROP_FLOAT , PROP_MATRIX ) ;
RNA_def_property_multi_array ( prop , 2 , matrix_dimsize ) ;
RNA_def_property_ui_text ( prop , " Local Matrix " , " Parent relative transformation matrix " ) ;
RNA_def_property_float_funcs ( prop , " rna_Object_matrix_local_get " , " rna_Object_matrix_local_set " , NULL ) ;
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , NULL ) ;
2009-06-18 19:48:55 +00:00
2009-01-01 20:44:40 +00:00
/* collections */
2008-12-12 23:30:23 +00:00
prop = RNA_def_property ( srna , " constraints " , PROP_COLLECTION , PROP_NONE ) ;
RNA_def_property_struct_type ( prop , " Constraint " ) ;
2010-02-17 16:18:41 +00:00
RNA_def_property_ui_text ( prop , " Constraints " , " Constraints affecting the transformation of the object " ) ;
2009-11-13 16:08:03 +00:00
// RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, 0, "constraints__add", "constraints__remove");
rna_def_object_constraints ( brna , prop ) ;
2009-01-02 13:47:33 +00:00
2008-12-01 13:01:48 +00:00
prop = RNA_def_property ( srna , " modifiers " , PROP_COLLECTION , PROP_NONE ) ;
2008-12-02 23:45:11 +00:00
RNA_def_property_struct_type ( prop , " Modifier " ) ;
2010-02-17 16:18:41 +00:00
RNA_def_property_ui_text ( prop , " Modifiers " , " Modifiers affecting the geometric data of the object " ) ;
2009-11-28 13:33:56 +00:00
rna_def_object_modifiers ( brna , prop ) ;
2008-12-01 13:01:48 +00:00
2009-01-01 20:44:40 +00:00
/* game engine */
2009-09-16 18:04:01 +00:00
prop = RNA_def_property ( srna , " game " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_flag ( prop , PROP_NEVER_NULL ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_struct_type ( prop , " GameObjectSettings " ) ;
2010-08-03 05:14:59 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_Object_game_settings_get " , NULL , NULL , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Game Settings " , " Game engine related settings for the object " ) ;
2008-11-30 14:40:00 +00:00
2009-01-01 20:44:40 +00:00
/* vertex groups */
prop = RNA_def_property ( srna , " vertex_groups " , PROP_COLLECTION , PROP_NONE ) ;
RNA_def_property_collection_sdna ( prop , NULL , " defbase " , NULL ) ;
RNA_def_property_struct_type ( prop , " VertexGroup " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Vertex Groups " , " Vertex groups of the object " ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " active_vertex_group " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_struct_type ( prop , " VertexGroup " ) ;
2010-08-03 05:14:59 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_Object_active_vertex_group_get " , " rna_Object_active_vertex_group_set " , NULL , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Active Vertex Group " , " Vertex groups of the object " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_GEOM | ND_DATA , " rna_Object_internal_update_data " ) ;
2009-07-02 03:32:57 +00:00
prop = RNA_def_property ( srna , " active_vertex_group_index " , PROP_INT , PROP_NONE ) ;
RNA_def_property_int_sdna ( prop , NULL , " actdef " ) ;
RNA_def_property_int_funcs ( prop , " rna_Object_active_vertex_group_index_get " , " rna_Object_active_vertex_group_index_set " , " rna_Object_active_vertex_group_index_range " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Active Vertex Group Index " , " Active index in vertex group array " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_GEOM | ND_DATA , " rna_Object_internal_update_data " ) ;
2009-01-01 20:44:40 +00:00
2009-01-02 13:47:33 +00:00
/* empty */
prop = RNA_def_property ( srna , " empty_draw_type " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " empty_drawtype " ) ;
RNA_def_property_enum_items ( prop , empty_drawtype_items ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Empty Display Type " , " Viewport display style for empties " ) ;
2009-05-11 17:34:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 13:47:33 +00:00
user interface units, off by default.
- currently only distances work.
- user preferences, edit section to set the units and scale.
- option to display pairs (nicer for imperial display?)
- support for evaluating multiple comma separated values eg: 2',11" ..or.. 5ft, 4mil
- comma separated expressions/values accumulate 1+1,2**3,4cm/3
- attempted fast conversion from a value to a string so button drawing isn't too slow.
* imperial long/short *
- mile, mi
- yard, yd
- foot, '
- inch, "
- thou, mil
* metric long/short *
kilometer, km
meter, m
centimeter, cm
millimeter, mm
micrometer, um
nanometer, nm
picometer, pm
2009-08-11 18:53:01 +00:00
prop = RNA_def_property ( srna , " empty_draw_size " , PROP_FLOAT , PROP_DISTANCE ) ;
2009-01-02 13:47:33 +00:00
RNA_def_property_float_sdna ( prop , NULL , " empty_drawsize " ) ;
2010-04-28 21:18:40 +00:00
RNA_def_property_range ( prop , 0.0001f , 1000.0f ) ;
RNA_def_property_ui_range ( prop , 0.01 , 100 , 1 , 2 ) ;
2010-02-24 03:58:26 +00:00
RNA_def_property_ui_text ( prop , " Empty Display Size " , " Size of display for empties in the viewport " ) ;
2009-05-11 17:34:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 13:47:33 +00:00
2009-01-02 16:58:09 +00:00
/* render */
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " pass_index " , PROP_INT , PROP_UNSIGNED ) ;
RNA_def_property_int_sdna ( prop , NULL , " index " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Pass Index " , " Index # for the IndexOB render pass " ) ;
2009-12-17 06:06:30 +00:00
RNA_def_property_update ( prop , NC_OBJECT , NULL ) ;
2009-01-01 20:44:40 +00:00
prop = RNA_def_property ( srna , " color " , PROP_FLOAT , PROP_COLOR ) ;
RNA_def_property_float_sdna ( prop , NULL , " col " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Color " , " Object color and alpha, used when faces have the ObColor mode enabled " ) ;
2009-07-14 20:27:28 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 13:47:33 +00:00
/* physics */
prop = RNA_def_property ( srna , " field " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_pointer_sdna ( prop , NULL , " pd " ) ;
RNA_def_property_struct_type ( prop , " FieldSettings " ) ;
2010-08-03 05:14:59 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_Object_field_get " , NULL , NULL , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Field Settings " , " Settings for using the objects as a field in physics simulation " ) ;
2009-01-02 13:47:33 +00:00
prop = RNA_def_property ( srna , " collision " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_pointer_sdna ( prop , NULL , " pd " ) ;
RNA_def_property_struct_type ( prop , " CollisionSettings " ) ;
2010-08-03 05:14:59 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_Object_collision_get " , NULL , NULL , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Collision Settings " , " Settings for using the objects as a collider in physics simulation " ) ;
2009-01-02 13:47:33 +00:00
prop = RNA_def_property ( srna , " soft_body " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_pointer_sdna ( prop , NULL , " soft " ) ;
2009-11-03 02:49:36 +00:00
RNA_def_property_struct_type ( prop , " SoftBodySettings " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Soft Body Settings " , " Settings for soft body simulation " ) ;
2009-01-02 13:47:33 +00:00
prop = RNA_def_property ( srna , " particle_systems " , PROP_COLLECTION , PROP_NONE ) ;
RNA_def_property_collection_sdna ( prop , NULL , " particlesystem " , NULL ) ;
RNA_def_property_struct_type ( prop , " ParticleSystem " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Particle Systems " , " Particle systems emitted from the object " ) ;
2009-01-02 13:47:33 +00:00
2009-06-01 11:39:11 +00:00
prop = RNA_def_property ( srna , " active_particle_system " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_struct_type ( prop , " ParticleSystem " ) ;
2010-08-03 05:14:59 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_Object_active_particle_system_get " , NULL , NULL , NULL ) ;
2009-06-01 11:39:11 +00:00
RNA_def_property_ui_text ( prop , " Active Particle System " , " Active particle system being displayed " ) ;
2009-07-14 20:27:28 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-06-01 11:39:11 +00:00
2009-06-27 15:41:47 +00:00
prop = RNA_def_property ( srna , " active_particle_system_index " , PROP_INT , PROP_UNSIGNED ) ;
RNA_def_property_int_funcs ( prop , " rna_Object_active_particle_system_index_get " , " rna_Object_active_particle_system_index_set " , " rna_Object_active_particle_system_index_range " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Active Particle System Index " , " Index of active particle system slot " ) ;
2009-10-09 13:25:54 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_particle_update " ) ;
2009-06-27 15:41:47 +00:00
2009-01-02 13:47:33 +00:00
/* restrict */
2010-07-15 16:56:04 +00:00
prop = RNA_def_property ( srna , " hide " , PROP_BOOLEAN , PROP_NONE ) ;
2009-01-02 13:47:33 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " restrictflag " , OB_RESTRICT_VIEW ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Restrict View " , " Restrict visibility in the viewport " ) ;
2010-05-07 03:44:34 +00:00
RNA_def_property_ui_icon ( prop , ICON_RESTRICT_VIEW_OFF , 1 ) ;
2009-01-03 05:41:58 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 13:47:33 +00:00
2010-07-15 16:56:04 +00:00
prop = RNA_def_property ( srna , " hide_select " , PROP_BOOLEAN , PROP_NONE ) ;
2009-01-02 13:47:33 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " restrictflag " , OB_RESTRICT_SELECT ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Restrict Select " , " Restrict selection in the viewport " ) ;
2010-05-07 03:44:34 +00:00
RNA_def_property_ui_icon ( prop , ICON_RESTRICT_SELECT_OFF , 1 ) ;
2009-07-14 20:27:28 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 13:47:33 +00:00
2010-07-15 16:56:04 +00:00
prop = RNA_def_property ( srna , " hide_render " , PROP_BOOLEAN , PROP_NONE ) ;
2009-01-02 13:47:33 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " restrictflag " , OB_RESTRICT_RENDER ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Restrict Render " , " Restrict renderability " ) ;
2010-05-07 03:44:34 +00:00
RNA_def_property_ui_icon ( prop , ICON_RESTRICT_RENDER_OFF , 1 ) ;
2009-07-14 20:27:28 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 16:58:09 +00:00
/* anim */
2009-02-02 11:51:10 +00:00
rna_def_animdata_common ( srna ) ;
2010-01-07 22:54:05 +00:00
rna_def_animviz_common ( srna ) ;
rna_def_motionpath_common ( srna ) ;
2009-09-28 10:19:20 +00:00
/* duplicates */
2010-03-26 02:57:49 +00:00
// XXX: evil old crap
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " slow_parent " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " partype " , PARSLOW ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Slow Parent " , " Create a delay in the parent relationship " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_internal_update " ) ;
2009-01-02 16:58:09 +00:00
2009-04-11 01:43:50 +00:00
prop = RNA_def_property ( srna , " dupli_type " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_bitflag_sdna ( prop , NULL , " transflag " ) ;
RNA_def_property_enum_items ( prop , dupli_items ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Dupli Type " , " If not None, object duplication method to use " ) ;
2009-05-27 00:03:49 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_dependency_update " ) ;
2009-01-02 16:58:09 +00:00
2010-01-04 17:27:23 +00:00
prop = RNA_def_property ( srna , " use_dupli_frames_speed " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_negative_sdna ( prop , NULL , " transflag " , OB_DUPLINOSPEED ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Dupli Frames Speed " , " Set dupliframes to use the frame " ) ; // TODO, better descriptio!
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_internal_update " ) ;
2009-01-02 16:58:09 +00:00
2010-01-04 17:27:23 +00:00
prop = RNA_def_property ( srna , " use_dupli_verts_rotation " , PROP_BOOLEAN , PROP_NONE ) ;
2009-01-02 16:58:09 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " transflag " , OB_DUPLIROT ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Dupli Verts Rotation " , " Rotate dupli according to vertex normal " ) ;
2009-01-03 05:41:58 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 16:58:09 +00:00
2010-01-04 17:27:23 +00:00
prop = RNA_def_property ( srna , " use_dupli_faces_scale " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " transflag " , OB_DUPLIFACES_SCALE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Dupli Faces Inherit Scale " , " Scale dupli based on face size " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_internal_update " ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " dupli_faces_scale " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " dupfacesca " ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_range ( prop , 0.001f , 10000.0f ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Dupli Faces Scale " , " Scale the DupliFace objects " ) ;
2009-01-03 05:41:58 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " dupli_group " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_pointer_sdna ( prop , NULL , " dup_group " ) ;
2009-05-28 23:23:47 +00:00
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Dupli Group " , " Instance an existing group " ) ;
2009-05-28 23:23:47 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_dependency_update " ) ;
2009-01-02 16:58:09 +00:00
user interface units, off by default.
- currently only distances work.
- user preferences, edit section to set the units and scale.
- option to display pairs (nicer for imperial display?)
- support for evaluating multiple comma separated values eg: 2',11" ..or.. 5ft, 4mil
- comma separated expressions/values accumulate 1+1,2**3,4cm/3
- attempted fast conversion from a value to a string so button drawing isn't too slow.
* imperial long/short *
- mile, mi
- yard, yd
- foot, '
- inch, "
- thou, mil
* metric long/short *
kilometer, km
meter, m
centimeter, cm
millimeter, mm
micrometer, um
nanometer, nm
picometer, pm
2009-08-11 18:53:01 +00:00
prop = RNA_def_property ( srna , " dupli_frames_start " , PROP_INT , PROP_NONE | PROP_UNIT_TIME ) ;
2009-01-02 16:58:09 +00:00
RNA_def_property_int_sdna ( prop , NULL , " dupsta " ) ;
2009-10-11 07:29:53 +00:00
RNA_def_property_range ( prop , MINAFRAME , MAXFRAME ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Dupli Frames Start " , " Start frame for DupliFrames " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_internal_update " ) ;
2009-01-02 16:58:09 +00:00
user interface units, off by default.
- currently only distances work.
- user preferences, edit section to set the units and scale.
- option to display pairs (nicer for imperial display?)
- support for evaluating multiple comma separated values eg: 2',11" ..or.. 5ft, 4mil
- comma separated expressions/values accumulate 1+1,2**3,4cm/3
- attempted fast conversion from a value to a string so button drawing isn't too slow.
* imperial long/short *
- mile, mi
- yard, yd
- foot, '
- inch, "
- thou, mil
* metric long/short *
kilometer, km
meter, m
centimeter, cm
millimeter, mm
micrometer, um
nanometer, nm
picometer, pm
2009-08-11 18:53:01 +00:00
prop = RNA_def_property ( srna , " dupli_frames_end " , PROP_INT , PROP_NONE | PROP_UNIT_TIME ) ;
2009-01-02 16:58:09 +00:00
RNA_def_property_int_sdna ( prop , NULL , " dupend " ) ;
2009-10-11 07:29:53 +00:00
RNA_def_property_range ( prop , MINAFRAME , MAXFRAME ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Dupli Frames End " , " End frame for DupliFrames " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_internal_update " ) ;
2009-01-02 16:58:09 +00:00
user interface units, off by default.
- currently only distances work.
- user preferences, edit section to set the units and scale.
- option to display pairs (nicer for imperial display?)
- support for evaluating multiple comma separated values eg: 2',11" ..or.. 5ft, 4mil
- comma separated expressions/values accumulate 1+1,2**3,4cm/3
- attempted fast conversion from a value to a string so button drawing isn't too slow.
* imperial long/short *
- mile, mi
- yard, yd
- foot, '
- inch, "
- thou, mil
* metric long/short *
kilometer, km
meter, m
centimeter, cm
millimeter, mm
micrometer, um
nanometer, nm
picometer, pm
2009-08-11 18:53:01 +00:00
prop = RNA_def_property ( srna , " dupli_frames_on " , PROP_INT , PROP_NONE | PROP_UNIT_TIME ) ;
2009-01-02 16:58:09 +00:00
RNA_def_property_int_sdna ( prop , NULL , " dupon " ) ;
2009-10-11 07:29:53 +00:00
RNA_def_property_range ( prop , MINFRAME , MAXFRAME ) ;
2009-10-10 16:17:33 +00:00
RNA_def_property_ui_range ( prop , 1 , 1500 , 1 , 0 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Dupli Frames On " , " Number of frames to use between DupOff frames " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_internal_update " ) ;
2009-01-02 16:58:09 +00:00
user interface units, off by default.
- currently only distances work.
- user preferences, edit section to set the units and scale.
- option to display pairs (nicer for imperial display?)
- support for evaluating multiple comma separated values eg: 2',11" ..or.. 5ft, 4mil
- comma separated expressions/values accumulate 1+1,2**3,4cm/3
- attempted fast conversion from a value to a string so button drawing isn't too slow.
* imperial long/short *
- mile, mi
- yard, yd
- foot, '
- inch, "
- thou, mil
* metric long/short *
kilometer, km
meter, m
centimeter, cm
millimeter, mm
micrometer, um
nanometer, nm
picometer, pm
2009-08-11 18:53:01 +00:00
prop = RNA_def_property ( srna , " dupli_frames_off " , PROP_INT , PROP_NONE | PROP_UNIT_TIME ) ;
2009-01-02 16:58:09 +00:00
RNA_def_property_int_sdna ( prop , NULL , " dupoff " ) ;
2009-10-10 16:17:33 +00:00
RNA_def_property_range ( prop , 0 , MAXFRAME ) ;
RNA_def_property_ui_range ( prop , 0 , 1500 , 1 , 0 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Dupli Frames Off " , " Recurring frames to exclude from the Dupliframes " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Object_internal_update " ) ;
2009-01-02 16:58:09 +00:00
2009-09-27 09:19:29 +00:00
prop = RNA_def_property ( srna , " dupli_list " , PROP_COLLECTION , PROP_NONE ) ;
RNA_def_property_collection_sdna ( prop , NULL , " duplilist " , NULL ) ;
RNA_def_property_struct_type ( prop , " DupliObject " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Dupli list " , " Object duplis " ) ;
2009-09-27 09:19:29 +00:00
2010-05-02 13:48:32 +00:00
prop = RNA_def_property ( srna , " duplis_used " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " transflag " , OB_DUPLI ) ;
RNA_def_property_clear_flag ( prop , PROP_EDITABLE ) ;
2009-01-02 16:58:09 +00:00
/* time offset */
user interface units, off by default.
- currently only distances work.
- user preferences, edit section to set the units and scale.
- option to display pairs (nicer for imperial display?)
- support for evaluating multiple comma separated values eg: 2',11" ..or.. 5ft, 4mil
- comma separated expressions/values accumulate 1+1,2**3,4cm/3
- attempted fast conversion from a value to a string so button drawing isn't too slow.
* imperial long/short *
- mile, mi
- yard, yd
- foot, '
- inch, "
- thou, mil
* metric long/short *
kilometer, km
meter, m
centimeter, cm
millimeter, mm
micrometer, um
nanometer, nm
picometer, pm
2009-08-11 18:53:01 +00:00
prop = RNA_def_property ( srna , " time_offset " , PROP_FLOAT , PROP_NONE | PROP_UNIT_TIME ) ;
2009-01-02 16:58:09 +00:00
RNA_def_property_float_sdna ( prop , NULL , " sf " ) ;
2009-07-07 06:56:29 +00:00
RNA_def_property_range ( prop , MINAFRAMEF , MAXFRAMEF ) ;
2010-05-09 09:49:55 +00:00
RNA_def_property_ui_text ( prop , " Time Offset " , " Animation offset in frames for F-Curve and dupligroup instances " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " time_offset_edit " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " ipoflag " , OB_OFFS_OB ) ;
2010-05-09 09:49:55 +00:00
RNA_def_property_ui_text ( prop , " Time Offset Edit " , " Use time offset when inserting keys and display time offset for F-Curve and action views " ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " time_offset_parent " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " ipoflag " , OB_OFFS_PARENT ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Time Offset Parent " , " Apply the time offset to this objects parent relationship " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " time_offset_particle " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " ipoflag " , OB_OFFS_PARTICLE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Time Offset Particle " , " Let the time offset work on the particle effect " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " time_offset_add_parent " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " ipoflag " , OB_OFFS_PARENTADD ) ;
RNA_def_property_ui_text ( prop , " Time Offset Add Parent " , " Add the parents time offset value " ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_TRANSFORM , " rna_Object_internal_update " ) ;
2009-01-02 16:58:09 +00:00
/* drawing */
2009-01-10 22:57:33 +00:00
prop = RNA_def_property ( srna , " max_draw_type " , PROP_ENUM , PROP_NONE ) ;
2009-01-02 16:58:09 +00:00
RNA_def_property_enum_sdna ( prop , NULL , " dt " ) ;
RNA_def_property_enum_items ( prop , drawtype_items ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Maximum Draw Type " , " Maximum draw type to display object with in viewport " ) ;
2009-01-03 05:41:58 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " draw_bounds " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " dtx " , OB_BOUNDBOX ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Draw Bounds " , " Displays the object's bounds " ) ;
2009-01-03 05:41:58 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 16:58:09 +00:00
2009-03-13 13:38:41 +00:00
prop = RNA_def_property ( srna , " draw_bounds_type " , PROP_ENUM , PROP_NONE ) ;
2009-01-02 16:58:09 +00:00
RNA_def_property_enum_sdna ( prop , NULL , " boundtype " ) ;
RNA_def_property_enum_items ( prop , boundtype_items ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Draw Bounds Type " , " Object boundary display type " ) ;
2009-01-03 05:41:58 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " draw_name " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " dtx " , OB_DRAWNAME ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Draw Name " , " Displays the object's name " ) ;
2009-01-03 05:41:58 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " draw_axis " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " dtx " , OB_AXIS ) ;
2009-11-30 14:40:45 +00:00
RNA_def_property_ui_text ( prop , " Draw Axis " , " Displays the object's origin and axis " ) ;
2009-01-03 05:41:58 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " draw_texture_space " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " dtx " , OB_TEXSPACE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Draw Texture Space " , " Displays the object's texture space " ) ;
2009-01-03 05:41:58 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " draw_wire " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " dtx " , OB_DRAWWIRE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Draw Wire " , " Adds the object's wireframe over solid drawing " ) ;
2009-01-03 05:41:58 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " draw_transparent " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " dtx " , OB_DRAWTRANSP ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Draw Transparent " , " Enables transparent materials for the object (Mesh only) " ) ;
2009-01-03 05:41:58 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " x_ray " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " dtx " , OB_DRAWXRAY ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " X-Ray " , " Makes the object draw in front of others " ) ;
2009-01-03 05:41:58 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , NULL ) ;
2009-08-28 12:41:45 +00:00
/* Grease Pencil */
prop = RNA_def_property ( srna , " grease_pencil " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_pointer_sdna ( prop , NULL , " gpd " ) ;
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
RNA_def_property_struct_type ( prop , " GreasePencil " ) ;
RNA_def_property_ui_text ( prop , " Grease Pencil Data " , " Grease Pencil datablock " ) ;
2009-02-02 11:51:10 +00:00
/* pose */
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " pose_library " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_pointer_sdna ( prop , NULL , " poselib " ) ;
2009-01-07 04:06:52 +00:00
RNA_def_property_struct_type ( prop , " Action " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Pose Library " , " Action used as a pose library for armatures " ) ;
2009-01-02 16:58:09 +00:00
prop = RNA_def_property ( srna , " pose " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_pointer_sdna ( prop , NULL , " pose " ) ;
2009-01-07 04:06:52 +00:00
RNA_def_property_struct_type ( prop , " Pose " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Pose " , " Current pose for armatures " ) ;
2009-01-02 16:58:09 +00:00
/* shape keys */
prop = RNA_def_property ( srna , " shape_key_lock " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " shapeflag " , OB_SHAPE_LOCK ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Shape Key Lock " , " Always show the current Shape for this Object " ) ;
2009-07-03 15:23:33 +00:00
RNA_def_property_ui_icon ( prop , ICON_UNPINNED , 1 ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , 0 , " rna_Object_internal_update_data " ) ;
2009-01-02 16:58:09 +00:00
2009-10-22 16:35:51 +00:00
prop = RNA_def_property ( srna , " shape_key_edit_mode " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " shapeflag " , OB_SHAPE_EDIT_MODE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Shape Key Edit Mode " , " Apply shape keys in edit mode (for Meshes only) " ) ;
2009-10-22 16:35:51 +00:00
RNA_def_property_ui_icon ( prop , ICON_EDITMODE_HLT , 0 ) ;
2010-06-09 08:24:31 +00:00
RNA_def_property_update ( prop , 0 , " rna_Object_internal_update_data " ) ;
2009-10-22 16:35:51 +00:00
2009-07-03 15:23:33 +00:00
prop = RNA_def_property ( srna , " active_shape_key " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_struct_type ( prop , " ShapeKey " ) ;
2010-08-03 05:14:59 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_Object_active_shape_key_get " , NULL , NULL , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Active Shape Key " , " Current shape key " ) ;
2009-07-03 15:23:33 +00:00
2009-07-02 03:32:57 +00:00
prop = RNA_def_property ( srna , " active_shape_key_index " , PROP_INT , PROP_NONE ) ;
2009-01-02 16:58:09 +00:00
RNA_def_property_int_sdna ( prop , NULL , " shapenr " ) ;
2010-02-02 00:02:55 +00:00
RNA_def_property_clear_flag ( prop , PROP_ANIMATABLE ) ; // XXX this is really unpredictable...
2009-07-02 03:32:57 +00:00
RNA_def_property_int_funcs ( prop , " rna_Object_active_shape_key_index_get " , " rna_Object_active_shape_key_index_set " , " rna_Object_active_shape_key_index_range " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Active Shape Key Index " , " Current shape key index " ) ;
2009-10-22 17:12:28 +00:00
RNA_def_property_update ( prop , 0 , " rna_Object_active_shape_update " ) ;
2009-06-18 19:48:55 +00:00
RNA_api_object ( srna ) ;
2009-01-01 20:44:40 +00:00
}
2009-06-19 10:40:18 +00:00
static void rna_def_dupli_object ( BlenderRNA * brna )
{
StructRNA * srna ;
PropertyRNA * prop ;
srna = RNA_def_struct ( brna , " DupliObject " , NULL ) ;
RNA_def_struct_sdna ( srna , " DupliObject " ) ;
2010-02-17 16:18:41 +00:00
RNA_def_struct_ui_text ( srna , " Object Duplicate " , " An object duplicate " ) ;
2009-06-19 10:40:18 +00:00
/* RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA); */
prop = RNA_def_property ( srna , " object " , PROP_POINTER , PROP_NONE ) ;
2009-06-20 20:08:11 +00:00
RNA_def_property_pointer_sdna ( prop , NULL , " ob " ) ;
2010-08-03 05:14:59 +00:00
/* RNA_def_property_pointer_funcs(prop, "rna_DupliObject_object_get", NULL, NULL, NULL); */
2010-02-17 16:18:41 +00:00
RNA_def_property_ui_text ( prop , " Object " , " Object being duplicated " ) ;
2009-06-19 10:40:18 +00:00
2010-02-17 16:18:41 +00:00
prop = RNA_def_property ( srna , " object_matrix " , PROP_FLOAT , PROP_MATRIX ) ;
2009-06-19 10:40:18 +00:00
RNA_def_property_float_sdna ( prop , NULL , " omat " ) ;
RNA_def_property_array ( prop , 16 ) ;
2010-02-17 16:18:41 +00:00
RNA_def_property_ui_text ( prop , " Object Matrix " , " Duplicated object transformation matrix " ) ;
2009-06-19 10:40:18 +00:00
prop = RNA_def_property ( srna , " matrix " , PROP_FLOAT , PROP_MATRIX ) ;
RNA_def_property_float_sdna ( prop , NULL , " mat " ) ;
RNA_def_property_array ( prop , 16 ) ;
2010-02-17 16:18:41 +00:00
RNA_def_property_ui_text ( prop , " Object Duplicate Matrix " , " Object duplicate transformation matrix " ) ;
2009-06-19 10:40:18 +00:00
/* TODO: DupliObject has more properties that can be wrapped */
}
2010-05-23 12:14:07 +00:00
static void rna_def_object_base ( BlenderRNA * brna )
2009-11-02 11:14:22 +00:00
{
StructRNA * srna ;
PropertyRNA * prop ;
2009-11-11 09:16:53 +00:00
srna = RNA_def_struct ( brna , " ObjectBase " , NULL ) ;
2009-11-02 11:14:22 +00:00
RNA_def_struct_sdna ( srna , " Base " ) ;
2010-02-17 16:18:41 +00:00
RNA_def_struct_ui_text ( srna , " Object Base " , " An object instance in a scene " ) ;
2009-11-02 11:14:22 +00:00
RNA_def_struct_ui_icon ( srna , ICON_OBJECT_DATA ) ;
prop = RNA_def_property ( srna , " object " , PROP_POINTER , PROP_NONE ) ;
RNA_def_property_pointer_sdna ( prop , NULL , " object " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Object " , " Object this base links to " ) ;
2009-11-02 11:14:22 +00:00
/* same as object layer */
prop = RNA_def_property ( srna , " layers " , PROP_BOOLEAN , PROP_LAYER_MEMBER ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " lay " , 1 ) ;
RNA_def_property_array ( prop , 20 ) ;
2010-02-17 16:18:41 +00:00
RNA_def_property_ui_text ( prop , " Layers " , " Layers the object base is on " ) ;
2009-11-02 11:14:22 +00:00
RNA_def_property_boolean_funcs ( prop , NULL , " rna_Base_layer_set " ) ;
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Base_layer_update " ) ;
2010-02-17 16:18:41 +00:00
2010-07-15 16:56:04 +00:00
prop = RNA_def_property ( srna , " select " , PROP_BOOLEAN , PROP_NONE ) ;
2009-11-02 11:14:22 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , BA_SELECT ) ;
2010-07-15 16:56:04 +00:00
RNA_def_property_ui_text ( prop , " Select " , " Object base selection state " ) ;
2009-11-02 11:14:22 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Base_select_update " ) ;
2010-02-17 16:18:41 +00:00
2010-05-23 12:14:07 +00:00
RNA_api_object_base ( srna ) ;
2009-11-02 11:14:22 +00:00
}
2009-01-01 20:44:40 +00:00
void RNA_def_object ( BlenderRNA * brna )
{
2009-01-10 22:57:33 +00:00
rna_def_object ( brna ) ;
rna_def_object_game_settings ( brna ) ;
2010-05-23 12:14:07 +00:00
rna_def_object_base ( brna ) ;
2009-01-02 13:47:33 +00:00
rna_def_vertex_group ( brna ) ;
2009-06-03 23:22:43 +00:00
rna_def_material_slot ( brna ) ;
2009-06-19 10:40:18 +00:00
rna_def_dupli_object ( brna ) ;
2008-10-31 23:50:02 +00:00
}
2002-10-12 11:37:38 +00:00
# endif
2002-10-30 02:07:20 +00:00