2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
28 #ifndef __BKE_OBJECT_H__
29 #define __BKE_OBJECT_H__
31 /** \file BKE_object.h
33 * \brief General operations, lookup, etc. for blender objects.
46 struct BulletSoftBody;
53 void BKE_object_workob_clear(struct Object *workob);
54 void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob);
56 void BKE_object_transform_copy(struct Object *ob_tar, const struct Object *ob_src);
57 struct SoftBody *copy_softbody(struct SoftBody *sb);
58 struct BulletSoftBody *copy_bulletsoftbody(struct BulletSoftBody *sb);
59 void BKE_object_copy_particlesystems(struct Object *obn, struct Object *ob);
60 void BKE_object_copy_softbody(struct Object *obn, struct Object *ob);
61 void BKE_object_free_particlesystems(struct Object *ob);
62 void BKE_object_free_softbody(struct Object *ob);
63 void BKE_object_free_bulletsoftbody(struct Object *ob);
64 void BKE_object_update_base_layer(struct Scene *scene, struct Object *ob);
66 void BKE_object_free(struct Object *ob);
67 void BKE_object_free_display(struct Object *ob);
69 int BKE_object_support_modifier_type_check(struct Object *ob, int modifier_type);
71 void BKE_object_link_modifiers(struct Object *ob, struct Object *from);
72 void BKE_object_free_modifiers(struct Object *ob);
74 void BKE_object_make_proxy(struct Object *ob, struct Object *target, struct Object *gob);
75 void BKE_object_copy_proxy_drivers(struct Object *ob, struct Object *target);
77 void BKE_object_unlink(struct Object *ob);
78 int BKE_object_exists_check(struct Object *obtest);
80 struct Object *BKE_object_add_only_object(int type, const char *name);
81 struct Object *BKE_object_add(struct Scene *scene, int type);
82 void *BKE_object_obdata_add_from_type(int type);
84 struct Object *BKE_object_copy(struct Object *ob);
85 void BKE_object_make_local(struct Object *ob);
86 int BKE_object_is_libdata(struct Object *ob);
87 int BKE_object_obdata_is_libdata(struct Object *ob);
89 void BKE_object_scale_to_mat3(struct Object *ob, float mat[][3]);
90 void BKE_object_rot_to_mat3(struct Object *ob, float mat[][3]);
91 void BKE_object_mat3_to_rot(struct Object *ob, float mat[][3], short use_compat);
92 void BKE_object_to_mat3(struct Object *ob, float mat[][3]);
93 void BKE_object_to_mat4(struct Object *ob, float mat[][4]);
94 void BKE_object_apply_mat4(struct Object *ob, float mat[][4], const short use_compat, const short use_parent);
96 struct Object *BKE_object_pose_armature_get(struct Object *ob);
98 void BKE_object_where_is_calc(struct Scene *scene, struct Object *ob);
99 void BKE_object_where_is_calc_time(struct Scene *scene, struct Object *ob, float ctime);
100 void BKE_object_where_is_calc_simul(struct Scene *scene, struct Object *ob);
101 void BKE_object_where_is_calc_mat4(struct Scene *scene, struct Object *ob, float obmat[4][4]);
103 /* possibly belong in own moduke? */
104 struct BoundBox *BKE_boundbox_alloc_unit(void);
105 void BKE_boundbox_init_from_minmax(struct BoundBox *bb, float min[3], float max[3]);
106 int BKE_boundbox_ray_hit_check(struct BoundBox *bb, float ray_start[3], float ray_normal[3]);
108 struct BoundBox *BKE_object_boundbox_get(struct Object *ob);
109 void BKE_object_dimensions_get(struct Object *ob, float vec[3]);
110 void BKE_object_dimensions_set(struct Object *ob, const float *value);
111 void BKE_object_boundbox_flag(struct Object *ob, int flag, int set);
112 void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3]);
113 int BKE_object_minmax_dupli(struct Scene *scene, struct Object *ob, float r_min[3], float r_max[3]);
115 /* sometimes min-max isn't enough, we need to loop over each point */
116 void BKE_object_foreach_display_point(struct Object *ob, float obmat[4][4],
117 void (*func_cb)(const float[3], void *), void *user_data);
118 void BKE_scene_foreach_display_point(struct Scene *scene,
121 void (*func_cb)(const float[3], void *), void *user_data);
123 int BKE_object_parent_loop_check(const struct Object *parent, const struct Object *ob);
125 void *BKE_object_tfm_backup(struct Object *ob);
126 void BKE_object_tfm_restore(struct Object *ob, void *obtfm_pt);
128 typedef struct ObjectTfmProtectedChannels {
129 float loc[3], dloc[3];
130 float size[3], dscale[3];
131 float rot[3], drot[3];
132 float quat[4], dquat[4];
133 float rotAxis[3], drotAxis[3];
134 float rotAngle, drotAngle;
135 } ObjectTfmProtectedChannels;
137 void BKE_object_tfm_protected_backup(const struct Object *ob,
138 ObjectTfmProtectedChannels *obtfm);
140 void BKE_object_tfm_protected_restore(struct Object *ob,
141 const ObjectTfmProtectedChannels *obtfm,
142 const short protectflag);
144 void BKE_object_handle_update(struct Scene *scene, struct Object *ob);
145 void BKE_object_sculpt_modifiers_changed(struct Object *ob);
147 int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot);
149 int BKE_object_insert_ptcache(struct Object *ob);
150 // void object_delete_ptcache(struct Object *ob, int index);
151 struct KeyBlock *BKE_object_insert_shape_key(struct Scene *scene, struct Object *ob, const char *name, int from_mix);
153 int BKE_object_is_modified(struct Scene *scene, struct Object *ob);
154 int BKE_object_is_deform_modified(struct Scene *scene, struct Object *ob);
155 int BKE_object_is_animated(struct Scene *scene, struct Object *ob);
157 void BKE_object_relink(struct Object *ob);
159 struct MovieClip *BKE_object_movieclip_get(struct Scene *scene, struct Object *ob, int use_default);
161 /* this function returns a superset of the scenes selection based on relationships */
163 typedef enum eObRelationTypes {
164 OB_REL_NONE = 0, /* just the selection as is */
165 OB_REL_PARENT = (1 << 0), /* immediate parent */
166 OB_REL_PARENT_RECURSIVE = (1 << 1), /* parents up to root of selection tree*/
167 OB_REL_CHILDREN = (1 << 2), /* immediate children */
168 OB_REL_CHILDREN_RECURSIVE = (1 << 3), /* All children */
169 OB_REL_MOD_ARMATURE = (1 << 4), /* Armatures related to the selected objects */
170 OB_REL_SCENE_CAMERA = (1 << 5), /* you might want the scene camera too even if unselected? */
173 typedef enum eObjectSet {
174 OB_SET_SELECTED, /* Selected Objects */
175 OB_SET_VISIBLE, /* Visible Objects */
176 OB_SET_ALL /* All Objects */
179 struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet objectSet, eObRelationTypes includeFilter);