Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/object.c
| Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_animsys.h" | #include "BKE_animsys.h" | ||||
| #include "BKE_anim.h" | #include "BKE_anim.h" | ||||
| #include "BKE_constraint.h" | #include "BKE_constraint.h" | ||||
| #include "BKE_curve.h" | #include "BKE_curve.h" | ||||
| #include "BKE_displist.h" | #include "BKE_displist.h" | ||||
| #include "BKE_effect.h" | #include "BKE_effect.h" | ||||
| #include "BKE_fcurve.h" | #include "BKE_fcurve.h" | ||||
| #include "BKE_group.h" | #include "BKE_group.h" | ||||
| #include "BKE_icons.h" | |||||
| #include "BKE_key.h" | #include "BKE_key.h" | ||||
| #include "BKE_lamp.h" | #include "BKE_lamp.h" | ||||
| #include "BKE_lattice.h" | #include "BKE_lattice.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_linestyle.h" | #include "BKE_linestyle.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_editmesh.h" | #include "BKE_editmesh.h" | ||||
| #include "BKE_mball.h" | #include "BKE_mball.h" | ||||
| ▲ Show 20 Lines • Show All 354 Lines • ▼ Show 20 Lines | void BKE_object_free_ex(Object *ob, bool do_id_user) | ||||
| /* Free runtime curves data. */ | /* Free runtime curves data. */ | ||||
| if (ob->curve_cache) { | if (ob->curve_cache) { | ||||
| BKE_curve_bevelList_free(&ob->curve_cache->bev); | BKE_curve_bevelList_free(&ob->curve_cache->bev); | ||||
| if (ob->curve_cache->path) | if (ob->curve_cache->path) | ||||
| free_path(ob->curve_cache->path); | free_path(ob->curve_cache->path); | ||||
| MEM_freeN(ob->curve_cache); | MEM_freeN(ob->curve_cache); | ||||
| } | } | ||||
| BKE_previewimg_free(&ob->preview); | |||||
| } | } | ||||
| void BKE_object_free(Object *ob) | void BKE_object_free(Object *ob) | ||||
| { | { | ||||
| BKE_object_free_ex(ob, true); | BKE_object_free_ex(ob, true); | ||||
| } | } | ||||
| static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Object **obpoin) | static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Object **obpoin) | ||||
| ▲ Show 20 Lines • Show All 567 Lines • ▼ Show 20 Lines | Object *BKE_object_add_only_object(Main *bmain, int type, const char *name) | ||||
| ob->init_state = 1; | ob->init_state = 1; | ||||
| ob->state = 1; | ob->state = 1; | ||||
| ob->obstacleRad = 1.0f; | ob->obstacleRad = 1.0f; | ||||
| ob->step_height = 0.15f; | ob->step_height = 0.15f; | ||||
| ob->jump_speed = 10.0f; | ob->jump_speed = 10.0f; | ||||
| ob->fall_speed = 55.0f; | ob->fall_speed = 55.0f; | ||||
| ob->col_group = 0x01; | ob->col_group = 0x01; | ||||
| ob->col_mask = 0xffff; | ob->col_mask = 0xffff; | ||||
| ob->preview = NULL; | |||||
| /* NT fluid sim defaults */ | /* NT fluid sim defaults */ | ||||
| ob->fluidsimSettings = NULL; | ob->fluidsimSettings = NULL; | ||||
| BLI_listbase_clear(&ob->pc_ids); | BLI_listbase_clear(&ob->pc_ids); | ||||
| /* Animation Visualization defaults */ | /* Animation Visualization defaults */ | ||||
| animviz_settings_init(&ob->avs); | animviz_settings_init(&ob->avs); | ||||
| ▲ Show 20 Lines • Show All 501 Lines • ▼ Show 20 Lines | Object *BKE_object_copy_ex(Main *bmain, Object *ob, bool copy_caches) | ||||
| /* Copy runtime surve data. */ | /* Copy runtime surve data. */ | ||||
| obn->curve_cache = NULL; | obn->curve_cache = NULL; | ||||
| if (ob->id.lib) { | if (ob->id.lib) { | ||||
| BKE_id_lib_local_paths(bmain, ob->id.lib, &obn->id); | BKE_id_lib_local_paths(bmain, ob->id.lib, &obn->id); | ||||
| } | } | ||||
| /* Do not copy object's preview (mostly due to the fact renderers create temp copy of objects). */ | |||||
sergey: I'm not sure object copy should copy previews. Several areas creates temporary copies of object… | |||||
Not Done Inline ActionsHmmm… Here I just followed what was done for existing IDs with previews (materials, textures, etc.). I think we should keep same behavior regarding previews for all ID types. Also, copying previews might take a small amount of time, but generating previews (especially for objects, groups and scenes) is much more heavy process, so… not sure. mont29: Hmmm… Here I just followed what was done for existing IDs with previews (materials, textures… | |||||
Done Inline ActionsThing of objects is that they're being created/copied to a temporary storage during Cycles and Freestyle renderers. There you don't really want extra memory usage. But even in the viewport, you can't reliably copy review. For example, you Shift-D an object which uses world space texture mapping. sergey: Thing of objects is that they're being created/copied to a temporary storage during Cycles and… | |||||
Not Done Inline ActionsOki, then we shall remove that copy from Groups as well I guess? Will do. mont29: Oki, then we shall remove that copy from Groups as well I guess? Will do. | |||||
| return obn; | return obn; | ||||
| } | } | ||||
| /* copy objects, will re-initialize cached simulation data */ | /* copy objects, will re-initialize cached simulation data */ | ||||
| Object *BKE_object_copy(Object *ob) | Object *BKE_object_copy(Object *ob) | ||||
| { | { | ||||
| return BKE_object_copy_ex(G.main, ob, false); | return BKE_object_copy_ex(G.main, ob, false); | ||||
| } | } | ||||
| Show All 20 Lines | static void extern_local_object(Object *ob) | ||||
| id_lib_extern((ID *)ob->gpd); | id_lib_extern((ID *)ob->gpd); | ||||
| extern_local_matarar(ob->mat, ob->totcol); | extern_local_matarar(ob->mat, ob->totcol); | ||||
| for (psys = ob->particlesystem.first; psys; psys = psys->next) | for (psys = ob->particlesystem.first; psys; psys = psys->next) | ||||
| id_lib_extern((ID *)psys->part); | id_lib_extern((ID *)psys->part); | ||||
| modifiers_foreachIDLink(ob, extern_local_object__modifiersForeachIDLink, NULL); | modifiers_foreachIDLink(ob, extern_local_object__modifiersForeachIDLink, NULL); | ||||
| ob->preview = NULL; | |||||
| } | } | ||||
| void BKE_object_make_local(Object *ob) | void BKE_object_make_local(Object *ob) | ||||
| { | { | ||||
| Main *bmain = G.main; | Main *bmain = G.main; | ||||
| Scene *sce; | Scene *sce; | ||||
| Base *base; | Base *base; | ||||
| bool is_local = false, is_lib = false; | bool is_local = false, is_lib = false; | ||||
| ▲ Show 20 Lines • Show All 2,422 Lines • Show Last 20 Lines | |||||
I'm not sure object copy should copy previews. Several areas creates temporary copies of object for which you don't really need previews and don't want time/memory to be wasted.