2011-02-23 10:52:22 +00:00
|
|
|
/*
|
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
|
|
|
*/
|
|
|
|
|
2011-02-27 20:20:01 +00:00
|
|
|
/** \file blender/makesrna/intern/rna_object.c
|
|
|
|
* \ingroup RNA
|
|
|
|
*/
|
|
|
|
|
2009-06-03 23:22:43 +00:00
|
|
|
#include <stdio.h>
|
2008-10-31 23:50:02 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2009-10-22 23:22:05 +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"
|
2010-12-19 10:38:02 +00:00
|
|
|
#include "DNA_group_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"
|
2010-11-18 04:26:50 +00:00
|
|
|
#include "DNA_meta_types.h"
|
2008-10-31 23:50:02 +00:00
|
|
|
|
2012-03-24 01:24:58 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2013-12-17 14:42:47 -08:00
|
|
|
#include "BLI_listbase.h"
|
2012-03-24 01:24:58 +00:00
|
|
|
|
2015-01-03 12:05:16 +01:00
|
|
|
#include "BKE_camera.h"
|
2012-12-30 18:27:33 +00:00
|
|
|
#include "BKE_paint.h"
|
2013-04-13 20:31:52 +00:00
|
|
|
#include "BKE_editmesh.h"
|
2013-04-03 11:28:42 +00:00
|
|
|
#include "BKE_group.h" /* needed for BKE_group_object_exists() */
|
2014-11-18 23:52:17 +01:00
|
|
|
#include "BKE_object_deform.h"
|
|
|
|
|
2013-03-07 02:44:55 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
#include "RNA_define.h"
|
|
|
|
#include "RNA_enum_types.h"
|
|
|
|
|
|
|
|
#include "rna_internal.h"
|
|
|
|
|
2013-05-28 19:35:26 +00:00
|
|
|
#include "BLI_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
|
2010-09-07 05:47:34 +00:00
|
|
|
#include "ED_mesh.h"
|
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
#include "WM_api.h"
|
2009-01-01 15:52:51 +00:00
|
|
|
#include "WM_types.h"
|
|
|
|
|
2015-11-23 13:49:52 +11:00
|
|
|
EnumPropertyItem rna_enum_object_mode_items[] = {
|
Fix for [#35224] Transform Orientation - order inconsistency
Fix turned out to remove as much "manual UI" from 3D view header as possible. Mode selector and all transform manipulators/orientations stuff are now RNA-based UI (leaving basically only edit mesh select modes with custom handlers, as they have some quite specific features).
To achieve this, four main modifications were done:
* enum-operator-generated menus are now MENU (i.e. dropdown lists) in headers too.
* All bit-flag enums expanded in ROW buttons now have a handling consistent with e.g. layers, or what we already have for transform manipulators, i.e. clicking select only one element, shift-click to select multiple ones.
* Consequently, the three RNA booleans manipulators flags are merged into a single bit-flag enum (yes, this is also an API change, though I doubt many scripts use it).
* Now the width of enum-based dropdown lists is computed from longest item name in enum, no more from a dummy place holder string (when no label/name is given).
All this allows to remove some code from 3DView/transform areas, that was actually mostly duplicating RNA/operator one.
Also done a few optimizations here and there (among others, do not pass &numitems to RNA_property_enum_items() when you do not need it, saves at least an iteration over enum items to count them).
Many thanks to Brecht for the reviews!
2013-05-12 13:16:11 +00:00
|
|
|
{OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""},
|
|
|
|
{OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""},
|
Pie Menus C code backend.
This commit merges the code in the pie-menu branch.
As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.
Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/
Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments
Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.
Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 10:39:59 +02:00
|
|
|
{OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""},
|
Fix for [#35224] Transform Orientation - order inconsistency
Fix turned out to remove as much "manual UI" from 3D view header as possible. Mode selector and all transform manipulators/orientations stuff are now RNA-based UI (leaving basically only edit mesh select modes with custom handlers, as they have some quite specific features).
To achieve this, four main modifications were done:
* enum-operator-generated menus are now MENU (i.e. dropdown lists) in headers too.
* All bit-flag enums expanded in ROW buttons now have a handling consistent with e.g. layers, or what we already have for transform manipulators, i.e. clicking select only one element, shift-click to select multiple ones.
* Consequently, the three RNA booleans manipulators flags are merged into a single bit-flag enum (yes, this is also an API change, though I doubt many scripts use it).
* Now the width of enum-based dropdown lists is computed from longest item name in enum, no more from a dummy place holder string (when no label/name is given).
All this allows to remove some code from 3DView/transform areas, that was actually mostly duplicating RNA/operator one.
Also done a few optimizations here and there (among others, do not pass &numitems to RNA_property_enum_items() when you do not need it, saves at least an iteration over enum items to count them).
Many thanks to Brecht for the reviews!
2013-05-12 13:16:11 +00:00
|
|
|
{OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""},
|
2009-08-16 05:48:07 +00:00
|
|
|
{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", ""},
|
2015-12-13 21:03:13 +13:00
|
|
|
{OB_MODE_GPENCIL, "GPENCIL_EDIT", ICON_GREASEPENCIL, "Edit Strokes", "Edit Grease Pencil Strokes"},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2009-08-16 05:48:07 +00:00
|
|
|
|
2015-11-23 13:49:52 +11:00
|
|
|
EnumPropertyItem rna_enum_object_empty_drawtype_items[] = {
|
2012-10-05 15:48:39 +00:00
|
|
|
{OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
|
|
|
|
{OB_ARROWS, "ARROWS", 0, "Arrows", ""},
|
|
|
|
{OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
|
|
|
|
{OB_CIRCLE, "CIRCLE", 0, "Circle", ""},
|
|
|
|
{OB_CUBE, "CUBE", 0, "Cube", ""},
|
|
|
|
{OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
|
|
|
|
{OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
|
|
|
|
{OB_EMPTY_IMAGE, "IMAGE", 0, "Image", ""},
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-07-14 20:27:28 +00:00
|
|
|
static EnumPropertyItem parent_type_items[] = {
|
2011-05-15 17:59:48 +00:00
|
|
|
{PAROBJECT, "OBJECT", 0, "Object", "The object is parented to an object"},
|
2009-07-14 20:27:28 +00:00
|
|
|
{PARSKEL, "ARMATURE", 0, "Armature", ""},
|
2012-03-05 23:30:41 +00:00
|
|
|
{PARSKEL, "LATTICE", 0, "Lattice", "The object is parented to a lattice"}, /* PARSKEL reuse will give issues */
|
2011-05-15 17:59:48 +00:00
|
|
|
{PARVERT1, "VERTEX", 0, "Vertex", "The object is parented to a vertex"},
|
2009-07-14 20:27:28 +00:00
|
|
|
{PARVERT3, "VERTEX_3", 0, "3 Vertices", ""},
|
2011-05-15 17:59:48 +00:00
|
|
|
{PARBONE, "BONE", 0, "Bone", "The object is parented to a bone"},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2012-10-05 15:48:39 +00:00
|
|
|
|
2012-12-13 00:41:23 +00:00
|
|
|
#ifndef RNA_RUNTIME
|
2012-12-09 12:43:40 +00:00
|
|
|
static EnumPropertyItem dupli_items[] = {
|
|
|
|
{0, "NONE", 0, "None", ""},
|
|
|
|
{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"},
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2012-12-13 00:41:23 +00:00
|
|
|
#endif
|
2012-12-09 12:43:40 +00:00
|
|
|
|
2009-12-04 19:06:17 +00:00
|
|
|
static EnumPropertyItem collision_bounds_items[] = {
|
BGE: Add icons to collision shapes.
This patch adds icons to the physic collision shapes.
Adding a new capsule shape 'mesh_capsule' icon which represent the shape better then the metaballs icon.
And replace the metaballs icon for the Blender collision shape.
{F206628}
Reviewers: moguri, sybren, agoose77, lordloki, mont29, panzergame, campbellbarton
Reviewed By: lordloki, panzergame, campbellbarton
Projects: #game_engine, #game_ui, #user_interface
Differential Revision: https://developer.blender.org/D1403
2015-10-11 14:32:20 +02:00
|
|
|
{OB_BOUND_BOX, "BOX", ICON_MESH_CUBE, "Box", ""},
|
|
|
|
{OB_BOUND_SPHERE, "SPHERE", ICON_MESH_UVSPHERE, "Sphere", ""},
|
|
|
|
{OB_BOUND_CYLINDER, "CYLINDER", ICON_MESH_CYLINDER, "Cylinder", ""},
|
|
|
|
{OB_BOUND_CONE, "CONE", ICON_MESH_CONE, "Cone", ""},
|
|
|
|
{OB_BOUND_CONVEX_HULL, "CONVEX_HULL", ICON_MESH_ICOSPHERE, "Convex Hull", ""},
|
|
|
|
{OB_BOUND_TRIANGLE_MESH, "TRIANGLE_MESH", ICON_MESH_MONKEY, "Triangle Mesh", ""},
|
|
|
|
{OB_BOUND_CAPSULE, "CAPSULE", ICON_MESH_CAPSULE, "Capsule", ""},
|
2012-03-05 23:30:41 +00:00
|
|
|
/*{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""}, */
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2009-07-14 20:27:28 +00:00
|
|
|
|
2015-11-23 13:49:52 +11:00
|
|
|
EnumPropertyItem rna_enum_metaelem_type_items[] = {
|
2010-11-18 04:26:50 +00:00
|
|
|
{MB_BALL, "BALL", ICON_META_BALL, "Ball", ""},
|
|
|
|
{MB_TUBE, "CAPSULE", ICON_META_CAPSULE, "Capsule", ""},
|
|
|
|
{MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""},
|
2012-03-05 23:30:41 +00:00
|
|
|
{MB_ELIPSOID, "ELLIPSOID", ICON_META_ELLIPSOID, "Ellipsoid", ""}, /* NOTE: typo at original definition! */
|
2010-11-18 04:26:50 +00:00
|
|
|
{MB_CUBE, "CUBE", ICON_META_CUBE, "Cube", ""},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2010-11-18 04:26:50 +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", ""}
|
2010-12-16 09:51:55 +00:00
|
|
|
#define OBTYPE_CU_FONT {OB_FONT, "FONT", 0, "Font", ""}
|
2011-04-21 13:11:51 +00:00
|
|
|
|
2015-11-23 13:49:52 +11:00
|
|
|
EnumPropertyItem rna_enum_object_type_items[] = {
|
2009-09-16 17:43:09 +00:00
|
|
|
{OB_MESH, "MESH", 0, "Mesh", ""},
|
2010-03-23 14:58:36 +00:00
|
|
|
OBTYPE_CU_CURVE,
|
|
|
|
OBTYPE_CU_SURF,
|
2009-09-16 17:43:09 +00:00
|
|
|
{OB_MBALL, "META", 0, "Meta", ""},
|
2010-12-16 09:51:55 +00:00
|
|
|
OBTYPE_CU_FONT,
|
2009-09-16 17:43:09 +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", ""},
|
2011-08-01 11:44:20 +00:00
|
|
|
{OB_SPEAKER, "SPEAKER", 0, "Speaker", ""},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2015-11-23 13:49:52 +11:00
|
|
|
EnumPropertyItem rna_enum_object_type_curve_items[] = {
|
2010-03-23 14:58:36 +00:00
|
|
|
OBTYPE_CU_CURVE,
|
|
|
|
OBTYPE_CU_SURF,
|
2010-12-16 09:51:55 +00:00
|
|
|
OBTYPE_CU_FONT,
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2010-11-30 20:22:26 +00:00
|
|
|
|
2015-11-23 13:49:52 +11:00
|
|
|
EnumPropertyItem rna_enum_object_axis_items[] = {
|
2013-01-21 15:41:00 +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", ""},
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2010-11-30 20:22:26 +00:00
|
|
|
|
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-10-22 23:22:05 +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"
|
2011-01-07 09:50:23 +00:00
|
|
|
#include "DNA_lattice_types.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
#include "DNA_node_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"
|
2013-04-18 08:58:21 +00:00
|
|
|
#include "BKE_global.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"
|
2010-08-22 14:15:28 +00:00
|
|
|
#include "BKE_deform.h"
|
2009-07-14 20:27:28 +00:00
|
|
|
|
|
|
|
#include "ED_object.h"
|
2009-10-22 23:22:05 +00:00
|
|
|
#include "ED_particle.h"
|
2010-08-10 06:36:42 +00:00
|
|
|
#include "ED_curve.h"
|
|
|
|
#include "ED_lattice.h"
|
2009-01-01 15:52:51 +00:00
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
static void rna_Object_internal_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
2009-01-01 15:52:51 +00:00
|
|
|
{
|
2010-12-05 18:59:23 +00:00
|
|
|
DAG_id_tag_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
|
|
|
{
|
2012-03-18 07:38:51 +00:00
|
|
|
/* don't use compat so we get predictable rotation */
|
2014-04-01 11:34:00 +11:00
|
|
|
BKE_object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat, false, true);
|
2010-06-09 08:24:31 +00:00
|
|
|
rna_Object_internal_update(bmain, scene, ptr);
|
2009-08-13 11:14:06 +00:00
|
|
|
}
|
|
|
|
|
2012-06-25 11:43:22 +00:00
|
|
|
static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
|
|
|
|
{
|
|
|
|
DAG_id_type_tag(bmain, ID_OB);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = ptr->id.data;
|
2013-07-12 12:58:01 +00:00
|
|
|
BKE_object_matrix_local_get(ob, (float(*)[4])values);
|
2010-07-03 17:39:29 +00:00
|
|
|
}
|
|
|
|
|
2010-08-03 06:51:36 +00:00
|
|
|
static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
|
2009-10-22 23:22:05 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = ptr->id.data;
|
2014-12-29 15:23:12 +01:00
|
|
|
float local_mat[4][4];
|
2010-07-03 17:39:29 +00:00
|
|
|
|
2014-12-29 15:23:12 +01:00
|
|
|
/* localspace matrix is truly relative to the parent, but parameters stored in object are
|
|
|
|
* relative to parentinv matrix. Undo the parent inverse part before applying it as local matrix. */
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ob->parent) {
|
2010-07-03 17:39:29 +00:00
|
|
|
float invmat[4][4];
|
|
|
|
invert_m4_m4(invmat, ob->parentinv);
|
2014-12-29 15:23:12 +01:00
|
|
|
mul_m4_m4m4(local_mat, invmat, (float(*)[4])values);
|
2010-07-03 17:39:29 +00:00
|
|
|
}
|
|
|
|
else {
|
2014-12-29 15:23:12 +01:00
|
|
|
copy_m4_m4(local_mat, (float(*)[4])values);
|
2010-07-03 17:39:29 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 15:23:12 +01:00
|
|
|
/* don't use compat so we get predictable rotation, and do not use parenting either, because it's a local matrix! */
|
|
|
|
BKE_object_apply_mat4(ob, local_mat, false, false);
|
2010-07-03 17:39:29 +00:00
|
|
|
}
|
|
|
|
|
2010-11-15 06:38:07 +00:00
|
|
|
static void rna_Object_matrix_basis_get(PointerRNA *ptr, float values[16])
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = ptr->id.data;
|
2012-05-05 14:03:12 +00:00
|
|
|
BKE_object_to_mat4(ob, (float(*)[4])values);
|
2010-11-15 06:38:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Object_matrix_basis_set(PointerRNA *ptr, const float values[16])
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = ptr->id.data;
|
2014-04-01 11:34:00 +11:00
|
|
|
BKE_object_apply_mat4(ob, (float(*)[4])values, false, false);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
void rna_Object_internal_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
2009-06-07 13:09:18 +00:00
|
|
|
{
|
2010-12-05 18:59:23 +00:00
|
|
|
DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ptr->id.data);
|
2009-06-07 13:09:18 +00:00
|
|
|
}
|
|
|
|
|
2012-09-22 14:07:55 +00:00
|
|
|
static void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
2009-11-01 00:06:53 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = ptr->id.data;
|
2009-11-01 00:06:53 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (scene->obedit == ob) {
|
2009-11-01 00:06:53 +00:00
|
|
|
/* exit/enter editmode to get new shape */
|
2012-03-05 23:30:41 +00:00
|
|
|
switch (ob->type) {
|
2010-08-10 06:36:42 +00:00
|
|
|
case OB_MESH:
|
2012-03-29 01:41:56 +00:00
|
|
|
EDBM_mesh_load(ob);
|
2016-04-29 22:33:06 +10:00
|
|
|
EDBM_mesh_make(scene->toolsettings, ob, true);
|
2015-12-03 10:44:27 +11:00
|
|
|
|
|
|
|
DAG_id_tag_update(ob->data, 0);
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
EDBM_mesh_normals_update(((Mesh *)ob->data)->edit_btmesh);
|
2013-04-16 05:59:48 +00:00
|
|
|
BKE_editmesh_tessface_calc(((Mesh *)ob->data)->edit_btmesh);
|
2010-08-10 06:36:42 +00:00
|
|
|
break;
|
|
|
|
case OB_CURVE:
|
|
|
|
case OB_SURF:
|
2015-11-18 12:20:28 +11:00
|
|
|
ED_curve_editnurb_load(ob);
|
|
|
|
ED_curve_editnurb_make(ob);
|
2010-08-10 06:36:42 +00:00
|
|
|
break;
|
|
|
|
case OB_LATTICE:
|
2015-11-18 12:20:28 +11:00
|
|
|
ED_lattice_editlatt_load(ob);
|
|
|
|
ED_lattice_editlatt_make(ob);
|
2010-08-10 06:36:42 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-11-01 00:06:53 +00:00
|
|
|
}
|
|
|
|
|
2010-06-09 08:24:31 +00:00
|
|
|
rna_Object_internal_update_data(bmain, scene, ptr);
|
2009-11-01 00:06:53 +00:00
|
|
|
}
|
|
|
|
|
2013-02-21 19:33:04 +00:00
|
|
|
static void rna_Object_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
|
2009-04-11 01:43:50 +00:00
|
|
|
{
|
2010-12-05 18:59:23 +00:00
|
|
|
DAG_id_tag_update(ptr->id.data, OB_RECALC_OB);
|
2013-02-21 19:33:04 +00:00
|
|
|
DAG_relations_tag_update(bmain);
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_PARENT, ptr->id.data);
|
2009-04-11 01:43:50 +00:00
|
|
|
}
|
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
/* when changing the selection flag the scene needs updating */
|
2011-05-31 02:14:25 +00:00
|
|
|
static void rna_Object_select_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
|
2009-10-22 23:22:05 +00:00
|
|
|
{
|
2011-10-07 00:08:40 +00:00
|
|
|
if (scene) {
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2016-04-30 04:04:18 +10:00
|
|
|
short mode = (ob->flag & SELECT) ? BA_SELECT : BA_DESELECT;
|
2012-05-05 14:33:36 +00:00
|
|
|
ED_base_object_select(BKE_scene_base_find(scene, ob), mode);
|
2011-10-07 00:08:40 +00:00
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
static void rna_Base_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
2009-11-02 11:14:22 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Base *base = (Base *)ptr->data;
|
2016-04-30 04:04:18 +10:00
|
|
|
short mode = (base->flag & BA_SELECT) ? BA_SELECT : BA_DESELECT;
|
2009-11-02 11:14:22 +00:00
|
|
|
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 */
|
2012-03-05 23:30:41 +00:00
|
|
|
if (scene == NULL) {
|
2011-07-04 05:23:36 +00:00
|
|
|
/* pass - unlikely but when running scripts on startup it happens */
|
|
|
|
}
|
2012-03-05 23:30:41 +00:00
|
|
|
else if ((ob->lay & scene->lay) && (base->lay & scene->lay)) {
|
2012-05-12 11:01:29 +00:00
|
|
|
/* pass */
|
2011-07-04 05:23:36 +00:00
|
|
|
}
|
2012-03-05 23:30:41 +00:00
|
|
|
else if ((ob->lay & scene->lay) == 0 && (base->lay & scene->lay) == 0) {
|
2009-11-02 11:14:22 +00:00
|
|
|
/* pass */
|
2011-07-04 05:23:36 +00:00
|
|
|
}
|
|
|
|
else {
|
2013-02-21 19:33:04 +00:00
|
|
|
DAG_relations_tag_update(bmain);
|
2009-11-02 11:14:22 +00:00
|
|
|
}
|
2011-11-02 20:56:52 +00:00
|
|
|
|
|
|
|
DAG_id_type_tag(bmain, ID_OB);
|
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
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-07-14 20:27:28 +00:00
|
|
|
Base *base;
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
base = scene ? BKE_scene_base_find(scene, ob) : NULL;
|
2012-03-05 23:30:41 +00:00
|
|
|
if (!base)
|
2009-07-14 20:27:28 +00:00
|
|
|
return;
|
2009-12-21 10:50:32 +00:00
|
|
|
|
2012-08-25 20:16:08 +00:00
|
|
|
SWAP(unsigned 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);
|
2012-03-05 23:30:41 +00:00
|
|
|
ob->lay = base->lay;
|
2010-09-07 05:47:34 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, scene);
|
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
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Base *base = (Base *)ptr->data;
|
|
|
|
Object *ob = (Object *)base->object;
|
2009-11-02 11:14:22 +00:00
|
|
|
|
2010-08-01 12:47:49 +00:00
|
|
|
rna_Object_layer_update__internal(bmain, scene, base, ob);
|
2012-03-05 23:30:41 +00:00
|
|
|
ob->lay = base->lay;
|
2010-09-07 05:47:34 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, scene);
|
2009-07-14 20:27:28 +00:00
|
|
|
}
|
|
|
|
|
2009-06-07 13:09:18 +00:00
|
|
|
static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2012-03-05 23:30:41 +00:00
|
|
|
ID *id = value.data;
|
2009-06-07 13:09:18 +00:00
|
|
|
|
2014-08-21 17:00:35 +10:00
|
|
|
if (ob->mode & OB_MODE_EDIT) {
|
2009-06-07 13:09:18 +00:00
|
|
|
return;
|
2014-08-21 17:00:35 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
/* assigning NULL only for empties */
|
|
|
|
if ((id == NULL) && (ob->type != OB_EMPTY)) {
|
|
|
|
return;
|
|
|
|
}
|
2011-05-09 16:31:54 +00:00
|
|
|
|
|
|
|
if (ob->type == OB_EMPTY) {
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ob->data) {
|
2012-05-12 11:01:29 +00:00
|
|
|
id_us_min((ID *)ob->data);
|
2011-05-09 16:31:54 +00:00
|
|
|
ob->data = NULL;
|
|
|
|
}
|
|
|
|
|
2014-08-21 17:00:35 +10:00
|
|
|
if (!id || GS(id->name) == ID_IM) {
|
2011-05-09 16:31:54 +00:00
|
|
|
id_us_plus(id);
|
|
|
|
ob->data = id;
|
|
|
|
}
|
|
|
|
}
|
2012-03-05 23:30:41 +00:00
|
|
|
else if (ob->type == OB_MESH) {
|
2013-03-17 19:55:10 +00:00
|
|
|
BKE_mesh_assign_object(ob, (Mesh *)id);
|
2009-06-07 13:09:18 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-08-12 14:57:19 +00:00
|
|
|
if (ob->data) {
|
2012-05-12 11:01:29 +00:00
|
|
|
id_us_min((ID *)ob->data);
|
2012-08-12 14:57:19 +00:00
|
|
|
}
|
2014-08-21 17:00:35 +10:00
|
|
|
|
|
|
|
/* no need to type-check here ID. this is done in the _typef() function */
|
|
|
|
BLI_assert(OB_DATA_SUPPORT_ID(GS(id->name)));
|
|
|
|
id_us_plus(id);
|
2009-06-07 13:09:18 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
ob->data = id;
|
2016-07-08 14:36:25 +02:00
|
|
|
test_object_materials(ob, id);
|
2009-06-07 13:09:18 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (GS(id->name) == ID_CU)
|
2012-04-28 16:49:00 +00:00
|
|
|
BKE_curve_type_test(ob);
|
2012-03-05 23:30:41 +00:00
|
|
|
else if (ob->type == OB_ARMATURE)
|
2012-05-05 16:03:57 +00:00
|
|
|
BKE_pose_rebuild(ob, ob->data);
|
2009-06-07 13:09:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2009-06-07 13:09:18 +00:00
|
|
|
|
2012-08-12 14:57:19 +00:00
|
|
|
/* keep in sync with OB_DATA_SUPPORT_ID() macro */
|
2012-03-05 23:30:41 +00:00
|
|
|
switch (ob->type) {
|
2011-05-09 16:31:54 +00:00
|
|
|
case OB_EMPTY: return &RNA_Image;
|
2009-06-07 13:09:18 +00:00
|
|
|
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;
|
2011-08-01 11:44:20 +00:00
|
|
|
case OB_SPEAKER: return &RNA_Speaker;
|
2009-06-07 13:09:18 +00:00
|
|
|
default: return &RNA_ID;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-14 20:27:28 +00:00
|
|
|
static void rna_Object_parent_set(PointerRNA *ptr, PointerRNA value)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
|
|
|
Object *par = (Object *)value.data;
|
2012-05-06 05:03:58 +00:00
|
|
|
|
2012-05-06 12:13:45 +00:00
|
|
|
#ifdef FREE_WINDOWS
|
2012-05-06 05:03:58 +00:00
|
|
|
/* NOTE: this dummy check here prevents this method causing weird runtime errors on mingw 4.6.2 */
|
2012-05-06 12:13:45 +00:00
|
|
|
if (ob)
|
|
|
|
#endif
|
|
|
|
{
|
2012-05-06 05:03:58 +00:00
|
|
|
ED_object_parent(ob, par, ob->partype, ob->parsubstr);
|
|
|
|
}
|
2009-07-14 20:27:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Object_parent_type_set(PointerRNA *ptr, int value)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2009-07-14 20:27:28 +00:00
|
|
|
|
|
|
|
ED_object_parent(ob, ob->parent, value, ob->parsubstr);
|
|
|
|
}
|
|
|
|
|
2011-09-25 09:55:13 +00:00
|
|
|
static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), PointerRNA *ptr,
|
2014-01-04 18:08:43 +11:00
|
|
|
PropertyRNA *UNUSED(prop), bool *r_free)
|
2009-07-14 20:27:28 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2012-03-05 23:30:41 +00:00
|
|
|
EnumPropertyItem *item = NULL;
|
|
|
|
int totitem = 0;
|
2009-07-14 20:27:28 +00:00
|
|
|
|
|
|
|
RNA_enum_items_add_value(&item, &totitem, parent_type_items, PAROBJECT);
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ob->parent) {
|
|
|
|
Object *par = ob->parent;
|
2009-07-19 14:57:20 +00:00
|
|
|
|
2015-06-23 17:35:55 +02:00
|
|
|
if (par->type == OB_LATTICE) {
|
2012-03-18 09:27:36 +00:00
|
|
|
/* special hack: prevents this overriding others */
|
2015-07-25 10:39:04 +02:00
|
|
|
RNA_enum_items_add_value(&item, &totitem, &parent_type_items[2], PARSKEL);
|
2013-07-09 13:50:22 +00:00
|
|
|
}
|
2012-03-05 23:30:41 +00:00
|
|
|
else if (par->type == OB_ARMATURE) {
|
2012-03-18 09:27:36 +00:00
|
|
|
/* special hack: prevents this being overrided */
|
2015-07-25 10:39:04 +02:00
|
|
|
RNA_enum_items_add_value(&item, &totitem, &parent_type_items[1], PARSKEL);
|
2009-07-14 20:27:28 +00:00
|
|
|
RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARBONE);
|
|
|
|
}
|
2013-07-09 13:50:22 +00:00
|
|
|
|
2013-09-01 22:38:41 +00:00
|
|
|
if (OB_TYPE_SUPPORT_PARVERT(par->type)) {
|
2009-07-14 20:27:28 +00:00
|
|
|
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);
|
2014-01-04 18:08:43 +11:00
|
|
|
*r_free = true;
|
2009-07-14 20:27:28 +00:00
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
2014-01-13 21:57:05 +01:00
|
|
|
static void rna_Object_empty_draw_type_set(PointerRNA *ptr, int value)
|
|
|
|
{
|
2014-02-03 13:55:26 +11:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2014-01-13 21:57:05 +01:00
|
|
|
|
2014-02-03 13:55:26 +11:00
|
|
|
BKE_object_empty_draw_type_set(ob, value);
|
2014-01-13 21:57:05 +01:00
|
|
|
}
|
|
|
|
|
2011-09-25 09:55:13 +00:00
|
|
|
static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr,
|
2014-01-04 18:08:43 +11:00
|
|
|
PropertyRNA *UNUSED(prop), bool *r_free)
|
2009-12-04 19:06:17 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2012-03-05 23:30:41 +00:00
|
|
|
EnumPropertyItem *item = NULL;
|
|
|
|
int totitem = 0;
|
2009-12-04 19:06:17 +00:00
|
|
|
|
2014-08-17 19:55:57 +02:00
|
|
|
if (ob->body_type != OB_BODY_TYPE_CHARACTER) {
|
|
|
|
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_TRIANGLE_MESH);
|
|
|
|
}
|
2011-10-13 22:14:41 +00:00
|
|
|
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CONVEX_HULL);
|
2009-12-04 19:06:17 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ob->body_type != OB_BODY_TYPE_SOFT) {
|
2009-12-04 19:06:17 +00:00
|
|
|
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);
|
2010-09-07 05:47:34 +00:00
|
|
|
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CAPSULE);
|
2009-12-04 19:06:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RNA_enum_item_end(&item, &totitem);
|
2014-01-04 18:08:43 +11:00
|
|
|
*r_free = true;
|
2009-12-04 19:06:17 +00:00
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
2009-07-14 20:27:28 +00:00
|
|
|
static void rna_Object_parent_bone_set(PointerRNA *ptr, const char *value)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2009-07-14 20:27:28 +00:00
|
|
|
|
|
|
|
ED_object_parent(ob, ob->parent, ob->partype, value);
|
|
|
|
}
|
|
|
|
|
2010-12-19 10:38:02 +00:00
|
|
|
static void rna_Object_dup_group_set(PointerRNA *ptr, PointerRNA value)
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2010-12-19 10:38:02 +00:00
|
|
|
Group *grp = (Group *)value.data;
|
|
|
|
|
|
|
|
/* must not let this be set if the object belongs in this group already,
|
|
|
|
* thus causing a cycle/infinite-recursion leading to crashes on load [#25298]
|
|
|
|
*/
|
2015-10-16 20:55:23 +11:00
|
|
|
if (BKE_group_object_exists(grp, ob) == 0) {
|
2010-12-19 10:38:02 +00:00
|
|
|
ob->dup_group = grp;
|
2015-10-16 20:55:23 +11:00
|
|
|
id_lib_extern((ID *)grp);
|
|
|
|
}
|
|
|
|
else {
|
2012-03-18 09:27:36 +00:00
|
|
|
BKE_report(NULL, RPT_ERROR,
|
2012-10-21 14:02:30 +00:00
|
|
|
"Cannot set dupli-group as object belongs in group being instanced, thus causing a cycle");
|
2015-10-16 20:55:23 +11:00
|
|
|
}
|
2010-12-19 10:38:02 +00:00
|
|
|
}
|
|
|
|
|
2012-09-22 14:07:55 +00:00
|
|
|
static void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value)
|
2011-06-05 04:52:32 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
|
|
|
bDeformGroup *dg = (bDeformGroup *)ptr->data;
|
2011-09-15 12:26:48 +00:00
|
|
|
BLI_strncpy_utf8(dg->name, value, sizeof(dg->name));
|
2011-06-05 04:52:32 +00:00
|
|
|
defgroup_unique_name(dg, ob);
|
|
|
|
}
|
|
|
|
|
2009-01-01 20:44:40 +00:00
|
|
|
static int rna_VertexGroup_index_get(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +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
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
|
|
|
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)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
|
|
|
return ob->actdef - 1;
|
2009-07-02 03:32:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Object_active_vertex_group_index_set(PointerRNA *ptr, int value)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
|
|
|
ob->actdef = value + 1;
|
2009-07-02 03:32:57 +00:00
|
|
|
}
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static void rna_Object_active_vertex_group_index_range(PointerRNA *ptr, int *min, int *max,
|
|
|
|
int *UNUSED(softmin), int *UNUSED(softmax))
|
2009-07-02 03:32:57 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-07-02 03:32:57 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
*min = 0;
|
2014-11-16 13:57:58 +01:00
|
|
|
*max = max_ii(0, BLI_listbase_count(&ob->defbase) - 1);
|
2009-07-02 03:32:57 +00:00
|
|
|
}
|
|
|
|
|
2009-01-04 19:25:24 +00:00
|
|
|
void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-01-04 19:25:24 +00:00
|
|
|
bDeformGroup *dg;
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
dg = BLI_findlink(&ob->defbase, index - 1);
|
2009-01-04 19:25:24 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (dg) BLI_strncpy(value, dg->name, sizeof(dg->name));
|
|
|
|
else value[0] = '\0';
|
2009-01-04 19:25:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-01-04 19:25:24 +00:00
|
|
|
bDeformGroup *dg;
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
dg = BLI_findlink(&ob->defbase, index - 1);
|
|
|
|
return (dg) ? strlen(dg->name) : 0;
|
2009-01-04 19:25:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2012-03-05 23:30:41 +00:00
|
|
|
*index = defgroup_name_index(ob, value) + 1;
|
2009-01-04 19:25:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2012-03-05 23:30:41 +00:00
|
|
|
bDeformGroup *dg = defgroup_find_name(ob, value);
|
|
|
|
if (dg) {
|
2011-09-15 12:26:48 +00:00
|
|
|
BLI_strncpy(result, value, maxlen); /* no need for BLI_strncpy_utf8, since this matches an existing group */
|
2010-08-22 14:15:28 +00:00
|
|
|
return;
|
2009-01-04 19:25:24 +00:00
|
|
|
}
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
result[0] = '\0';
|
2009-01-04 19:25:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-01-04 19:25:24 +00:00
|
|
|
Mesh *me;
|
|
|
|
CustomDataLayer *layer;
|
|
|
|
int a;
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ob->type == OB_MESH && ob->data) {
|
2012-05-12 11:01:29 +00:00
|
|
|
me = (Mesh *)ob->data;
|
2009-01-04 19:25:24 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
for (a = 0; a < me->pdata.totlayer; a++) {
|
2012-03-07 20:56:25 +00:00
|
|
|
layer = &me->pdata.layers[a];
|
2009-01-04 19:25:24 +00:00
|
|
|
|
2015-01-26 16:03:11 +01:00
|
|
|
if (layer->type == CD_MTEXPOLY && STREQ(layer->name, value)) {
|
2009-01-04 19:25:24 +00:00
|
|
|
BLI_strncpy(result, value, maxlen);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
result[0] = '\0';
|
2009-01-04 19:25:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-01-04 19:25:24 +00:00
|
|
|
Mesh *me;
|
|
|
|
CustomDataLayer *layer;
|
|
|
|
int a;
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ob->type == OB_MESH && ob->data) {
|
2012-05-12 11:01:29 +00:00
|
|
|
me = (Mesh *)ob->data;
|
2009-01-04 19:25:24 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
for (a = 0; a < me->fdata.totlayer; a++) {
|
2012-03-05 23:30:41 +00:00
|
|
|
layer = &me->fdata.layers[a];
|
2009-01-04 19:25:24 +00:00
|
|
|
|
2015-01-26 16:03:11 +01:00
|
|
|
if (layer->type == CD_MCOL && STREQ(layer->name, value)) {
|
2009-01-04 19:25:24 +00:00
|
|
|
BLI_strncpy(result, value, maxlen);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
result[0] = '\0';
|
2009-01-04 19:25:24 +00:00
|
|
|
}
|
|
|
|
|
2009-07-02 03:32:57 +00:00
|
|
|
static int rna_Object_active_material_index_get(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2012-04-23 15:54:43 +00:00
|
|
|
return MAX2(ob->actcol - 1, 0);
|
2009-07-02 03:32:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Object_active_material_index_set(PointerRNA *ptr, int value)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
|
|
|
ob->actcol = value + 1;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ob->type == OB_MESH) {
|
|
|
|
Mesh *me = ob->data;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (me->edit_btmesh)
|
|
|
|
me->edit_btmesh->mat_nr = value;
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
2009-07-02 03:32:57 +00:00
|
|
|
}
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, int *max,
|
|
|
|
int *UNUSED(softmin), int *UNUSED(softmax))
|
2009-01-02 13:47:33 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2012-03-05 23:30:41 +00:00
|
|
|
*min = 0;
|
2012-11-07 12:31:05 +00:00
|
|
|
*max = max_ii(ob->totcol - 1, 0);
|
2009-01-02 13:47:33 +00:00
|
|
|
}
|
|
|
|
|
2010-12-20 13:02:33 +00:00
|
|
|
/* returns active base material */
|
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
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-07-28 18:54:02 +00:00
|
|
|
Material *ma;
|
2010-12-20 13:02:33 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
ma = (ob->totcol) ? give_current_material(ob, ob->actcol) : NULL;
|
2009-07-28 18:54:02 +00:00
|
|
|
return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-07-28 18:54:02 +00:00
|
|
|
|
2010-12-11 16:06:25 +00:00
|
|
|
DAG_id_tag_update(value.data, 0);
|
2015-08-06 18:04:13 +10:00
|
|
|
assign_material(ob, value.data, ob->actcol, BKE_MAT_ASSIGN_EXISTING);
|
2009-01-04 19:25:24 +00:00
|
|
|
}
|
|
|
|
|
2016-09-22 00:10:53 +02:00
|
|
|
static int rna_Object_active_material_editable(PointerRNA *ptr, const char **UNUSED(r_info))
|
2014-05-29 16:16:31 +10:00
|
|
|
{
|
|
|
|
Object *ob = (Object *)ptr->id.data;
|
|
|
|
bool is_editable;
|
|
|
|
|
|
|
|
if ((ob->matbits == NULL) || (ob->actcol == 0) || ob->matbits[ob->actcol - 1]) {
|
2016-07-06 14:11:01 +02:00
|
|
|
is_editable = !ID_IS_LINKED_DATABLOCK(ob);
|
2014-05-29 16:16:31 +10:00
|
|
|
}
|
|
|
|
else {
|
2016-07-06 14:11:01 +02:00
|
|
|
is_editable = ob->data ? !ID_IS_LINKED_DATABLOCK(ob->data) : false;
|
2014-05-29 16:16:31 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
return is_editable ? PROP_EDITABLE : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-15 13:41:07 +00:00
|
|
|
static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int *min, int *max,
|
2013-09-20 06:35:28 +00:00
|
|
|
int *UNUSED(softmin), int *UNUSED(softmax))
|
2009-06-27 15:41:47 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2012-03-05 23:30:41 +00:00
|
|
|
*min = 0;
|
2014-11-16 13:57:58 +01:00
|
|
|
*max = max_ii(0, BLI_listbase_count(&ob->particlesystem) - 1);
|
2009-06-27 15:41:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_Object_active_particle_system_index_get(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
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-22 23:22:05 +00:00
|
|
|
static void rna_Object_active_particle_system_index_set(PointerRNA *ptr, int value)
|
2009-06-27 15:41:47 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-06-27 15:41:47 +00:00
|
|
|
psys_set_current_num(ob, value);
|
|
|
|
}
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
static void rna_Object_particle_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
|
2009-10-22 23:22:05 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
PE_current_changed(scene, ob);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* rotation - axis-angle */
|
|
|
|
static void rna_Object_rotation_axis_angle_get(PointerRNA *ptr, float *value)
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = ptr->data;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
/* for now, assume that rotation mode is axis-angle */
|
2012-03-05 23:30:41 +00:00
|
|
|
value[0] = ob->rotAngle;
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_v3_v3(&value[1], ob->rotAxis);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* rotation - axis-angle */
|
|
|
|
static void rna_Object_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = ptr->data;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
/* for now, assume that rotation mode is axis-angle */
|
2012-03-05 23:30:41 +00:00
|
|
|
ob->rotAngle = value[0];
|
2015-01-01 23:26:03 +11:00
|
|
|
copy_v3_v3(ob->rotAxis, &value[1]);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
/* TODO: validate axis? */
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Object_rotation_mode_set(PointerRNA *ptr, int value)
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = ptr->data;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
/* use API Method for conversions... */
|
|
|
|
BKE_rotMode_change_values(ob->quat, ob->rot, ob->rotAxis, &ob->rotAngle, ob->rotmode, (short)value);
|
|
|
|
|
|
|
|
/* finally, set the new rotation type */
|
2012-03-05 23:30:41 +00:00
|
|
|
ob->rotmode = value;
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 23:14:20 +00:00
|
|
|
static void rna_Object_dimensions_get(PointerRNA *ptr, float *value)
|
2009-10-22 23:22:05 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = ptr->data;
|
2012-05-05 14:03:12 +00:00
|
|
|
BKE_object_dimensions_get(ob, value);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 23:14:20 +00:00
|
|
|
static void rna_Object_dimensions_set(PointerRNA *ptr, const float *value)
|
2009-10-22 23:22:05 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = ptr->data;
|
2012-05-05 14:03:12 +00:00
|
|
|
BKE_object_dimensions_set(ob, value);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
2009-11-25 12:00:31 +00:00
|
|
|
static int rna_Object_location_editable(PointerRNA *ptr, int index)
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2009-11-25 12:00:31 +00:00
|
|
|
|
|
|
|
/* 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)
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2009-11-25 12:00:31 +00:00
|
|
|
|
|
|
|
/* 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)
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2009-11-25 12:00:31 +00:00
|
|
|
|
|
|
|
/* 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)
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2009-11-25 12:00:31 +00:00
|
|
|
|
|
|
|
/* 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-22 23:22:05 +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
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-06-03 23:22:43 +00:00
|
|
|
Material *ma;
|
2012-05-12 11:01:29 +00:00
|
|
|
int index = (Material **)ptr->data - ob->mat;
|
2009-06-03 23:22:43 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
ma = give_current_material(ob, index + 1);
|
2009-06-03 23:22:43 +00:00
|
|
|
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
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
|
|
|
int index = (Material **)ptr->data - ob->mat;
|
2009-06-03 23:22:43 +00:00
|
|
|
|
2015-08-06 18:04:13 +10:00
|
|
|
assign_material(ob, value.data, index + 1, BKE_MAT_ASSIGN_EXISTING);
|
2009-06-03 23:22:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_MaterialSlot_link_get(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
|
|
|
int index = (Material **)ptr->data - ob->mat;
|
2009-06-03 23:22:43 +00:00
|
|
|
|
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)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
|
|
|
int index = (Material **)ptr->data - ob->mat;
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (value) {
|
|
|
|
ob->matbits[index] = 1;
|
2012-10-30 16:33:40 +00:00
|
|
|
/* ob->colbits |= (1 << index); */ /* DEPRECATED */
|
2009-07-13 00:40:20 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-03-05 23:30:41 +00:00
|
|
|
ob->matbits[index] = 0;
|
2012-10-30 16:33:40 +00:00
|
|
|
/* ob->colbits &= ~(1 << index); */ /* DEPRECATED */
|
2009-07-13 00:40:20 +00:00
|
|
|
}
|
2009-06-03 23:22:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_MaterialSlot_name_length(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-06-03 23:22:43 +00:00
|
|
|
Material *ma;
|
2012-05-12 11:01:29 +00:00
|
|
|
int index = (Material **)ptr->data - ob->mat;
|
2009-06-03 23:22:43 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
ma = give_current_material(ob, index + 1);
|
2009-06-03 23:22:43 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ma)
|
2012-05-12 11:01:29 +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)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-06-03 23:22:43 +00:00
|
|
|
Material *ma;
|
2012-05-12 11:01:29 +00:00
|
|
|
int index = (Material **)ptr->data - ob->mat;
|
2009-06-03 23:22:43 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
ma = give_current_material(ob, index + 1);
|
2009-06-07 13:09:18 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ma)
|
2012-05-12 11:01:29 +00:00
|
|
|
strcpy(str, ma->id.name + 2);
|
2009-06-07 13:09:18 +00:00
|
|
|
else
|
2012-03-05 23:30:41 +00:00
|
|
|
str[0] = '\0';
|
2009-01-02 16:58:09 +00:00
|
|
|
}
|
|
|
|
|
2010-10-05 11:55:54 +00:00
|
|
|
static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
rna_Object_internal_update(bmain, scene, ptr);
|
2014-11-14 13:50:10 +01:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, ptr->id.data);
|
2013-08-28 19:22:48 +00:00
|
|
|
WM_main_add_notifier(NC_MATERIAL | ND_SHADING_LINKS, NULL);
|
2015-05-12 13:29:00 +05:00
|
|
|
DAG_relations_tag_update(bmain);
|
2010-10-05 11:55:54 +00:00
|
|
|
}
|
|
|
|
|
2013-10-01 04:49:47 +00:00
|
|
|
static char *rna_MaterialSlot_path(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Object *ob = (Object *)ptr->id.data;
|
|
|
|
int index = (Material **)ptr->data - ob->mat;
|
|
|
|
|
|
|
|
/* from armature... */
|
|
|
|
return BLI_sprintfN("material_slots[%d]", index);
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-08-04 09:20:48 +00:00
|
|
|
|
|
|
|
/* 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;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
else if (ob->gameflag & OB_NAVMESH) {
|
2010-05-27 20:18:56 +00:00
|
|
|
ob->body_type = OB_BODY_TYPE_NAVMESH;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-08-04 09:20:48 +00:00
|
|
|
ob->body_type = OB_BODY_TYPE_NO_COLLISION;
|
|
|
|
}
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
2012-05-28 21:36:29 +00:00
|
|
|
else if (ob->gameflag & OB_CHARACTER) {
|
|
|
|
ob->body_type = OB_BODY_TYPE_CHARACTER;
|
|
|
|
}
|
2012-03-24 06:24:53 +00:00
|
|
|
else if (ob->gameflag & OB_SENSOR) {
|
2009-08-04 09:20:48 +00:00
|
|
|
ob->body_type = OB_BODY_TYPE_SENSOR;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
else if (!(ob->gameflag & OB_DYNAMIC)) {
|
2009-08-04 09:20:48 +00:00
|
|
|
ob->body_type = OB_BODY_TYPE_STATIC;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
2012-05-12 11:01:29 +00:00
|
|
|
else if (!(ob->gameflag & (OB_RIGID_BODY | OB_SOFT_BODY))) {
|
2009-08-04 09:20:48 +00:00
|
|
|
ob->body_type = OB_BODY_TYPE_DYNAMIC;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
else if (ob->gameflag & OB_RIGID_BODY) {
|
2009-08-04 09:20:48 +00:00
|
|
|
ob->body_type = OB_BODY_TYPE_RIGID;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-08-04 09:20:48 +00:00
|
|
|
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)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2015-04-20 23:37:04 +10:00
|
|
|
const int gameflag_prev = ob->gameflag;
|
2012-03-05 23:30:41 +00:00
|
|
|
ob->body_type = value;
|
2009-08-04 09:20:48 +00:00
|
|
|
|
|
|
|
switch (ob->body_type) {
|
2012-05-12 11:01:29 +00:00
|
|
|
case OB_BODY_TYPE_SENSOR:
|
2014-04-22 16:38:34 -07:00
|
|
|
ob->gameflag |= OB_SENSOR | OB_COLLISION;
|
2012-05-28 21:36:29 +00:00
|
|
|
ob->gameflag &= ~(OB_OCCLUDER | OB_CHARACTER | OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR |
|
2012-05-12 11:01:29 +00:00
|
|
|
OB_ANISOTROPIC_FRICTION | OB_DO_FH | OB_ROT_FH | OB_COLLISION_RESPONSE | OB_NAVMESH);
|
|
|
|
break;
|
|
|
|
case OB_BODY_TYPE_OCCLUDER:
|
|
|
|
ob->gameflag |= OB_OCCLUDER;
|
2012-05-28 21:36:29 +00:00
|
|
|
ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_DYNAMIC | OB_NAVMESH);
|
2012-05-12 11:01:29 +00:00
|
|
|
break;
|
|
|
|
case OB_BODY_TYPE_NAVMESH:
|
|
|
|
ob->gameflag |= OB_NAVMESH;
|
2012-05-28 21:36:29 +00:00
|
|
|
ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_DYNAMIC | OB_OCCLUDER);
|
2012-05-12 11:01:29 +00:00
|
|
|
|
|
|
|
if (ob->type == OB_MESH) {
|
|
|
|
/* could be moved into mesh UI but for now ensure mesh data layer */
|
|
|
|
BKE_mesh_ensure_navmesh(ob->data);
|
|
|
|
}
|
2011-10-09 21:11:51 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
break;
|
|
|
|
case OB_BODY_TYPE_NO_COLLISION:
|
2012-05-28 21:36:29 +00:00
|
|
|
ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_OCCLUDER | OB_DYNAMIC | OB_NAVMESH);
|
2012-05-12 11:01:29 +00:00
|
|
|
break;
|
2012-05-28 21:36:29 +00:00
|
|
|
case OB_BODY_TYPE_CHARACTER:
|
2014-04-22 16:38:34 -07:00
|
|
|
ob->gameflag |= OB_COLLISION | OB_CHARACTER;
|
2012-06-27 18:29:47 +00:00
|
|
|
ob->gameflag &= ~(OB_SENSOR | OB_OCCLUDER | OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR |
|
2013-07-19 15:23:42 +00:00
|
|
|
OB_ANISOTROPIC_FRICTION | OB_DO_FH | OB_ROT_FH | OB_COLLISION_RESPONSE | OB_NAVMESH);
|
2015-10-28 02:02:31 +01:00
|
|
|
/* When we switch to character physics and the collision bounds is set to triangle mesh
|
2016-07-15 02:36:21 +10:00
|
|
|
* we have to change collision bounds because triangle mesh is not supported by Characters */
|
2015-10-28 02:02:31 +01:00
|
|
|
if ((ob->gameflag & OB_BOUNDS) && ob->collision_boundtype == OB_BOUND_TRIANGLE_MESH) {
|
|
|
|
ob->boundtype = ob->collision_boundtype = OB_BOUND_BOX;
|
|
|
|
}
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2012-05-12 11:01:29 +00:00
|
|
|
case OB_BODY_TYPE_STATIC:
|
|
|
|
ob->gameflag |= OB_COLLISION;
|
2012-05-28 21:36:29 +00:00
|
|
|
ob->gameflag &= ~(OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH);
|
2012-05-12 11:01:29 +00:00
|
|
|
break;
|
|
|
|
case OB_BODY_TYPE_DYNAMIC:
|
|
|
|
ob->gameflag |= OB_COLLISION | OB_DYNAMIC | OB_ACTOR;
|
2012-05-28 21:36:29 +00:00
|
|
|
ob->gameflag &= ~(OB_RIGID_BODY | OB_SOFT_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH);
|
2012-05-12 11:01:29 +00:00
|
|
|
break;
|
|
|
|
case OB_BODY_TYPE_RIGID:
|
|
|
|
ob->gameflag |= OB_COLLISION | OB_DYNAMIC | OB_RIGID_BODY | OB_ACTOR;
|
2012-05-28 21:36:29 +00:00
|
|
|
ob->gameflag &= ~(OB_SOFT_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH);
|
2012-05-12 11:01:29 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
case OB_BODY_TYPE_SOFT:
|
|
|
|
ob->gameflag |= OB_COLLISION | OB_DYNAMIC | OB_SOFT_BODY | OB_ACTOR;
|
2012-05-28 21:36:29 +00:00
|
|
|
ob->gameflag &= ~(OB_RIGID_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH);
|
2012-05-12 11:01:29 +00:00
|
|
|
|
|
|
|
/* assume triangle mesh, if no bounds chosen for soft body */
|
|
|
|
if ((ob->gameflag & OB_BOUNDS) && (ob->boundtype < OB_BOUND_TRIANGLE_MESH)) {
|
|
|
|
ob->boundtype = OB_BOUND_TRIANGLE_MESH;
|
|
|
|
}
|
|
|
|
/* create a BulletSoftBody structure if not already existing */
|
|
|
|
if (!ob->bsoft)
|
|
|
|
ob->bsoft = bsbNew();
|
|
|
|
break;
|
2009-08-04 09:20:48 +00:00
|
|
|
}
|
2011-10-09 21:43:13 +00:00
|
|
|
|
2015-04-20 23:37:04 +10:00
|
|
|
if ((gameflag_prev & OB_NAVMESH) != (ob->gameflag & OB_NAVMESH)) {
|
2011-10-09 21:43:13 +00:00
|
|
|
if (ob->type == OB_MESH) {
|
2011-10-10 02:56:26 +00:00
|
|
|
/* this is needed to refresh the derived meshes draw func */
|
2011-10-09 21:43:13 +00:00
|
|
|
DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ptr->id.data);
|
2009-08-04 09:20:48 +00:00
|
|
|
}
|
|
|
|
|
2009-06-01 11:39:11 +00:00
|
|
|
static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2012-03-05 23:30:41 +00:00
|
|
|
ParticleSystem *psys = psys_get_current(ob);
|
2009-06-01 11:39:11 +00:00
|
|
|
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
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
int i, tot = 0;
|
2009-02-02 19:57:57 +00:00
|
|
|
|
|
|
|
/* ensure we always have some layer selected */
|
2012-05-12 11:01:29 +00:00
|
|
|
for (i = 0; i < 20; i++)
|
2012-03-05 23:30:41 +00:00
|
|
|
if (values[i])
|
2009-02-02 19:57:57 +00:00
|
|
|
tot++;
|
2009-11-02 11:14:22 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (tot == 0)
|
2009-11-02 11:14:22 +00:00
|
|
|
return 0;
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
for (i = 0; i < 20; i++) {
|
2012-10-30 16:33:40 +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)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2009-11-02 11:14:22 +00:00
|
|
|
unsigned int lay;
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
lay = rna_Object_layer_validate__internal(values, ob->lay);
|
|
|
|
if (lay)
|
|
|
|
ob->lay = lay;
|
2009-11-02 11:14:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Base_layer_set(PointerRNA *ptr, const int *values)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Base *base = (Base *)ptr->data;
|
2009-11-02 11:14:22 +00:00
|
|
|
|
|
|
|
unsigned int lay;
|
2012-03-05 23:30:41 +00:00
|
|
|
lay = rna_Object_layer_validate__internal(values, base->lay);
|
|
|
|
if (lay)
|
|
|
|
base->lay = lay;
|
2009-11-02 11:14:22 +00:00
|
|
|
|
|
|
|
/* 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)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2010-05-14 23:09:55 +00:00
|
|
|
int i;
|
2016-04-30 04:04:18 +10:00
|
|
|
int all_states = (ob->scaflag & OB_ALLSTATE) ? 1 : 0;
|
2010-05-14 23:09:55 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
memset(values, 0, sizeof(int) * OB_MAX_STATES);
|
2012-10-30 16:33:40 +00:00
|
|
|
for (i = 0; i < OB_MAX_STATES; i++) {
|
2015-07-13 15:51:31 -03:00
|
|
|
values[i] = (ob->state & (1 << i)) ? 1 : 0 | all_states;
|
2012-10-30 16:33:40 +00:00
|
|
|
}
|
2010-05-14 23:09:55 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2012-03-05 23:30:41 +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 */
|
2012-05-12 11:01:29 +00:00
|
|
|
for (i = 0; i < OB_MAX_STATES; i++)
|
2012-03-05 23:30:41 +00:00
|
|
|
if (values[i])
|
2009-02-02 19:57:57 +00:00
|
|
|
tot++;
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (tot == 0)
|
2009-02-02 19:57:57 +00:00
|
|
|
return;
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
for (i = 0; i < OB_MAX_STATES; i++) {
|
|
|
|
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)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2010-05-05 00:12:31 +00:00
|
|
|
bController *cont;
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
memset(values, 0, sizeof(int) * OB_MAX_STATES);
|
2012-03-05 23:30:41 +00:00
|
|
|
for (cont = ob->controllers.first; cont; cont = cont->next) {
|
2010-05-05 00:12:31 +00:00
|
|
|
int i;
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
for (i = 0; i < OB_MAX_STATES; i++) {
|
|
|
|
if (cont->state_mask & (1 << i))
|
2010-05-05 00:12:31 +00:00
|
|
|
values[i] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-30 15:44:16 +00:00
|
|
|
static void rna_GameObjectSettings_col_group_get(PointerRNA *ptr, int *values)
|
|
|
|
{
|
2012-12-28 14:19:05 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2012-10-30 15:44:16 +00:00
|
|
|
int i;
|
|
|
|
|
2012-10-30 16:33:40 +00:00
|
|
|
for (i = 0; i < OB_MAX_COL_MASKS; i++) {
|
2015-02-20 19:54:28 +11:00
|
|
|
values[i] = (ob->col_group & (1 << i)) != 0;
|
2012-10-30 16:33:40 +00:00
|
|
|
}
|
2012-10-30 15:44:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_GameObjectSettings_col_group_set(PointerRNA *ptr, const int *values)
|
|
|
|
{
|
2012-12-28 14:19:05 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2012-10-30 15:44:16 +00:00
|
|
|
int i, tot = 0;
|
|
|
|
|
|
|
|
/* ensure we always have some group selected */
|
|
|
|
for (i = 0; i < OB_MAX_COL_MASKS; i++)
|
2012-10-30 16:33:40 +00:00
|
|
|
if (values[i])
|
2012-10-30 15:44:16 +00:00
|
|
|
tot++;
|
|
|
|
|
2012-10-30 16:33:40 +00:00
|
|
|
if (tot == 0)
|
2012-10-30 15:44:16 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < OB_MAX_COL_MASKS; i++) {
|
2012-10-30 16:33:40 +00:00
|
|
|
if (values[i]) ob->col_group |= (1 << i);
|
|
|
|
else ob->col_group &= ~(1 << i);
|
2012-10-30 15:44:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_GameObjectSettings_col_mask_get(PointerRNA *ptr, int *values)
|
|
|
|
{
|
2012-12-28 14:19:05 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2012-10-30 15:44:16 +00:00
|
|
|
int i;
|
|
|
|
|
2012-10-30 16:33:40 +00:00
|
|
|
for (i = 0; i < OB_MAX_COL_MASKS; i++) {
|
2015-02-20 19:54:28 +11:00
|
|
|
values[i] = (ob->col_mask & (1 << i)) != 0;
|
2012-10-30 16:33:40 +00:00
|
|
|
}
|
2012-10-30 15:44:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_GameObjectSettings_col_mask_set(PointerRNA *ptr, const int *values)
|
|
|
|
{
|
2012-12-28 14:19:05 +00:00
|
|
|
Object *ob = (Object *)ptr->data;
|
2012-10-30 15:44:16 +00:00
|
|
|
int i, tot = 0;
|
|
|
|
|
|
|
|
/* ensure we always have some mask selected */
|
|
|
|
for (i = 0; i < OB_MAX_COL_MASKS; i++)
|
2012-10-30 16:33:40 +00:00
|
|
|
if (values[i])
|
2012-10-30 15:44:16 +00:00
|
|
|
tot++;
|
|
|
|
|
2012-10-30 16:33:40 +00:00
|
|
|
if (tot == 0)
|
2012-10-30 15:44:16 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < OB_MAX_COL_MASKS; i++) {
|
2012-10-30 16:33:40 +00:00
|
|
|
if (values[i]) ob->col_mask |= (1 << i);
|
|
|
|
else ob->col_mask &= ~(1 << i);
|
2012-10-30 15:44:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, int *max,
|
|
|
|
int *UNUSED(softmin), int *UNUSED(softmax))
|
2009-07-02 03:32:57 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2012-09-19 10:12:07 +00:00
|
|
|
Key *key = BKE_key_from_object(ob);
|
2009-07-02 03:32:57 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
*min = 0;
|
|
|
|
if (key) {
|
2014-11-16 13:57:58 +01:00
|
|
|
*max = BLI_listbase_count(&key->block) - 1;
|
2012-03-05 23:30:41 +00:00
|
|
|
if (*max < 0) *max = 0;
|
2011-06-23 06:13:21 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-03-05 23:30:41 +00:00
|
|
|
*max = 0;
|
2011-06-23 06:13:21 +00:00
|
|
|
}
|
2009-07-02 03:32:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_Object_active_shape_key_index_get(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-07-02 03:32:57 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
return MAX2(ob->shapenr - 1, 0);
|
2009-07-02 03:32:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Object_active_shape_key_index_set(PointerRNA *ptr, int value)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-07-02 03:32:57 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
ob->shapenr = value + 1;
|
2009-07-02 03:32:57 +00:00
|
|
|
}
|
|
|
|
|
2009-07-03 15:23:33 +00:00
|
|
|
static PointerRNA rna_Object_active_shape_key_get(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2012-09-19 10:12:07 +00:00
|
|
|
Key *key = BKE_key_from_object(ob);
|
2009-07-03 15:23:33 +00:00
|
|
|
KeyBlock *kb;
|
|
|
|
PointerRNA keyptr;
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (key == NULL)
|
2009-07-03 15:23:33 +00:00
|
|
|
return PointerRNA_NULL;
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
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)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-07-02 19:41:31 +00:00
|
|
|
|
|
|
|
/* weak */
|
2012-03-05 23:30:41 +00:00
|
|
|
if (!ob->pd)
|
|
|
|
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)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2009-07-02 19:41:31 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ob->type != OB_MESH)
|
2011-04-18 01:45:28 +00:00
|
|
|
return PointerRNA_NULL;
|
|
|
|
|
2009-07-02 19:41:31 +00:00
|
|
|
/* weak */
|
2012-03-05 23:30:41 +00:00
|
|
|
if (!ob->pd)
|
|
|
|
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)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2014-04-11 11:47:07 +10:00
|
|
|
bConstraint *con = BKE_constraints_active_get(&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)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2014-04-11 11:47:07 +10:00
|
|
|
BKE_constraints_active_set(&ob->constraints, (bConstraint *)value.data);
|
2009-11-11 19:58:30 +00:00
|
|
|
}
|
|
|
|
|
2010-09-07 05:47:34 +00:00
|
|
|
static bConstraint *rna_Object_constraints_new(Object *object, int type)
|
2009-11-13 16:08:03 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, object);
|
2014-04-11 11:47:07 +10:00
|
|
|
return BKE_constraint_add_for_object(object, NULL, type);
|
2009-11-13 16:08:03 +00:00
|
|
|
}
|
|
|
|
|
2012-11-02 09:41:26 +00:00
|
|
|
static void rna_Object_constraints_remove(Object *object, ReportList *reports, PointerRNA *con_ptr)
|
2009-11-13 16:08:03 +00:00
|
|
|
{
|
2012-11-02 09:41:26 +00:00
|
|
|
bConstraint *con = con_ptr->data;
|
2012-03-05 23:30:41 +00:00
|
|
|
if (BLI_findindex(&object->constraints, con) == -1) {
|
2012-05-12 11:01:29 +00:00
|
|
|
BKE_reportf(reports, RPT_ERROR, "Constraint '%s' not found in object '%s'", con->name, object->id.name + 2);
|
2010-09-07 05:47:34 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-04-11 11:47:07 +10:00
|
|
|
BKE_constraint_remove(&object->constraints, con);
|
2012-11-02 09:41:26 +00:00
|
|
|
RNA_POINTER_INVALIDATE(con_ptr);
|
|
|
|
|
2011-05-04 05:56:26 +00:00
|
|
|
ED_object_constraint_update(object);
|
2010-08-24 06:40:28 +00:00
|
|
|
ED_object_constraint_set_active(object, NULL);
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, object);
|
2009-11-13 16:08:03 +00:00
|
|
|
}
|
2009-11-16 11:11:16 +00:00
|
|
|
|
2011-11-23 16:12:11 +00:00
|
|
|
static void rna_Object_constraints_clear(Object *object)
|
|
|
|
{
|
2014-04-11 11:47:07 +10:00
|
|
|
BKE_constraints_free(&object->constraints);
|
2011-11-23 16:12:11 +00:00
|
|
|
|
|
|
|
ED_object_constraint_update(object);
|
|
|
|
ED_object_constraint_set_active(object, NULL);
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, object);
|
2011-11-23 16:12:11 +00:00
|
|
|
}
|
|
|
|
|
2012-03-18 09:27:36 +00:00
|
|
|
static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports,
|
|
|
|
const char *name, int type)
|
2009-11-28 13:33:56 +00:00
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
2012-11-02 09:41:26 +00:00
|
|
|
static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList *reports, PointerRNA *md_ptr)
|
2009-11-28 13:33:56 +00:00
|
|
|
{
|
2012-11-02 09:41:26 +00:00
|
|
|
ModifierData *md = md_ptr->data;
|
2014-04-01 11:34:00 +11:00
|
|
|
if (ED_object_modifier_remove(reports, CTX_data_main(C), object, md) == false) {
|
2012-11-02 09:41:26 +00:00
|
|
|
/* error is already set */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
RNA_POINTER_INVALIDATE(md_ptr);
|
2011-11-23 16:12:11 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
|
2011-11-23 16:12:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Object_modifier_clear(Object *object, bContext *C)
|
|
|
|
{
|
2013-02-22 00:51:58 +00:00
|
|
|
ED_object_modifier_clear(CTX_data_main(C), object);
|
2011-11-23 16:12:11 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
|
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)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2012-05-05 14:03:12 +00:00
|
|
|
BoundBox *bb = BKE_object_boundbox_get(ob);
|
2012-03-05 23:30:41 +00:00
|
|
|
if (bb) {
|
2010-02-10 20:29:40 +00:00
|
|
|
memcpy(values, bb->vec, sizeof(bb->vec));
|
|
|
|
}
|
|
|
|
else {
|
2015-05-05 17:08:29 +10:00
|
|
|
copy_vn_fl(values, sizeof(bb->vec) / sizeof(float), 0.0f);
|
2010-02-10 20:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-01-07 09:50:23 +00:00
|
|
|
static bDeformGroup *rna_Object_vgroup_new(Object *ob, const char *name)
|
2010-08-27 02:33:35 +00:00
|
|
|
{
|
2014-11-18 23:52:17 +01:00
|
|
|
bDeformGroup *defgroup = BKE_object_defgroup_add_name(ob, name);
|
2011-01-07 09:50:23 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
|
2011-01-07 09:50:23 +00:00
|
|
|
|
|
|
|
return defgroup;
|
|
|
|
}
|
|
|
|
|
2012-11-02 09:41:26 +00:00
|
|
|
static void rna_Object_vgroup_remove(Object *ob, ReportList *reports, PointerRNA *defgroup_ptr)
|
2010-09-07 05:47:34 +00:00
|
|
|
{
|
2012-11-02 09:41:26 +00:00
|
|
|
bDeformGroup *defgroup = defgroup_ptr->data;
|
|
|
|
if (BLI_findindex(&ob->defbase, defgroup) == -1) {
|
|
|
|
BKE_reportf(reports, RPT_ERROR, "DeformGroup '%s' not in object '%s'", defgroup->name, ob->id.name + 2);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-11-18 23:52:17 +01:00
|
|
|
BKE_object_defgroup_remove(ob, defgroup);
|
2012-11-02 09:41:26 +00:00
|
|
|
RNA_POINTER_INVALIDATE(defgroup_ptr);
|
2011-01-07 09:50:23 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
|
2011-01-07 09:50:23 +00:00
|
|
|
}
|
|
|
|
|
2011-11-23 16:12:11 +00:00
|
|
|
static void rna_Object_vgroup_clear(Object *ob)
|
|
|
|
{
|
2014-11-18 23:52:17 +01:00
|
|
|
BKE_object_defgroup_remove_all(ob);
|
2011-11-23 16:12:11 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
|
2011-11-23 16:12:11 +00:00
|
|
|
}
|
|
|
|
|
2011-09-25 09:55:13 +00:00
|
|
|
static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *reports, int index_len,
|
|
|
|
int *index, float weight, int assignmode)
|
2011-01-07 09:50:23 +00:00
|
|
|
{
|
|
|
|
Object *ob = (Object *)id;
|
|
|
|
|
2014-11-17 20:33:25 +01:00
|
|
|
if (BKE_object_is_in_editmode_vgroup(ob)) {
|
2012-10-21 14:02:30 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "VertexGroup.add(): cannot be called while object is in edit mode");
|
2011-01-07 09:50:23 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
while (index_len--)
|
2012-05-12 11:01:29 +00:00
|
|
|
ED_vgroup_vert_add(ob, def, *index++, weight, assignmode); /* XXX, not efficient calling within loop*/
|
2011-01-07 09:50:23 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data);
|
2011-01-07 09:50:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_VertexGroup_vertex_remove(ID *id, bDeformGroup *dg, ReportList *reports, int index_len, int *index)
|
|
|
|
{
|
|
|
|
Object *ob = (Object *)id;
|
|
|
|
|
2014-11-17 20:33:25 +01:00
|
|
|
if (BKE_object_is_in_editmode_vgroup(ob)) {
|
2012-10-21 14:02:30 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "VertexGroup.remove(): cannot be called while object is in edit mode");
|
2011-01-07 09:50:23 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
while (index_len--)
|
2011-01-07 09:50:23 +00:00
|
|
|
ED_vgroup_vert_remove(ob, dg, *index++);
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data);
|
2011-01-07 09:50:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static float rna_VertexGroup_weight(ID *id, bDeformGroup *dg, ReportList *reports, int index)
|
|
|
|
{
|
|
|
|
float weight = ED_vgroup_vert_weight((Object *)id, dg, index);
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (weight < 0) {
|
2012-10-21 14:02:30 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "Vertex not in group");
|
2011-01-07 09:50:23 +00:00
|
|
|
}
|
2012-03-18 09:27:36 +00:00
|
|
|
return weight;
|
2010-09-07 05:47:34 +00:00
|
|
|
}
|
|
|
|
|
2010-08-03 06:51:36 +00:00
|
|
|
/* generic poll functions */
|
2011-05-31 02:14:25 +00:00
|
|
|
int rna_Lattice_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
|
2010-08-03 06:51:36 +00:00
|
|
|
{
|
|
|
|
return ((Object *)value.id.data)->type == OB_LATTICE;
|
|
|
|
}
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
int rna_Curve_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
|
2010-08-03 06:51:36 +00:00
|
|
|
{
|
|
|
|
return ((Object *)value.id.data)->type == OB_CURVE;
|
|
|
|
}
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
int rna_Armature_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
|
2010-08-03 06:51:36 +00:00
|
|
|
{
|
|
|
|
return ((Object *)value.id.data)->type == OB_ARMATURE;
|
|
|
|
}
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
int rna_Mesh_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
|
2010-08-03 06:51:36 +00:00
|
|
|
{
|
|
|
|
return ((Object *)value.id.data)->type == OB_MESH;
|
|
|
|
}
|
|
|
|
|
2011-05-31 02:14:25 +00:00
|
|
|
int rna_Camera_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
|
2010-08-03 06:51:36 +00:00
|
|
|
{
|
|
|
|
return ((Object *)value.id.data)->type == OB_CAMERA;
|
|
|
|
}
|
|
|
|
|
2013-11-25 20:58:23 +09:00
|
|
|
int rna_Lamp_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
|
|
|
|
{
|
|
|
|
return ((Object *)value.id.data)->type == OB_LAMP;
|
|
|
|
}
|
|
|
|
|
2012-11-08 16:35:28 +00:00
|
|
|
int rna_DupliObject_index_get(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
DupliObject *dob = (DupliObject *)ptr->data;
|
|
|
|
return dob->persistent_id[0];
|
|
|
|
}
|
|
|
|
|
2012-12-30 18:27:33 +00:00
|
|
|
int rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr)
|
|
|
|
{
|
2012-12-31 02:37:28 +00:00
|
|
|
SculptSession *ss = ((Object *)ptr->id.data)->sculpt;
|
2012-12-30 18:27:33 +00:00
|
|
|
return (ss && ss->bm);
|
|
|
|
}
|
|
|
|
|
2013-12-18 15:34:56 +11:00
|
|
|
static void rna_Object_lod_distance_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
2013-12-17 14:42:47 -08:00
|
|
|
{
|
|
|
|
Object *ob = (Object *)ptr->id.data;
|
2014-04-09 11:48:04 +10:00
|
|
|
|
|
|
|
#ifdef WITH_GAMEENGINE
|
2013-12-17 14:42:47 -08:00
|
|
|
BKE_object_lod_sort(ob);
|
2014-04-09 11:48:04 +10:00
|
|
|
#else
|
|
|
|
(void)ob;
|
|
|
|
#endif
|
2013-12-17 14:42:47 -08:00
|
|
|
}
|
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;
|
2011-01-07 09:50:23 +00:00
|
|
|
FunctionRNA *func;
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
PropertyRNA *parm;
|
2011-01-07 09:50:23 +00:00
|
|
|
|
|
|
|
static EnumPropertyItem assign_mode_items[] = {
|
|
|
|
{WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"},
|
|
|
|
{WEIGHT_ADD, "ADD", 0, "Add", "Add"},
|
|
|
|
{WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "VertexGroup", NULL);
|
2009-01-01 20:44:40 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +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);
|
2011-06-05 04:52:32 +00:00
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_VertexGroup_name_set");
|
2012-05-12 11:01:29 +00:00
|
|
|
/* update data because modifiers may use [#24761] */
|
|
|
|
RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
|
2011-09-18 17:10:28 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_weight", PROP_BOOLEAN, PROP_NONE);
|
2011-05-27 19:13:54 +00:00
|
|
|
RNA_def_property_ui_text(prop, "", "Maintain the relative weights for the group");
|
2011-09-14 07:07:17 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", 0);
|
2012-05-12 11:01:29 +00:00
|
|
|
/* update data because modifiers may use [#24761] */
|
|
|
|
RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +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");
|
2011-01-07 09:50:23 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "add", "rna_VertexGroup_vertex_add");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Add vertices to the group");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
|
2011-01-07 09:50:23 +00:00
|
|
|
/* TODO, see how array size of 0 works, this shouldnt be used */
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
|
|
|
|
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
|
|
|
|
parm = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
|
|
|
parm = RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode");
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2011-01-07 09:50:23 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "remove", "rna_VertexGroup_vertex_remove");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Remove a vertex from the group");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
|
2011-01-07 09:50:23 +00:00
|
|
|
/* TODO, see how array size of 0 works, this shouldnt be used */
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
|
|
|
|
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
|
2011-01-07 09:50:23 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "weight", "rna_VertexGroup_weight");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Get a vertex weight from the group");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "The index of the vertex", 0, INT_MAX);
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
|
|
|
parm = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
|
|
|
|
RNA_def_function_return(func, parm);
|
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", ""},
|
2012-05-12 11:01:29 +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. */
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
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);
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
|
2009-06-03 23:22:43 +00:00
|
|
|
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);
|
2015-10-24 02:44:43 +11:00
|
|
|
RNA_def_property_ui_text(prop, "Material", "Material data-block used by this material slot");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
|
2009-06-03 23:22:43 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
|
2009-06-03 23:22:43 +00:00
|
|
|
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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
|
2009-06-03 23:22:43 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
2009-06-03 23:22:43 +00:00
|
|
|
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);
|
2013-10-01 04:49:47 +00:00
|
|
|
|
|
|
|
RNA_def_struct_path_func(srna, "rna_MaterialSlot_path");
|
2009-06-03 23:22:43 +00:00
|
|
|
}
|
|
|
|
|
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[] = {
|
2011-04-11 01:18:25 +00:00
|
|
|
{OB_BODY_TYPE_NO_COLLISION, "NO_COLLISION", 0, "No Collision", "Disable collision for this object"},
|
2009-08-04 09:20:48 +00:00
|
|
|
{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"},
|
2015-02-27 11:11:49 +00:00
|
|
|
{OB_BODY_TYPE_OCCLUDER, "OCCLUDER", 0, "Occluder", "Occluder for optimizing scene rendering"},
|
2012-03-18 09:27:36 +00:00
|
|
|
{OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor",
|
|
|
|
"Collision Sensor, detects static and dynamic objects but not the other "
|
|
|
|
"collision sensor objects"},
|
2011-09-11 10:00:43 +00:00
|
|
|
{OB_BODY_TYPE_NAVMESH, "NAVMESH", 0, "Navigation Mesh", "Navigation mesh"},
|
2012-07-04 15:04:38 +00:00
|
|
|
{OB_BODY_TYPE_CHARACTER, "CHARACTER", 0, "Character",
|
|
|
|
"Simple kinematic physics appropriate for game characters"},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +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 */
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "sensors", PROP_COLLECTION, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
RNA_def_property_struct_type(prop, "Controller");
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Controllers",
|
2011-10-20 07:56:04 +00:00
|
|
|
"Game engine controllers to process events, connecting sensors to actuators");
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_sensors", PROP_BOOLEAN, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_controllers", PROP_BOOLEAN, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_actuators", PROP_BOOLEAN, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
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 */
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "body_type");
|
|
|
|
RNA_def_property_enum_items(prop, body_type_items);
|
2015-05-02 19:46:27 +02:00
|
|
|
RNA_def_property_enum_default(prop, OB_BODY_TYPE_STATIC);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get",
|
|
|
|
"rna_GameObjectSettings_physics_type_set", NULL);
|
2011-10-20 07:56:04 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Physics Type", "Select 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
|
|
|
|
2013-12-09 22:26:52 +11:00
|
|
|
prop = RNA_def_property(srna, "use_record_animation", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_RECORD_ANIMATION);
|
|
|
|
RNA_def_property_ui_text(prop, "Record Animation", "Record animation objects without physics");
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_actor", PROP_BOOLEAN, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_GHOST);
|
2012-07-03 17:20:21 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Ghost", "Object does not react to collisions, like a ghost");
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
RNA_def_property_range(prop, 0.01, 10000.0);
|
2015-05-02 19:46:27 +02:00
|
|
|
RNA_def_property_float_default(prop, 1.0f);
|
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
|
|
|
|
2012-05-12 11:01:29 +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");
|
2012-04-10 10:35:55 +00:00
|
|
|
RNA_def_property_range(prop, 0.01f, FLT_MAX);
|
|
|
|
RNA_def_property_ui_range(prop, 0.01f, 10.0f, 1, 3);
|
2015-05-02 19:46:27 +02:00
|
|
|
RNA_def_property_float_default(prop, 1.0f);
|
2009-08-16 09:47:33 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Radius", "Radius of bounding sphere and material physics");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_sleep", PROP_BOOLEAN, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "damping");
|
|
|
|
RNA_def_property_range(prop, 0.0, 1.0);
|
2015-05-02 19:46:27 +02:00
|
|
|
RNA_def_property_float_default(prop, 0.04f);
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "rotation_damping", PROP_FLOAT, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "rdamping");
|
|
|
|
RNA_def_property_range(prop, 0.0, 1.0);
|
2015-05-02 19:46:27 +02:00
|
|
|
RNA_def_property_float_default(prop, 0.1f);
|
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
|
|
|
|
2015-07-07 11:59:24 +02:00
|
|
|
prop = RNA_def_property(srna, "velocity_min", PROP_FLOAT, PROP_DISTANCE);
|
2009-06-20 06:06:13 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "min_vel");
|
|
|
|
RNA_def_property_range(prop, 0.0, 1000.0);
|
2015-07-07 11:59:24 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Velocity Min", "Clamp velocity to this minimum speed (except when totally still), "
|
|
|
|
"in distance per second");
|
2009-06-20 06:06:13 +00:00
|
|
|
|
2015-07-07 11:59:24 +02:00
|
|
|
prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_DISTANCE);
|
2009-06-20 06:06:13 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "max_vel");
|
|
|
|
RNA_def_property_range(prop, 0.0, 1000.0);
|
2015-07-07 11:59:24 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Velocity Max", "Clamp velocity to this maximum speed, "
|
|
|
|
"in distance per second");
|
2012-05-28 21:36:29 +00:00
|
|
|
|
2015-07-07 11:59:24 +02:00
|
|
|
prop = RNA_def_property(srna, "angular_velocity_min", PROP_FLOAT, PROP_ANGLE);
|
2015-06-23 15:02:28 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "min_angvel");
|
|
|
|
RNA_def_property_range(prop, 0.0, 1000.0);
|
|
|
|
RNA_def_property_ui_text(prop, "Angular Velocity Min",
|
2015-07-07 11:59:24 +02:00
|
|
|
"Clamp angular velocity to this minimum speed (except when totally still), "
|
|
|
|
"in angle per second");
|
2015-06-23 15:02:28 +02:00
|
|
|
|
2015-07-07 11:59:24 +02:00
|
|
|
prop = RNA_def_property(srna, "angular_velocity_max", PROP_FLOAT, PROP_ANGLE);
|
2015-06-23 15:02:28 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "max_angvel");
|
|
|
|
RNA_def_property_range(prop, 0.0, 1000.0);
|
2015-07-07 11:59:24 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Angular Velocity Max", "Clamp angular velocity to this maximum speed, "
|
|
|
|
"in angle per second");
|
2015-06-23 15:02:28 +02:00
|
|
|
|
2012-11-18 20:56:50 +00:00
|
|
|
/* Character physics */
|
2012-06-27 18:29:47 +00:00
|
|
|
prop = RNA_def_property(srna, "step_height", PROP_FLOAT, PROP_NONE);
|
2012-05-28 21:36:29 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "step_height");
|
2012-11-18 20:56:50 +00:00
|
|
|
RNA_def_property_range(prop, 0.01, 1.0);
|
2015-05-02 19:46:27 +02:00
|
|
|
RNA_def_property_float_default(prop, 0.15f);
|
2012-05-28 21:36:29 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Step Height", "Maximum height of steps the character can run over");
|
|
|
|
|
2012-06-27 18:29:47 +00:00
|
|
|
prop = RNA_def_property(srna, "jump_speed", PROP_FLOAT, PROP_NONE);
|
2012-05-28 21:36:29 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "jump_speed");
|
|
|
|
RNA_def_property_range(prop, 0.0, 1000.0);
|
2015-05-02 19:46:27 +02:00
|
|
|
RNA_def_property_float_default(prop, 10.0f);
|
2012-11-18 20:56:50 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Jump Force", "Upward velocity applied to the character when jumping");
|
2012-05-28 21:36:29 +00:00
|
|
|
|
2012-06-27 18:29:47 +00:00
|
|
|
prop = RNA_def_property(srna, "fall_speed", PROP_FLOAT, PROP_NONE);
|
2012-05-28 21:36:29 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "fall_speed");
|
|
|
|
RNA_def_property_range(prop, 0.0, 1000.0);
|
2015-05-02 19:46:27 +02:00
|
|
|
RNA_def_property_float_default(prop, 55.0f);
|
2012-05-28 21:36:29 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Fall Speed Max", "Maximum speed at which the character will fall");
|
|
|
|
|
2015-10-12 12:26:48 +11:00
|
|
|
prop = RNA_def_property(srna, "jump_max", PROP_INT, PROP_NONE);
|
2015-10-11 18:28:43 +02:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "max_jumps");
|
|
|
|
RNA_def_property_range(prop, 1, CHAR_MAX);
|
|
|
|
RNA_def_property_ui_range(prop, 1, 10, 1, 1);
|
|
|
|
RNA_def_property_int_default(prop, 1);
|
|
|
|
RNA_def_property_ui_text(prop, "Max Jumps",
|
2015-10-12 12:19:27 +11:00
|
|
|
"The maximum number of jumps the character can make before it hits the ground");
|
2015-10-11 18:28:43 +02:00
|
|
|
|
2012-11-18 20:56:50 +00:00
|
|
|
/* Collision Masks */
|
2012-10-30 15:44:16 +00:00
|
|
|
prop = RNA_def_property(srna, "collision_group", PROP_BOOLEAN, PROP_LAYER_MEMBER);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "col_group", 1);
|
|
|
|
RNA_def_property_array(prop, OB_MAX_COL_MASKS);
|
|
|
|
RNA_def_property_ui_text(prop, "Collision Group", "The collision group of the object");
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_col_group_get", "rna_GameObjectSettings_col_group_set");
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "collision_mask", PROP_BOOLEAN, PROP_LAYER_MEMBER);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "col_mask", 1);
|
|
|
|
RNA_def_property_array(prop, OB_MAX_COL_MASKS);
|
|
|
|
RNA_def_property_ui_text(prop, "Collision Mask", "The groups this object can collide with");
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_col_mask_get", "rna_GameObjectSettings_col_mask_set");
|
2009-06-20 06:06:13 +00:00
|
|
|
|
|
|
|
/* lock position */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
|
2009-06-20 06:06:13 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
|
2009-06-20 06:06:13 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
|
2009-06-20 06:06:13 +00:00
|
|
|
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 */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
|
2009-06-20 06:06:13 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_ROT_AXIS);
|
2011-10-20 07:56:04 +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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
|
2009-06-20 06:06:13 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_ROT_AXIS);
|
2011-10-20 07:56:04 +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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
|
2009-06-20 06:06:13 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_ROT_AXIS);
|
2011-10-20 07:56:04 +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 ? */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
|
2009-06-20 06:06:13 +00:00
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING);
|
2011-10-20 07:56:04 +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
|
|
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_material_physics_fh", PROP_BOOLEAN, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_DO_FH);
|
2011-03-03 01:47:17 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Use Material Force Field", "React to force field physics settings in materials");
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_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);
|
2011-09-25 09:55:13 +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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "formfactor");
|
|
|
|
RNA_def_property_range(prop, 0.0, 1.0);
|
2015-05-02 19:46:27 +02:00
|
|
|
RNA_def_property_float_default(prop, 0.4f);
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_anisotropic_friction", PROP_BOOLEAN, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
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
|
|
|
|
2015-02-12 06:38:21 +01:00
|
|
|
prop = RNA_def_property(srna, "friction_coefficients", PROP_FLOAT, PROP_XYZ);
|
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);
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Friction Coefficients",
|
2011-10-20 07:56:04 +00:00
|
|
|
"Relative friction coefficients in the in the X, Y and Z directions, "
|
2011-09-25 09:55:13 +00:00
|
|
|
"when anisotropic friction is enabled");
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "collision_bounds_type", PROP_ENUM, PROP_NONE);
|
2011-11-04 15:53:34 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "collision_boundtype");
|
2009-01-01 20:44:40 +00:00
|
|
|
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");
|
2015-02-27 11:11:49 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Collision Shape", "Select the collision shape that better fits the object");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_collision_compound", PROP_BOOLEAN, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
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
|
|
|
|
2012-05-12 11:01:29 +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);
|
2015-05-02 19:46:27 +02:00
|
|
|
RNA_def_property_float_default(prop, 0.04f);
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Collision Margin",
|
2012-03-18 09:27:36 +00:00
|
|
|
"Extra margin around object for collision detection, small amount required "
|
|
|
|
"for stability");
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_obstacle_create", PROP_BOOLEAN, PROP_NONE);
|
2010-06-10 00:19:06 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_HASOBSTACLE);
|
|
|
|
RNA_def_property_ui_text(prop, "Create obstacle", "Create representation for obstacle simulation");
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
prop = RNA_def_property(srna, "obstacle_radius", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
|
2010-06-10 00:19:06 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "obstacleRad");
|
|
|
|
RNA_def_property_range(prop, 0.0, 1000.0);
|
2015-05-02 19:46:27 +02:00
|
|
|
RNA_def_property_float_default(prop, 1.0f);
|
2010-06-10 00:19:06 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Obstacle Radius", "Radius of object representation in obstacle simulation");
|
2011-02-16 17:07:18 +00:00
|
|
|
|
2009-01-02 16:58:09 +00:00
|
|
|
/* state */
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "states_visible", 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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "used_states", PROP_BOOLEAN, PROP_LAYER_MEMBER);
|
2010-05-05 00:12:31 +00:00
|
|
|
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);
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "states_initial", PROP_BOOLEAN, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_debug_state", PROP_BOOLEAN, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
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);
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_all_states", PROP_BOOLEAN, PROP_NONE);
|
2010-05-12 08:34:15 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_ALLSTATE);
|
|
|
|
RNA_def_property_ui_text(prop, "All", "Set all state bits");
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_state_panel", PROP_BOOLEAN, PROP_NONE);
|
2010-05-12 08:34:15 +00:00
|
|
|
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");
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "ObjectConstraints", NULL);
|
2009-11-13 16:08:03 +00:00
|
|
|
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 */
|
2012-03-05 23:30:41 +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");
|
2012-03-18 09:27:36 +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 */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "new", "rna_Object_constraints_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
|
|
|
/* object to add */
|
2015-11-23 13:49:52 +11:00
|
|
|
parm = RNA_def_enum(func, "type", rna_enum_constraint_type_items, 1, "", "Constraint type to add");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2009-11-13 16:08:03 +00:00
|
|
|
/* return type */
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
|
2009-11-13 16:08:03 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
2010-09-07 05:47:34 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "remove", "rna_Object_constraints_remove");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Remove a constraint from this object");
|
2010-09-07 05:47:34 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
|
|
|
/* constraint to remove */
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
|
|
|
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
2011-11-23 16:12:11 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "clear", "rna_Object_constraints_clear");
|
2011-11-23 16:12:11 +00:00
|
|
|
RNA_def_function_ui_description(func, "Remove all constraint from this object");
|
2009-11-13 16:08:03 +00:00
|
|
|
}
|
|
|
|
|
2010-09-07 05:47:34 +00:00
|
|
|
/* object.modifiers */
|
2009-11-28 13:33:56 +00:00
|
|
|
static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "ObjectModifiers");
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "ObjectModifiers", NULL);
|
2009-11-28 13:33:56 +00:00
|
|
|
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
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
2009-11-28 13:33:56 +00:00
|
|
|
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");
|
2012-03-05 23:30:41 +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 */
|
2012-03-05 23:30:41 +00:00
|
|
|
/* RNA_def_property_collection_active(prop, prop_act); */
|
2009-11-28 13:33:56 +00:00
|
|
|
#endif
|
|
|
|
|
2012-07-23 21:47:11 +00:00
|
|
|
/* add modifier */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "new", "rna_Object_modifier_new");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Add a new modifier");
|
2012-08-20 10:15:32 +00:00
|
|
|
parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the modifier");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2009-11-28 13:33:56 +00:00
|
|
|
/* modifier to add */
|
2015-11-23 13:49:52 +11:00
|
|
|
parm = RNA_def_enum(func, "type", rna_enum_object_modifier_type_items, 1, "", "Modifier type to add");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2009-11-28 13:33:56 +00:00
|
|
|
/* return type */
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Newly created modifier");
|
2009-11-28 13:33:56 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
2012-07-23 21:47:11 +00:00
|
|
|
/* remove modifier */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "remove", "rna_Object_modifier_remove");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Remove an existing modifier from the object");
|
2012-07-23 21:47:11 +00:00
|
|
|
/* modifier to remove */
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Modifier to remove");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
|
|
|
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
2011-11-23 16:12:11 +00:00
|
|
|
|
|
|
|
/* clear all modifiers */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "clear", "rna_Object_modifier_clear");
|
2011-11-23 16:12:11 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
|
|
|
RNA_def_function_ui_description(func, "Remove all modifiers from the object");
|
2010-09-07 05:47:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* object.particle_systems */
|
|
|
|
static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
/* FunctionRNA *func; */
|
|
|
|
/* PropertyRNA *parm; */
|
2010-09-07 05:47:34 +00:00
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "ParticleSystems");
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "ParticleSystems", NULL);
|
2010-09-07 05:47:34 +00:00
|
|
|
RNA_def_struct_sdna(srna, "Object");
|
|
|
|
RNA_def_struct_ui_text(srna, "Particle Systems", "Collection of particle systems");
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
2010-09-07 05:47:34 +00:00
|
|
|
RNA_def_property_struct_type(prop, "ParticleSystem");
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2010-09-07 05:47:34 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
|
2010-09-21 10:59:53 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2011-09-25 09:55:13 +00:00
|
|
|
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-09-07 05:47:34 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_particle_update");
|
2010-09-07 05:47:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* object.vertex_groups */
|
|
|
|
static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "VertexGroups");
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "VertexGroups", NULL);
|
2010-09-07 05:47:34 +00:00
|
|
|
RNA_def_struct_sdna(srna, "Object");
|
|
|
|
RNA_def_struct_ui_text(srna, "Vertex Groups", "Collection of vertex groups");
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
2010-09-07 05:47:34 +00:00
|
|
|
RNA_def_property_struct_type(prop, "VertexGroup");
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get",
|
|
|
|
"rna_Object_active_vertex_group_set", NULL, NULL);
|
2010-09-07 05:47:34 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
|
2010-09-07 05:47:34 +00:00
|
|
|
|
2012-12-11 14:11:46 +00:00
|
|
|
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
|
2010-09-21 10:59:53 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2010-09-07 05:47:34 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "actdef");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get",
|
|
|
|
"rna_Object_active_vertex_group_index_set",
|
2011-09-25 09:55:13 +00:00
|
|
|
"rna_Object_active_vertex_group_index_range");
|
2010-09-07 05:47:34 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
|
2010-09-07 05:47:34 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
/* vertex groups */ /* add_vertex_group */
|
|
|
|
func = RNA_def_function(srna, "new", "rna_Object_vgroup_new");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Add vertex group to object");
|
|
|
|
RNA_def_string(func, "name", "Group", 0, "", "Vertex group name"); /* optional */
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group");
|
2010-09-07 05:47:34 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "remove", "rna_Object_vgroup_remove");
|
2012-11-02 09:41:26 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Delete vertex group from object");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to remove");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
|
|
|
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
2011-11-23 16:12:11 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "clear", "rna_Object_vgroup_clear");
|
2011-11-23 16:12:11 +00:00
|
|
|
RNA_def_function_ui_description(func, "Delete all vertex groups from object");
|
2009-11-28 13:33:56 +00:00
|
|
|
}
|
|
|
|
|
2010-09-07 05:47:34 +00:00
|
|
|
|
2013-12-18 15:34:56 +11:00
|
|
|
static void rna_def_object_lodlevel(BlenderRNA *brna)
|
2013-12-17 14:42:47 -08:00
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "LodLevel", NULL);
|
|
|
|
RNA_def_struct_sdna(srna, "LodLevel");
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "distance");
|
|
|
|
RNA_def_property_range(prop, 0.0, FLT_MAX);
|
|
|
|
RNA_def_property_ui_text(prop, "Distance", "Distance to begin using this level of detail");
|
2013-12-18 15:34:56 +11:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_LOD, "rna_Object_lod_distance_update");
|
2013-12-17 14:42:47 -08:00
|
|
|
|
2015-03-22 18:13:53 +01:00
|
|
|
prop = RNA_def_property(srna, "object_hysteresis_percentage", PROP_INT, PROP_PERCENTAGE);
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "obhysteresis");
|
|
|
|
RNA_def_property_range(prop, 0, 100);
|
|
|
|
RNA_def_property_ui_range(prop, 0, 100, 10, 1);
|
2015-03-23 22:51:12 +11:00
|
|
|
RNA_def_property_ui_text(prop, "Hysteresis %",
|
|
|
|
"Minimum distance change required to transition to the previous level of detail");
|
2015-03-22 18:13:53 +01:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL);
|
|
|
|
|
2013-12-17 14:42:47 -08:00
|
|
|
prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "source");
|
|
|
|
RNA_def_property_struct_type(prop, "Object");
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_ui_text(prop, "Object", "Object to use for this level of detail");
|
2013-12-18 15:34:56 +11:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL);
|
2013-12-17 14:42:47 -08:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_mesh", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flags", OB_LOD_USE_MESH);
|
|
|
|
RNA_def_property_ui_text(prop, "Use Mesh", "Use the mesh from this object at this level of detail");
|
|
|
|
RNA_def_property_ui_icon(prop, ICON_MESH_DATA, 0);
|
2013-12-18 15:34:56 +11:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL);
|
2013-12-17 14:42:47 -08:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flags", OB_LOD_USE_MAT);
|
|
|
|
RNA_def_property_ui_text(prop, "Use Material", "Use the material from this object at this level of detail");
|
|
|
|
RNA_def_property_ui_icon(prop, ICON_MATERIAL, 0);
|
2013-12-18 15:34:56 +11:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL);
|
2015-03-22 18:13:53 +01:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_object_hysteresis", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flags", OB_LOD_USE_HYST);
|
2015-03-24 21:36:26 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Hysteresis Override", "Override LoD Hysteresis scene setting for this LoD level");
|
2015-03-22 18:13:53 +01:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL);
|
2013-12-17 14:42:47 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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 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", ""},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2009-01-02 16:58:09 +00:00
|
|
|
|
|
|
|
static EnumPropertyItem drawtype_items[] = {
|
2012-03-02 21:14:37 +00:00
|
|
|
{OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Draw the bounds of the object"},
|
2011-05-15 17:59:48 +00:00
|
|
|
{OB_WIRE, "WIRE", 0, "Wire", "Draw the object as a wireframe"},
|
2011-09-24 09:57:47 +00:00
|
|
|
{OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (if solid drawing is enabled in the viewport)"},
|
2012-03-18 09:27:36 +00:00
|
|
|
{OB_TEXTURE, "TEXTURED", 0, "Textured",
|
|
|
|
"Draw the object with textures (if textures are enabled in the viewport)"},
|
2012-05-12 11:01:29 +00:00
|
|
|
{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[] = {
|
2011-05-15 17:59:48 +00:00
|
|
|
{OB_BOUND_BOX, "BOX", 0, "Box", "Draw bounds as box"},
|
|
|
|
{OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Draw bounds as sphere"},
|
|
|
|
{OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Draw bounds as cylinder"},
|
|
|
|
{OB_BOUND_CONE, "CONE", 0, "Cone", "Draw bounds as cone"},
|
2013-03-18 20:32:30 +00:00
|
|
|
{OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Draw bounds as capsule"},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-12-09 12:43:40 +00:00
|
|
|
|
2012-03-18 09:27:36 +00:00
|
|
|
/* XXX: this RNA enum define is currently duplicated for objects,
|
|
|
|
* since there is some text here which is not applicable */
|
2009-10-22 23:22:05 +00:00
|
|
|
static EnumPropertyItem prop_rotmode_items[] = {
|
2010-02-11 01:11:52 +00:00
|
|
|
{ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"},
|
2011-09-24 09:57:47 +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"},
|
2011-09-25 09:55:13 +00:00
|
|
|
{ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle",
|
|
|
|
"Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
};
|
2009-12-28 03:45:24 +00:00
|
|
|
|
2012-05-12 11:01:29 +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 */
|
2012-04-29 15:47:02 +00:00
|
|
|
static float default_scale[3] = {1, 1, 1}; /* default scale values */
|
2012-03-05 23:30:41 +00:00
|
|
|
static 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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "Object", "ID");
|
2015-10-24 02:44:43 +11:00
|
|
|
RNA_def_struct_ui_text(srna, "Object", "Object data-block 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
|
|
|
|
2012-03-05 23:30:41 +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);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
2009-07-14 20:27:28 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "type");
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_object_type_items);
|
2009-07-14 20:27:28 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
|
2009-08-15 22:35:00 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "mode");
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_object_mode_items);
|
2009-08-16 05:48:07 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +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);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_layer_update");
|
2012-12-17 18:45:13 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2012-06-25 11:43:22 +00:00
|
|
|
prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000);
|
|
|
|
RNA_def_property_array(prop, 8);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_ui_text(prop, "Local View Layers", "3D local view layers the object is on");
|
|
|
|
|
2012-03-05 23:30:41 +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");
|
2012-05-12 11:01:29 +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 */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "bound_box", PROP_FLOAT, PROP_NONE);
|
2010-02-10 20:29:40 +00:00
|
|
|
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);
|
2011-09-24 09:57:47 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Bounding Box",
|
2012-03-18 09:27:36 +00:00
|
|
|
"Object's bounding box in object-space coordinates, all values are -1.0 when "
|
|
|
|
"not available");
|
2010-02-10 20:29:40 +00:00
|
|
|
|
2010-03-26 02:57:49 +00:00
|
|
|
/* parent */
|
2012-03-05 23:30:41 +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);
|
2012-05-12 11:01:29 +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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
|
2009-04-24 01:17:54 +00:00
|
|
|
|
2012-03-05 23:30:41 +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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
|
2009-01-02 13:47:33 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED);
|
2009-01-02 13:47:33 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "par1");
|
|
|
|
RNA_def_property_array(prop, 3);
|
2011-09-24 09:57:47 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in case of a vertex parenting relation");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
|
2009-01-02 13:47:33 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
|
2009-01-02 13:47:33 +00:00
|
|
|
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");
|
2012-05-12 11:01:29 +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 */
|
2012-03-18 09:27:36 +00:00
|
|
|
/* XXX: these have been saved here for a bit longer (after old track was removed),
|
|
|
|
* since some other tools still refer to this */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "trackflag");
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Track Axis",
|
|
|
|
"Axis that points in 'forward' direction (applies to DupliFrame when "
|
|
|
|
"parent 'Follow' is enabled)");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "upflag");
|
|
|
|
RNA_def_property_enum_items(prop, up_items);
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Up Axis",
|
|
|
|
"Axis that points in the upward direction (applies to DupliFrame when "
|
|
|
|
"parent 'Follow' is enabled)");
|
2012-05-12 11:01:29 +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 */
|
2012-03-05 23:30:41 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +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 */
|
2012-03-05 23:30:41 +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");
|
2012-05-12 11:01:29 +00:00
|
|
|
/* don't dereference pointer! */
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL);
|
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
|
|
|
|
2012-03-05 23:30:41 +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");
|
2012-03-18 09:27:36 +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);
|
2014-05-29 16:16:31 +10:00
|
|
|
RNA_def_property_editable_func(prop, "rna_Object_active_material_editable");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
|
2009-01-04 19:25:24 +00:00
|
|
|
|
2012-03-05 23:30:41 +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");
|
2010-09-21 10:59:53 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2011-09-25 09:55:13 +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");
|
2012-11-26 08:52:07 +00:00
|
|
|
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, NULL);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2009-01-01 20:44:40 +00:00
|
|
|
/* transform */
|
2012-03-05 23:30:41 +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");
|
2012-04-10 08:33:30 +00:00
|
|
|
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
|
2009-10-22 23:22:05 +00:00
|
|
|
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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-05-12 11:01:29 +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...
|
|
|
|
*/
|
2012-03-05 23:30:41 +00:00
|
|
|
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);
|
2012-03-18 09:27:36 +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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2008-12-02 10:10:07 +00:00
|
|
|
|
2012-03-05 23:30:41 +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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
|
2009-10-22 23:22:05 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "rotmode");
|
2012-03-05 23:30:41 +00:00
|
|
|
RNA_def_property_enum_items(prop, prop_rotmode_items); /* XXX move to using a single define of this someday */
|
2009-10-22 23:22:05 +00:00
|
|
|
RNA_def_property_enum_funcs(prop, NULL, "rna_Object_rotation_mode_set", NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Rotation Mode", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2008-12-02 10:10:07 +00:00
|
|
|
|
2012-03-05 23:30:41 +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");
|
2014-02-09 08:42:45 +11:00
|
|
|
RNA_def_property_flag(prop, PROP_PROPORTIONAL);
|
2009-11-25 12:00:31 +00:00
|
|
|
RNA_def_property_editable_array_func(prop, "rna_Object_scale_editable");
|
2010-09-16 04:19:22 +00:00
|
|
|
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
|
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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-05 23:30:41 +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);
|
2016-06-06 12:54:55 +10:00
|
|
|
/* only for the transform-panel and conflicts with animating scale */
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2009-11-04 23:14:20 +00:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_Object_dimensions_get", "rna_Object_dimensions_set", NULL);
|
2014-02-25 18:31:50 +11:00
|
|
|
RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Dimensions", "Absolute bounding box dimensions of the object");
|
2012-05-12 11:01:29 +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-22 23:22:05 +00:00
|
|
|
|
|
|
|
/* delta transforms */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "delta_location", PROP_FLOAT, PROP_TRANSLATION);
|
2009-10-22 23:22:05 +00:00
|
|
|
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");
|
2012-04-10 08:33:30 +00:00
|
|
|
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "delta_rotation_euler", PROP_FLOAT, PROP_EULER);
|
2009-10-22 23:22:05 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "drot");
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Delta Rotation (Euler)",
|
|
|
|
"Extra rotation added to the rotation of the object (when using Euler rotations)");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
|
2009-10-22 23:22:05 +00:00
|
|
|
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);
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Delta Rotation (Quaternion)",
|
|
|
|
"Extra rotation added to the rotation of the object (when using Quaternion rotations)");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
#if 0 /* XXX not supported well yet... */
|
|
|
|
prop = RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
|
2012-05-12 11:01:29 +00:00
|
|
|
/* FIXME: this is not a single field any more! (drotAxis and drotAngle) */
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "dquat");
|
2009-12-28 03:45:24 +00:00
|
|
|
RNA_def_property_float_array_default(prop, default_axisAngle);
|
2011-09-25 09:55:13 +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)");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2009-10-22 23:22:05 +00:00
|
|
|
#endif
|
2012-04-10 08:33:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "delta_scale", PROP_FLOAT, PROP_XYZ);
|
2011-12-04 03:35:54 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "dscale");
|
2014-02-09 08:42:45 +11:00
|
|
|
RNA_def_property_flag(prop, PROP_PROPORTIONAL);
|
2011-12-11 00:01:04 +00:00
|
|
|
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
|
|
|
|
RNA_def_property_float_array_default(prop, default_scale);
|
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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
/* transform locks */
|
2012-04-10 08:33:30 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
|
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);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2009-01-02 13:47:33 +00:00
|
|
|
|
2012-04-10 08:33:30 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
|
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);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
/* XXX this is sub-optimal - it really should be included above,
|
|
|
|
* but due to technical reasons we can't do this! */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
|
2009-10-22 23:22:05 +00:00
|
|
|
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);
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)",
|
|
|
|
"Lock editing of 'angle' component of four-component rotations in the interface");
|
2012-05-12 11:01:29 +00:00
|
|
|
/* XXX this needs a better name */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
|
2009-10-22 23:22:05 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
|
2011-09-25 09:55:13 +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
|
|
|
|
2012-04-10 08:33:30 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
|
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);
|
2012-05-12 11:01:29 +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 */
|
2012-03-05 23:30:41 +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");
|
2010-11-30 20:22:26 +00:00
|
|
|
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2010-07-03 17:39:29 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Matrix World", "Worldspace transformation matrix");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_matrix_world_update");
|
2010-07-03 17:39:29 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
|
2010-11-30 20:22:26 +00:00
|
|
|
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2014-12-20 14:14:36 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Local Matrix", "Parent relative transformation matrix - "
|
|
|
|
"WARNING: Only takes into account 'Object' parenting, so e.g. in case of bone parenting "
|
|
|
|
"you get a matrix relative to the Armature object, not to the actual parent bone");
|
2010-07-03 17:39:29 +00:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_Object_matrix_local_get", "rna_Object_matrix_local_set", NULL);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, NULL);
|
2009-06-18 19:48:55 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
|
2010-11-30 20:22:26 +00:00
|
|
|
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Input Matrix",
|
|
|
|
"Matrix access to location, rotation and scale (including deltas), "
|
|
|
|
"before constraints and parenting are applied");
|
2010-11-15 06:38:07 +00:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2011-08-15 17:29:07 +00:00
|
|
|
|
|
|
|
/*parent_inverse*/
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX);
|
2011-08-15 17:29:07 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "parentinv");
|
|
|
|
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
|
|
|
|
RNA_def_property_ui_text(prop, "Matrix", "Inverse of object's parent matrix at time of parenting");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2011-08-15 17:29:07 +00:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* modifiers */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
|
2011-09-05 21:01:50 +00:00
|
|
|
RNA_def_property_struct_type(prop, "Modifier");
|
|
|
|
RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the geometric data of the object");
|
|
|
|
rna_def_object_modifiers(brna, prop);
|
|
|
|
|
|
|
|
/* constraints */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
|
2008-12-12 23:30:23 +00:00
|
|
|
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");
|
2013-09-11 21:27:14 +00:00
|
|
|
/* RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "constraints__add", "constraints__remove"); */
|
2009-11-13 16:08:03 +00:00
|
|
|
rna_def_object_constraints(brna, prop);
|
2009-01-02 13:47:33 +00:00
|
|
|
|
2009-01-01 20:44:40 +00:00
|
|
|
/* game engine */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "game", PROP_POINTER, PROP_NONE);
|
2009-10-22 23:22:05 +00:00
|
|
|
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 */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE);
|
2009-01-01 20:44:40 +00:00
|
|
|
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");
|
2010-09-07 05:47:34 +00:00
|
|
|
rna_def_object_vertex_groups(brna, prop);
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2009-01-02 13:47:33 +00:00
|
|
|
/* empty */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "empty_draw_type", PROP_ENUM, PROP_NONE);
|
2009-01-02 13:47:33 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "empty_drawtype");
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_object_empty_drawtype_items);
|
2014-01-13 21:57:05 +01:00
|
|
|
RNA_def_property_enum_funcs(prop, NULL, "rna_Object_empty_draw_type_set", NULL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Empty Display Type", "Viewport display style for empties");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-02 13:47:33 +00:00
|
|
|
|
2012-03-05 23:30:41 +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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-02 13:47:33 +00:00
|
|
|
|
2013-06-06 05:48:16 +00:00
|
|
|
prop = RNA_def_property(srna, "empty_image_offset", PROP_FLOAT, PROP_NONE);
|
2011-05-09 16:31:54 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "ima_ofs");
|
|
|
|
RNA_def_property_ui_text(prop, "Origin Offset", "Origin offset distance");
|
|
|
|
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1f, 2);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2011-05-09 16:31:54 +00:00
|
|
|
|
2014-01-13 21:57:05 +01:00
|
|
|
prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "iuser");
|
|
|
|
RNA_def_property_ui_text(prop, "Image User",
|
2014-01-16 19:15:53 +11:00
|
|
|
"Parameters defining which layer, pass and frame of the image is displayed");
|
2014-01-13 21:57:05 +01:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
|
|
|
|
2009-01-02 16:58:09 +00:00
|
|
|
/* render */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
|
2009-01-01 20:44:40 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "index");
|
2016-08-30 22:05:27 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Pass Index", "Index number for the \"Object Index\" render pass");
|
2013-07-02 12:52:37 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT, "rna_Object_internal_update");
|
2009-12-17 06:06:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
|
2009-01-01 20:44:40 +00:00
|
|
|
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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-02 13:47:33 +00:00
|
|
|
|
|
|
|
/* physics */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE);
|
2009-01-02 13:47:33 +00:00
|
|
|
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);
|
2011-09-24 09:57:47 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the object as a field in physics simulation");
|
2009-01-02 13:47:33 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE);
|
2009-01-02 13:47:33 +00:00
|
|
|
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);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Collision Settings",
|
|
|
|
"Settings for using the object as a collider in physics simulation");
|
2009-01-02 13:47:33 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
|
2009-01-02 13:47:33 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "particle_systems", PROP_COLLECTION, PROP_NONE);
|
2009-01-02 13:47:33 +00:00
|
|
|
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");
|
2010-09-07 05:47:34 +00:00
|
|
|
rna_def_object_particle_systems(brna, prop);
|
2009-06-27 15:41:47 +00:00
|
|
|
|
2013-01-23 05:56:22 +00:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "rigid_body", PROP_POINTER, PROP_NONE);
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_object");
|
|
|
|
RNA_def_property_struct_type(prop, "RigidBodyObject");
|
|
|
|
RNA_def_property_ui_text(prop, "Rigid Body Settings", "Settings for rigid body simulation");
|
2013-01-23 05:56:56 +00:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "rigid_body_constraint", PROP_POINTER, PROP_NONE);
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_constraint");
|
|
|
|
RNA_def_property_struct_type(prop, "RigidBodyConstraint");
|
|
|
|
RNA_def_property_ui_text(prop, "Rigid Body Constraint", "Constraint constraining rigid bodies");
|
2013-01-23 05:56:22 +00:00
|
|
|
|
2009-01-02 13:47:33 +00:00
|
|
|
/* restrict */
|
2012-03-05 23:30:41 +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);
|
2012-06-25 11:43:22 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
|
2009-01-02 13:47:33 +00:00
|
|
|
|
2012-03-05 23:30:41 +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);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-02 13:47:33 +00:00
|
|
|
|
2012-03-05 23:30:41 +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);
|
2012-06-25 11:43:22 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
|
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);
|
|
|
|
|
2011-11-06 05:46:45 +00:00
|
|
|
/* slow parenting */
|
2012-03-05 23:30:41 +00:00
|
|
|
/* XXX: evil old crap */
|
|
|
|
prop = RNA_def_property(srna, "use_slow_parent", PROP_BOOLEAN, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "partype", PARSLOW);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Slow Parent",
|
|
|
|
"Create a delay in the parent relationship (beware: this isn't renderfarm "
|
|
|
|
"safe and may be invalid after jumping around the timeline)");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
|
2011-11-06 05:46:45 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
prop = RNA_def_property(srna, "slow_parent_offset", PROP_FLOAT, PROP_NONE | PROP_UNIT_TIME);
|
2011-11-06 05:46:45 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "sf");
|
|
|
|
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
|
2011-11-26 12:30:01 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Slow Parent Offset", "Delay in the parent relationship");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
|
2011-11-06 05:46:45 +00:00
|
|
|
|
2013-01-10 18:20:29 +00:00
|
|
|
/* depsgraph hack */
|
2013-04-23 07:06:29 +00:00
|
|
|
prop = RNA_def_property(srna, "use_extra_recalc_object", PROP_BOOLEAN, PROP_NONE);
|
2013-01-10 18:20:29 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "depsflag", OB_DEPS_EXTRA_OB_RECALC);
|
|
|
|
RNA_def_property_ui_text(prop, "Extra Object Update", "Refresh this object again on frame changes, dependency graph hack");
|
|
|
|
|
2013-04-23 07:06:29 +00:00
|
|
|
prop = RNA_def_property(srna, "use_extra_recalc_data", PROP_BOOLEAN, PROP_NONE);
|
2013-01-10 18:20:29 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "depsflag", OB_DEPS_EXTRA_DATA_RECALC);
|
|
|
|
RNA_def_property_ui_text(prop, "Extra Data Update", "Refresh this object's data again on frame changes, dependency graph hack");
|
|
|
|
|
2011-11-06 05:46:45 +00:00
|
|
|
/* duplicates */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "dupli_type", PROP_ENUM, PROP_NONE);
|
2009-04-11 01:43:50 +00:00
|
|
|
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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_dupli_frames_speed", PROP_BOOLEAN, PROP_NONE);
|
2010-01-04 17:27:23 +00:00
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Dupli Frames Speed",
|
|
|
|
"Set dupliframes to use the current frame instead of parent curve's evaluation time");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_dupli_vertices_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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_dupli_faces_scale", PROP_BOOLEAN, PROP_NONE);
|
2010-01-04 17:27:23 +00:00
|
|
|
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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "dupli_faces_scale", PROP_FLOAT, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
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");
|
2014-09-24 19:48:16 +02:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
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-12-19 10:38:02 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_dup_group_set", NULL, NULL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-05-12 11:01:29 +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-22 23:22:05 +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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-05-12 11:01:29 +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-22 23:22:05 +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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-05-12 11:01:29 +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-22 23:22:05 +00:00
|
|
|
RNA_def_property_range(prop, MINFRAME, MAXFRAME);
|
2013-04-08 18:55:08 +00:00
|
|
|
RNA_def_property_ui_range(prop, 1, 1500, 1, -1);
|
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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-05-12 11:01:29 +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-22 23:22:05 +00:00
|
|
|
RNA_def_property_range(prop, 0, MAXFRAME);
|
2013-04-08 18:55:08 +00:00
|
|
|
RNA_def_property_ui_range(prop, 0, 1500, 1, -1);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Dupli Frames Off", "Recurring frames to exclude from the Dupliframes");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "dupli_list", PROP_COLLECTION, PROP_NONE);
|
2009-10-22 23:22:05 +00:00
|
|
|
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-01-02 16:58:09 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "is_duplicator", PROP_BOOLEAN, PROP_NONE);
|
2010-05-02 13:48:32 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLI);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2011-11-06 05:46:45 +00:00
|
|
|
|
2009-01-02 16:58:09 +00:00
|
|
|
/* drawing */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "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");
|
2014-03-13 02:50:01 +09:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE);
|
2013-01-18 19:01:26 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWBOUNDOX);
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Draw Bounds", "Display the object's bounds");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-02 16:58:09 +00:00
|
|
|
|
2012-03-05 23:30: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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-03 05:41:58 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWNAME);
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Draw Name", "Display the object's name");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-03 05:41:58 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_axis", PROP_BOOLEAN, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_AXIS);
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Draw Axes", "Display the object's origin and axes");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-03 05:41:58 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_texture_space", PROP_BOOLEAN, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_TEXSPACE);
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Draw Texture Space", "Display the object's texture space");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-03 05:41:58 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWWIRE);
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Draw Wire", "Add the object's wireframe over solid drawing");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2013-01-18 19:01:26 +00:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAW_ALL_EDGES);
|
|
|
|
RNA_def_property_ui_text(prop, "Draw All Edges", "Display all edges for mesh objects");
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP);
|
2011-09-25 09:55:13 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Draw Transparent",
|
|
|
|
"Display material transparency in the object (unsupported for duplicator drawing)");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-03 05:41:58 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "X-Ray",
|
|
|
|
"Make the object draw in front of others (unsupported for duplicator drawing)");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-01-03 05:41:58 +00:00
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
/* Grease Pencil */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
|
2009-09-16 17:43:09 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "gpd");
|
|
|
|
RNA_def_property_struct_type(prop, "GreasePencil");
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
|
2015-10-24 02:44:43 +11:00
|
|
|
RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil data-block");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2009-02-02 11:51:10 +00:00
|
|
|
/* pose */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "poselib");
|
2009-01-07 04:06:52 +00:00
|
|
|
RNA_def_property_struct_type(prop, "Action");
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
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 */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE);
|
2009-01-02 16:58:09 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_shape_key_edit_mode", PROP_BOOLEAN, PROP_NONE);
|
2009-11-01 00:06:53 +00:00
|
|
|
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-11-01 00:06:53 +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-11-01 00:06:53 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "active_shape_key", PROP_POINTER, PROP_NONE);
|
2009-07-03 15:23:33 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +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");
|
2012-03-05 23:30:41 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX this is really unpredictable... */
|
2012-03-18 09:27:36 +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-11-01 00:06:53 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Object_active_shape_update");
|
2009-06-18 19:48:55 +00:00
|
|
|
|
2012-12-30 18:27:33 +00:00
|
|
|
/* sculpt */
|
|
|
|
prop = RNA_def_property(srna, "use_dynamic_topology_sculpting", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_Object_use_dynamic_topology_sculpting_get", NULL);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_ui_text(prop, "Dynamic Topology Sculpting", NULL);
|
|
|
|
|
2013-12-17 14:42:47 -08:00
|
|
|
/* Levels of Detail */
|
|
|
|
prop = RNA_def_property(srna, "lod_levels", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "lodlevels", NULL);
|
|
|
|
RNA_def_property_struct_type(prop, "LodLevel");
|
|
|
|
RNA_def_property_ui_text(prop, "Level of Detail Levels", "A collection of detail levels to automatically switch between");
|
2013-12-18 15:34:56 +11:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL);
|
2013-12-17 14:42:47 -08:00
|
|
|
|
2009-06-18 19:48:55 +00:00
|
|
|
RNA_api_object(srna);
|
2009-01-01 20:44:40 +00:00
|
|
|
}
|
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
static void rna_def_dupli_object(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "DupliObject", NULL);
|
2009-10-22 23:22:05 +00:00
|
|
|
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-10-22 23:22:05 +00:00
|
|
|
/* RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA); */
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
|
2009-10-22 23:22:05 +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-10-22 23:22:05 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
|
2009-10-22 23:22:05 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "mat");
|
2010-11-30 20:22:26 +00:00
|
|
|
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
2010-02-17 16:18:41 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Object Duplicate Matrix", "Object duplicate transformation matrix");
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
|
2012-01-11 13:55:00 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "no_draw", 0);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
2012-01-11 13:55:00 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Hide", "Don't show dupli object in viewport or render");
|
|
|
|
|
2012-06-08 16:17:57 +00:00
|
|
|
prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
|
2012-11-08 16:35:28 +00:00
|
|
|
RNA_def_property_int_funcs(prop, "rna_DupliObject_index_get", NULL, NULL);
|
2012-06-08 16:17:57 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
|
|
|
RNA_def_property_ui_text(prop, "Index", "Index in the lowest-level dupli list");
|
2012-11-08 16:35:28 +00:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "persistent_id", PROP_INT, PROP_NONE);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
|
|
|
RNA_def_property_ui_text(prop, "Persistent ID", "Persistent identifier for inter-frame matching of objects with motion blur");
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
|
2012-06-08 16:17:57 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
2012-11-08 16:35:28 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Particle System", "Particle system that this dupli object was instanced from");
|
2012-06-08 16:17:57 +00:00
|
|
|
|
2012-10-04 21:40:39 +00:00
|
|
|
prop = RNA_def_property(srna, "orco", PROP_FLOAT, PROP_TRANSLATION);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
|
|
|
RNA_def_property_ui_text(prop, "Generated Coordinates", "Generated coordinates in parent object space");
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE);
|
|
|
|
RNA_def_property_array(prop, 2);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
|
|
|
RNA_def_property_ui_text(prop, "UV Coordinates", "UV coordinates in parent object space");
|
2012-12-09 12:43:40 +00:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
|
|
|
RNA_def_property_enum_items(prop, dupli_items);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
|
|
|
RNA_def_property_ui_text(prop, "Dupli Type", "Duplicator type that generated this dupli object");
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
2012-03-05 23:30:41 +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);
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
|
2009-11-02 11:14:22 +00:00
|
|
|
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 */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
|
2009-11-02 11:14:22 +00:00
|
|
|
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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Base_layer_update");
|
2012-06-25 11:43:22 +00:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000);
|
|
|
|
RNA_def_property_array(prop, 8);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_ui_text(prop, "Local View Layers", "3D local view layers the object base is on");
|
2010-02-17 16:18:41 +00:00
|
|
|
|
2012-03-05 23:30:41 +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");
|
2012-05-12 11:01:29 +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);
|
2013-10-01 04:49:47 +00:00
|
|
|
|
|
|
|
RNA_define_animate_sdna(false);
|
2009-01-10 22:57:33 +00:00
|
|
|
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-10-22 23:22:05 +00:00
|
|
|
rna_def_dupli_object(brna);
|
2013-10-01 04:49:47 +00:00
|
|
|
RNA_define_animate_sdna(true);
|
2013-12-17 14:42:47 -08:00
|
|
|
rna_def_object_lodlevel(brna);
|
2008-10-31 23:50:02 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#endif
|