Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions | Variables

object.c File Reference

#include <string.h>
#include <math.h>
#include <stdio.h>
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
#include "DNA_constraint_types.h"
#include "DNA_group_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
#include "DNA_material_types.h"
#include "DNA_meta_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_sequence_types.h"
#include "DNA_smoke_types.h"
#include "DNA_sound_types.h"
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
#include "BLI_blenlib.h"
#include "BLI_bpath.h"
#include "BLI_editVert.h"
#include "BLI_math.h"
#include "BLI_pbvh.h"
#include "BLI_utildefines.h"
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_armature.h"
#include "BKE_action.h"
#include "BKE_bullet.h"
#include "BKE_colortools.h"
#include "BKE_deform.h"
#include "BKE_DerivedMesh.h"
#include "BKE_animsys.h"
#include "BKE_anim.h"
#include "BKE_constraint.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
#include "BKE_effect.h"
#include "BKE_fcurve.h"
#include "BKE_group.h"
#include "BKE_icons.h"
#include "BKE_key.h"
#include "BKE_lamp.h"
#include "BKE_lattice.h"
#include "BKE_library.h"
#include "BKE_mesh.h"
#include "BKE_mball.h"
#include "BKE_modifier.h"
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_property.h"
#include "BKE_sca.h"
#include "BKE_scene.h"
#include "BKE_sequencer.h"
#include "BKE_speaker.h"
#include "BKE_softbody.h"
#include "BKE_material.h"
#include "BKE_camera.h"
#include "LBM_fluidsim.h"
#include "GPU_material.h"

Go to the source code of this file.

Classes

struct  ObTfmBack

Defines

#define TFMCPY(_v)   (obtfm->_v = ob->_v)
#define TFMCPY3D(_v)   copy_v3_v3(obtfm->_v, ob->_v)
#define TFMCPY4D(_v)   copy_v4_v4(obtfm->_v, ob->_v)

Typedefs

typedef struct ObTfmBack ObTfmBack

Functions

static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[][4], float slowmat[][4], int simul)
void clear_workob (Object *workob)
void copy_baseflags (struct Scene *scene)
void copy_objectflags (struct Scene *scene)
void update_base_layer (struct Scene *scene, Object *ob)
void object_free_particlesystems (Object *ob)
void object_free_softbody (Object *ob)
void object_free_bulletsoftbody (Object *ob)
void object_free_modifiers (Object *ob)
void object_link_modifiers (struct Object *ob, struct Object *from)
void object_free_display (Object *ob)
void free_sculptsession_deformMats (SculptSession *ss)
void free_sculptsession (Object *ob)
void free_object (Object *ob)
static void unlink_object__unlinkModifierLinks (void *userData, Object *ob, Object **obpoin)
void unlink_object (Object *ob)
int exist_object (Object *obtest)
static void * add_obdata_from_type (int type)
static const char * get_obdata_defname (int type)
Objectadd_only_object (int type, const char *name)
Objectadd_object (struct Scene *scene, int type)
SoftBodycopy_softbody (SoftBody *sb)
BulletSoftBodycopy_bulletsoftbody (BulletSoftBody *bsb)
static ParticleSystemcopy_particlesystem (ParticleSystem *psys)
void copy_object_particlesystems (Object *obn, Object *ob)
void copy_object_softbody (Object *obn, Object *ob)
static void copy_object_pose (Object *obn, Object *ob)
static int object_pose_context (Object *ob)
Objectobject_pose_armature_get (Object *ob)
static void copy_object_transform (Object *ob_tar, Object *ob_src)
Objectcopy_object (Object *ob)
static void extern_local_object (Object *ob)
void make_local_object (Object *ob)
int object_is_libdata (Object *ob)
int object_data_is_libdata (Object *ob)
static void armature_set_id_extern (Object *ob)
void object_copy_proxy_drivers (Object *ob, Object *target)
void object_make_proxy (Object *ob, Object *target, Object *gob)
void object_scale_to_mat3 (Object *ob, float mat[][3])
void object_rot_to_mat3 (Object *ob, float mat[][3])
void object_mat3_to_rot (Object *ob, float mat[][3], short use_compat)
void object_tfm_protected_backup (const Object *ob, ObjectTfmProtectedChannels *obtfm)
void object_tfm_protected_restore (Object *ob, const ObjectTfmProtectedChannels *obtfm, const short protectflag)
void object_apply_mat4 (Object *ob, float mat[][4], const short use_compat, const short use_parent)
void object_to_mat3 (Object *ob, float mat[][3])
void object_to_mat4 (Object *ob, float mat[][4])
static void ob_parcurve (Scene *scene, Object *ob, Object *par, float mat[][4])
static void ob_parbone (Object *ob, Object *par, float mat[][4])
static void give_parvert (Object *par, int nr, float *vec)
static void ob_parvert3 (Object *ob, Object *par, float mat[][4])
static int where_is_object_parslow (Object *ob, float obmat[4][4], float slowmat[4][4])
void where_is_object_time (Scene *scene, Object *ob, float ctime)
void where_is_object_mat (Scene *scene, Object *ob, float obmat[4][4])
void where_is_object (struct Scene *scene, Object *ob)
void where_is_object_simul (Scene *scene, Object *ob)
void what_does_parent (Scene *scene, Object *ob, Object *workob)
BoundBoxunit_boundbox (void)
void boundbox_set_from_min_max (BoundBox *bb, float min[3], float max[3])
BoundBoxobject_get_boundbox (Object *ob)
void object_boundbox_flag (Object *ob, int flag, int set)
void object_get_dimensions (Object *ob, float *value)
void object_set_dimensions (Object *ob, const float *value)
void minmax_object (Object *ob, float min[3], float max[3])
int minmax_object_duplis (Scene *scene, Object *ob, float *min, float *max)
void BKE_object_foreach_display_point (Object *ob, float obmat[4][4], void(*func_cb)(const float[3], void *), void *user_data)
void BKE_scene_foreach_display_point (Scene *scene, View3D *v3d, const short flag, void(*func_cb)(const float[3], void *), void *user_data)
void * object_tfm_backup (Object *ob)
void object_tfm_restore (Object *ob, void *obtfm_pt)
int BKE_object_parent_loop_check (const Object *par, const Object *ob)
void object_handle_update (Scene *scene, Object *ob)
void object_sculpt_modifiers_changed (Object *ob)
int give_obdata_texspace (Object *ob, short **texflag, float **loc, float **size, float **rot)
int ray_hit_boundbox (struct BoundBox *bb, float ray_start[3], float ray_normal[3])
static int pc_cmp (void *a, void *b)
int object_insert_ptcache (Object *ob)
static KeyBlockinsert_meshkey (Scene *scene, Object *ob, const char *name, int from_mix)
static KeyBlockinsert_lattkey (Scene *scene, Object *ob, const char *name, int from_mix)
static KeyBlockinsert_curvekey (Scene *scene, Object *ob, const char *name, int from_mix)
KeyBlockobject_insert_shape_key (Scene *scene, Object *ob, const char *name, int from_mix)
int object_is_modified (Scene *scene, Object *ob)
static void copy_object__forwardModifierLinks (void *UNUSED(userData), Object *UNUSED(ob), ID **idpoin)
void object_relink (Object *ob)
MovieClipobject_get_movieclip (Scene *scene, Object *ob, int use_default)

Variables

float originmat [3][3]
int enable_cu_speed = 1

Detailed Description

Definition in file object.c.


Define Documentation

#define TFMCPY (   _v)    (obtfm->_v = ob->_v)
#define TFMCPY3D (   _v)    copy_v3_v3(obtfm->_v, ob->_v)
#define TFMCPY4D (   _v)    copy_v4_v4(obtfm->_v, ob->_v)

Typedef Documentation

typedef struct ObTfmBack ObTfmBack

Function Documentation

static void* add_obdata_from_type ( int  type) [static]
Object* add_object ( struct Scene scene,
int  type 
) [read]
Object* add_only_object ( int  type,
const char *  name 
) [read]
static void armature_set_id_extern ( Object ob) [static]
void BKE_object_foreach_display_point ( Object ob,
float  obmat[4][4],
void(*)(const float[3], void *)  func_cb,
void *  user_data 
)
int BKE_object_parent_loop_check ( const Object par,
const Object ob 
)

Definition at line 2435 of file object.c.

References BKE_object_parent_loop_check(), NULL, and Object::parent.

void BKE_scene_foreach_display_point ( Scene scene,
View3D v3d,
const short  flag,
void(*)(const float[3], void *)  func_cb,
void *  user_data 
)
void boundbox_set_from_min_max ( BoundBox bb,
float  min[3],
float  max[3] 
)
void clear_workob ( Object workob)

Definition at line 118 of file object.c.

References Object::dscale, ROT_MODE_EUL, Object::rotmode, and Object::size.

Referenced by what_does_obaction(), and what_does_parent().

void copy_baseflags ( struct Scene scene)

Definition at line 127 of file object.c.

References Scene::base, ListBase::first, Base::flag, Object::flag, Base::next, and Base::object.

Referenced by set_trans_object_base_flags().

BulletSoftBody* copy_bulletsoftbody ( BulletSoftBody bsb) [read]

Definition at line 873 of file object.c.

References MEM_dupallocN(), and NULL.

Referenced by copy_attr(), copy_object(), and game_physics_copy_exec().

Object* copy_object ( Object ob) [read]
static void copy_object__forwardModifierLinks ( void *  UNUSEDuserData,
Object UNUSEDob,
ID **  idpoin 
) [static]

Definition at line 2931 of file object.c.

References ID::newid.

Referenced by object_relink().

void copy_object_particlesystems ( Object obn,
Object ob 
)
static void copy_object_pose ( Object obn,
Object ob 
) [static]
void copy_object_softbody ( Object obn,
Object ob 
)

Definition at line 991 of file object.c.

References copy_softbody(), and Object::soft.

Referenced by object_link_modifiers().

static void copy_object_transform ( Object ob_tar,
Object ob_src 
) [static]
void copy_objectflags ( struct Scene scene)

Definition at line 137 of file object.c.

References Scene::base, ListBase::first, Object::flag, Base::flag, Base::next, and Base::object.

static ParticleSystem* copy_particlesystem ( ParticleSystem psys) [static]
SoftBody* copy_softbody ( SoftBody sb) [read]
int exist_object ( Object obtest)

Definition at line 694 of file object.c.

References G, Object::id, ID::next, and NULL.

Referenced by test_constraints().

static void extern_local_object ( Object ob) [static]
void free_object ( Object ob)
void free_sculptsession ( Object ob)
void free_sculptsession_deformMats ( SculptSession ss)
static const char* get_obdata_defname ( int  type) [static]

Definition at line 730 of file object.c.

References OB_ARMATURE, OB_CAMERA, OB_CURVE, OB_EMPTY, OB_FONT, OB_LAMP, OB_LATTICE, OB_MBALL, OB_MESH, OB_SPEAKER, and OB_SURF.

Referenced by add_object().

int give_obdata_texspace ( Object ob,
short **  texflag,
float **  loc,
float **  size,
float **  rot 
)
static void give_parvert ( Object par,
int  nr,
float *  vec 
) [static]
static KeyBlock* insert_curvekey ( Scene scene,
Object ob,
const char *  name,
int  from_mix 
) [static]
static KeyBlock* insert_lattkey ( Scene scene,
Object ob,
const char *  name,
int  from_mix 
) [static]
static KeyBlock* insert_meshkey ( Scene scene,
Object ob,
const char *  name,
int  from_mix 
) [static]
void make_local_object ( Object ob)
void minmax_object ( Object ob,
float  min[3],
float  max[3] 
)
int minmax_object_duplis ( Scene scene,
Object ob,
float *  min,
float *  max 
)
static void ob_parbone ( Object ob,
Object par,
float  mat[][4] 
) [static]
static void ob_parcurve ( Scene scene,
Object ob,
Object par,
float  mat[][4] 
) [static]
static void ob_parvert3 ( Object ob,
Object par,
float  mat[][4] 
) [static]
void object_apply_mat4 ( Object ob,
float  mat[][4],
const short  use_compat,
const short  use_parent 
)
void object_boundbox_flag ( Object ob,
int  flag,
int  set 
)

Definition at line 2150 of file object.c.

References BoundBox::flag, and object_get_boundbox().

Referenced by draw_dupli_objects_color().

void object_copy_proxy_drivers ( Object ob,
Object target 
)
int object_data_is_libdata ( Object ob)
void object_free_bulletsoftbody ( Object ob)

Definition at line 176 of file object.c.

References bsbFree(), Object::bsoft, and NULL.

void object_free_display ( Object ob)
void object_free_modifiers ( Object ob)
void object_free_particlesystems ( Object ob)

Definition at line 157 of file object.c.

References BLI_remlink(), ListBase::first, Object::particlesystem, and psys_free().

Referenced by object_free_modifiers().

void object_free_softbody ( Object ob)

Definition at line 168 of file object.c.

References NULL, sbFree(), and Object::soft.

Referenced by object_free_modifiers().

BoundBox* object_get_boundbox ( Object ob) [read]
void object_get_dimensions ( Object ob,
float *  value 
)

Definition at line 2159 of file object.c.

References fabsf, mat4_to_size(), NULL, object_get_boundbox(), Object::obmat, and BoundBox::vec.

MovieClip* object_get_movieclip ( Scene scene,
Object ob,
int  use_default 
) [read]
void object_handle_update ( Scene scene,
Object ob 
)

Definition at line 2450 of file object.c.

References add_v3_v3(), ADT_RECALC_DRIVERS, armature_rebuild_pose(), BKE_animdata_from_id(), BKE_animsys_evaluate_animdata(), BKE_mesh_end_editmesh(), BKE_mesh_get_editmesh(), BKE_ptcache_ids_from_object(), BLI_assert, BLI_freelistN(), BLI_remlink(), CD_MASK_BAREMESH, CD_MASK_MCOL, CD_MASK_MTFACE, RenderData::cfra, copy_m4_m4(), copy_pose_result(), Object::customdata_mask, Scene::customdata_mask, Object::data, ParticleSettings::draw_as, ParticleSettings::dup_group, Object::dup_group, ParticleSettings::dup_ob, Group::dupli_ofs, eParticleSystemFlag_psys_updated, ListBase::first, ParticleSystemModifierData::flag, ParticleSystem::flag, bPose::flag, G, G_DEBUG, Object::id, if(), Object::imat, invert_m4_m4(), lattice_calc_modifiers(), ID::lib, make_pose_channels_hash(), makeDerivedMesh(), makeDispListCurveTypes(), makeDispListMBall(), MAX_DUPLI_RECUR, mesh_create_derived_render(), MIN2, mult_m4_m4m4(), ID::name, ParticleSystem::next, NULL, OB_ARMATURE, OB_CURVE, OB_DUPLIPARTS, OB_FONT, OB_LATTICE, OB_MBALL, OB_MESH, OB_RECALC_ALL, OB_RECALC_DATA, OB_SURF, Scene::obedit, object_handle_update(), Object::obmat, ParticleSystem::part, PART_DRAW_GR, PART_DRAW_OB, PART_DRAW_REND, particle_system_update(), Object::particlesystem, Scene::physics_settings, Object::pose, POSE_RECALC, Object::proxy, Object::proxy_from, Object::proxy_group, psys_check_enabled(), PSYS_DELETE, psys_free(), psys_get_modifier(), PTCACHE_BAKED, PTCACHE_OUTDATED, PTCACHE_QUICK_CACHE, PTCACHE_SIMULATION_VALID, PhysicsSettings::quick_cache_step, Scene::r, Object::recalc, DerivedMesh::release, ParticleSettings::ren_as, Object::transflag, Object::type, where_is_object(), and where_is_pose().

Referenced by applyProject(), group_handle_recalc_and_update(), motionpaths_calc_update_scene(), object_handle_update(), scene_update_tagged_recursive(), set_trans_object_base_flags(), and subframe_updateObject().

int object_insert_ptcache ( Object ob)
KeyBlock* object_insert_shape_key ( Scene scene,
Object ob,
const char *  name,
int  from_mix 
) [read]
int object_is_libdata ( Object ob)

Definition at line 1225 of file object.c.

References Object::id, ID::lib, and Object::proxy.

Referenced by ed_screen_context(), and view3d_context().

int object_is_modified ( Scene scene,
Object ob 
)
void object_link_modifiers ( struct Object ob,
struct Object from 
)
void object_make_proxy ( Object ob,
Object target,
Object gob 
)
void object_mat3_to_rot ( Object ob,
float  mat[][3],
short  use_compat 
)
Object* object_pose_armature_get ( Object ob) [read]
static int object_pose_context ( Object ob) [static]

Definition at line 1030 of file object.c.

References Object::mode, OB_ARMATURE, OB_MODE_POSE, Object::pose, and Object::type.

Referenced by object_pose_armature_get().

void object_relink ( Object ob)
void object_rot_to_mat3 ( Object ob,
float  mat[][3] 
)
void object_scale_to_mat3 ( Object ob,
float  mat[][3] 
)
void object_sculpt_modifiers_changed ( Object ob)
void object_set_dimensions ( Object ob,
const float *  value 
)
void* object_tfm_backup ( Object ob)
void object_tfm_protected_backup ( const Object ob,
ObjectTfmProtectedChannels obtfm 
)

Definition at line 1479 of file object.c.

References rot, size(), TFMCPY, TFMCPY3D, and TFMCPY4D.

void object_tfm_protected_restore ( Object ob,
const ObjectTfmProtectedChannels obtfm,
const short  protectflag 
)
void object_tfm_restore ( Object ob,
void *  obtfm_pt 
)
void object_to_mat3 ( Object ob,
float  mat[][3] 
)
void object_to_mat4 ( Object ob,
float  mat[][4] 
)
static int pc_cmp ( void *  a,
void *  b 
) [static]

Definition at line 2733 of file object.c.

References LinkData::data, and GET_INT_FROM_POINTER.

Referenced by object_insert_ptcache().

int ray_hit_boundbox ( struct BoundBox bb,
float  ray_start[3],
float  ray_normal[3] 
)

Definition at line 2709 of file object.c.

References i, isect_ray_tri_v3(), NULL, and BoundBox::vec.

Referenced by peelDerivedMesh(), and snapDerivedMesh().

static void solve_parenting ( Scene scene,
Object ob,
Object par,
float  obmat[][4],
float  slowmat[][4],
int  simul 
) [static]
BoundBox* unit_boundbox ( void  ) [read]

Definition at line 2110 of file object.c.

References boundbox_set_from_min_max(), max, MEM_callocN(), and min.

Referenced by add_curve(), and add_mesh().

void unlink_object ( Object ob)

Definition at line 349 of file object.c.

References Object::actuators, bScreen::areabase, Curve::bevobj, ParticleData::boid, ParticleSettings::boids, Main::camera, View3D::camera, TimeMarker::camera, Scene::camera, bPose::chanbase, constraint_get_typeinfo(), Object::constraints, bPoseChannel::constraints, Object::controllers, bPoseChannel::custom, TreeStore::data, Object::data, Camera::dof_ob, ParticleSettings::dup_ob, eBoidRuleType_Avoid, eBoidRuleType_FollowLeader, Scene::ed, ELEM, eModifierType_Cloth, Tex::env, ListBase::first, SpaceButs::flag, bConstraintTypeInfo::flush_constraint_targets, G, bConstraintTypeInfo::get_constraint_targets, BoidParticle::ground, Main::group, Camera::id, Group::id, bScreen::id, TreeStoreElem::id, Scene::id, World::id, Tex::id, Material::id, Object::id, if(), is_mball_basis_for(), ID::lib, RegionView3D::localvd, View3D::localvd, Scene::markers, Main::mat, MAX_MTEX, Object::modifiers, modifiers_foreachObjectLink(), World::mtex, Material::mtex, ScrArea::next, ARegion::next, SpaceLink::next, TimeMarker::next, ID::next, BoidRule::next, BoidState::next, ParticleTarget::next, ParticleSystem::next, bActionModifier::next, ModifierData::next, bConstraintTarget::next, bConstraint::next, bPoseChannel::next, NULL, BoidRuleFollowLeader::ob, BoidRuleGoalAvoid::ob, ParticleTarget::ob, bActionModifier::ob, OB_ARMATURE, OB_CURVE, OB_FONT, OB_MBALL, OB_RECALC_DATA, OB_RECALC_OB, OB_RECALC_TIME, ParticleEditSettings::object, VoxelData::object, PointDensity::object, EnvMap::object, MTex::object, Main::object, p, Object::parent, ParticleSystem::part, PART_PHYS_BOIDS, ToolSettings::particle, ParticleSystem::particles, Object::particlesystem, Tex::pd, Object::pd, RegionView3D::persp, ParticleSettings::phystype, SpaceButs::pinid, Object::pose, Object::proxy, Object::proxy_from, Object::proxy_group, Object::recalc, ScrArea::regionbase, ARegion::regiondata, ARegion::regiontype, rem_from_group(), RGN_TYPE_WINDOW, BoidState::rules, RV3D_CAMOB, RV3D_PERSP, SB_PIN_CONTEXT, sca_remove_ob_poin(), Main::scene, Sequence::scene_camera, Main::screen, SEQ_BEGIN, SEQ_END, ToolSettings::skgen_template, Object::soft, SPACE_BUTS, SPACE_OUTLINER, SPACE_VIEW3D, ScrArea::spacedata, ScrArea::spacetype, SpaceLink::spacetype, state, BoidSettings::states, io_export_cycles_xml::strip(), bConstraintTarget::subtarget, Curve::taperobj, bConstraintTarget::tar, ParticleSystem::target_ob, ParticleSystem::targets, Main::tex, Curve::textoncurve, Scene::toolsettings, SpaceOops::treestore, BoidRule::type, ModifierData::type, Object::type, unlink_actuators(), unlink_controllers(), unlink_object__unlinkModifierLinks(), TreeStore::usedelem, Tex::vd, and Main::world.

Referenced by free_libblock_us(), and id_unlink().

static void unlink_object__unlinkModifierLinks ( void *  userData,
Object ob,
Object **  obpoin 
) [static]

Definition at line 339 of file object.c.

References NULL, OB_RECALC_DATA, OB_RECALC_OB, OB_RECALC_TIME, and Object::recalc.

Referenced by unlink_object().

void update_base_layer ( struct Scene scene,
Object ob 
)

Definition at line 147 of file object.c.

References Scene::base, ListBase::first, Object::lay, Base::lay, Base::next, and Base::object.

void what_does_parent ( Scene scene,
Object ob,
Object workob 
)
void where_is_object ( struct Scene scene,
Object ob 
)
void where_is_object_mat ( Scene scene,
Object ob,
float  obmat[4][4] 
)
static int where_is_object_parslow ( Object ob,
float  obmat[4][4],
float  slowmat[4][4] 
) [static]

Definition at line 1855 of file object.c.

References fabsf, and Object::sf.

Referenced by where_is_object_mat(), and where_is_object_time().

void where_is_object_simul ( Scene scene,
Object ob 
)
void where_is_object_time ( Scene scene,
Object ob,
float  ctime 
)

Variable Documentation

int enable_cu_speed = 1

Definition at line 1600 of file object.c.

Referenced by frames_duplilist(), and ob_parcurve().

float originmat[3][3]

Definition at line 116 of file object.c.

Referenced by snap_sel_to_curs(), snap_sel_to_grid(), and solve_parenting().