forked from bartvdbraak/blender
Cleanup/Refactor: pass Main pointer to all ID copy functions.
Also allows us to get rid of a few _copy_ex() versions...
This commit is contained in:
parent
ae2033aca2
commit
87b974caa1
@ -58,7 +58,7 @@ extern "C" {
|
|||||||
struct bAction *add_empty_action(struct Main *bmain, const char name[]);
|
struct bAction *add_empty_action(struct Main *bmain, const char name[]);
|
||||||
|
|
||||||
/* Allocate a copy of the given Action and all its data */
|
/* Allocate a copy of the given Action and all its data */
|
||||||
struct bAction *BKE_action_copy(struct bAction *src);
|
struct bAction *BKE_action_copy(struct Main *bmain, struct bAction *src);
|
||||||
|
|
||||||
/* Deallocate all of the Action's data, but not the Action itself */
|
/* Deallocate all of the Action's data, but not the Action itself */
|
||||||
void BKE_action_free(struct bAction *act);
|
void BKE_action_free(struct bAction *act);
|
||||||
|
@ -77,7 +77,7 @@ int BKE_armature_bonelist_count(struct ListBase *lb);
|
|||||||
void BKE_armature_bonelist_free(struct ListBase *lb);
|
void BKE_armature_bonelist_free(struct ListBase *lb);
|
||||||
void BKE_armature_free(struct bArmature *arm);
|
void BKE_armature_free(struct bArmature *arm);
|
||||||
void BKE_armature_make_local(struct bArmature *arm);
|
void BKE_armature_make_local(struct bArmature *arm);
|
||||||
struct bArmature *BKE_armature_copy(struct bArmature *arm);
|
struct bArmature *BKE_armature_copy(struct Main *bmain, struct bArmature *arm);
|
||||||
|
|
||||||
/* Bounding box. */
|
/* Bounding box. */
|
||||||
struct BoundBox *BKE_armature_boundbox_get(struct Object *ob);
|
struct BoundBox *BKE_armature_boundbox_get(struct Object *ob);
|
||||||
|
@ -44,7 +44,7 @@ void BKE_brush_system_exit(void);
|
|||||||
void BKE_brush_init(struct Brush *brush);
|
void BKE_brush_init(struct Brush *brush);
|
||||||
struct Brush *BKE_brush_add(struct Main *bmain, const char *name, short ob_mode);
|
struct Brush *BKE_brush_add(struct Main *bmain, const char *name, short ob_mode);
|
||||||
struct Brush *BKE_brush_first_search(struct Main *bmain, short ob_mode);
|
struct Brush *BKE_brush_first_search(struct Main *bmain, short ob_mode);
|
||||||
struct Brush *BKE_brush_copy(struct Brush *brush);
|
struct Brush *BKE_brush_copy(struct Main *bmain, struct Brush *brush);
|
||||||
void BKE_brush_make_local(struct Brush *brush);
|
void BKE_brush_make_local(struct Brush *brush);
|
||||||
void BKE_brush_unlink(struct Main *bmain, struct Brush *brush);
|
void BKE_brush_unlink(struct Main *bmain, struct Brush *brush);
|
||||||
void BKE_brush_free(struct Brush *brush);
|
void BKE_brush_free(struct Brush *brush);
|
||||||
|
@ -52,7 +52,7 @@ struct GPUFXSettings;
|
|||||||
|
|
||||||
void BKE_camera_init(struct Camera *cam);
|
void BKE_camera_init(struct Camera *cam);
|
||||||
void *BKE_camera_add(struct Main *bmain, const char *name);
|
void *BKE_camera_add(struct Main *bmain, const char *name);
|
||||||
struct Camera *BKE_camera_copy(struct Camera *cam);
|
struct Camera *BKE_camera_copy(struct Main *bmain, struct Camera *cam);
|
||||||
void BKE_camera_make_local(struct Camera *cam);
|
void BKE_camera_make_local(struct Camera *cam);
|
||||||
void BKE_camera_free(struct Camera *ca);
|
void BKE_camera_free(struct Camera *ca);
|
||||||
|
|
||||||
|
@ -70,8 +70,7 @@ void BKE_curve_free(struct Curve *cu);
|
|||||||
void BKE_curve_editfont_free(struct Curve *cu);
|
void BKE_curve_editfont_free(struct Curve *cu);
|
||||||
void BKE_curve_init(struct Curve *cu);
|
void BKE_curve_init(struct Curve *cu);
|
||||||
struct Curve *BKE_curve_add(struct Main *bmain, const char *name, int type);
|
struct Curve *BKE_curve_add(struct Main *bmain, const char *name, int type);
|
||||||
struct Curve *BKE_curve_copy(struct Curve *cu);
|
struct Curve *BKE_curve_copy(struct Main *bmain, struct Curve *cu);
|
||||||
struct Curve *BKE_curve_copy_ex(struct Main *bmain, struct Curve *cu);
|
|
||||||
void BKE_curve_make_local(struct Main *bmain, struct Curve *cu);
|
void BKE_curve_make_local(struct Main *bmain, struct Curve *cu);
|
||||||
short BKE_curve_type_get(struct Curve *cu);
|
short BKE_curve_type_get(struct Curve *cu);
|
||||||
void BKE_curve_type_test(struct Object *ob);
|
void BKE_curve_type_test(struct Object *ob);
|
||||||
|
@ -36,6 +36,7 @@ struct bGPdata;
|
|||||||
struct bGPDlayer;
|
struct bGPDlayer;
|
||||||
struct bGPDframe;
|
struct bGPDframe;
|
||||||
struct bGPDstroke;
|
struct bGPDstroke;
|
||||||
|
struct Main;
|
||||||
|
|
||||||
/* ------------ Grease-Pencil API ------------------ */
|
/* ------------ Grease-Pencil API ------------------ */
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ struct bGPdata *gpencil_data_addnew(const char name[]);
|
|||||||
|
|
||||||
struct bGPDframe *gpencil_frame_duplicate(struct bGPDframe *src);
|
struct bGPDframe *gpencil_frame_duplicate(struct bGPDframe *src);
|
||||||
struct bGPDlayer *gpencil_layer_duplicate(struct bGPDlayer *src);
|
struct bGPDlayer *gpencil_layer_duplicate(struct bGPDlayer *src);
|
||||||
struct bGPdata *gpencil_data_duplicate(struct bGPdata *gpd, bool internal_copy);
|
struct bGPdata *gpencil_data_duplicate(struct Main *bmain, struct bGPdata *gpd, bool internal_copy);
|
||||||
|
|
||||||
void gpencil_frame_delete_laststroke(struct bGPDlayer *gpl, struct bGPDframe *gpf);
|
void gpencil_frame_delete_laststroke(struct bGPDlayer *gpl, struct bGPDframe *gpf);
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ struct Scene;
|
|||||||
|
|
||||||
void BKE_group_free(struct Group *group);
|
void BKE_group_free(struct Group *group);
|
||||||
struct Group *BKE_group_add(struct Main *bmain, const char *name);
|
struct Group *BKE_group_add(struct Main *bmain, const char *name);
|
||||||
struct Group *BKE_group_copy(struct Group *group);
|
struct Group *BKE_group_copy(struct Main *bmain, struct Group *group);
|
||||||
bool BKE_group_object_add(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
|
bool BKE_group_object_add(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
|
||||||
bool BKE_group_object_unlink(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
|
bool BKE_group_object_unlink(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
|
||||||
struct Group *BKE_group_object_find(struct Group *group, struct Object *ob);
|
struct Group *BKE_group_object_find(struct Group *group, struct Object *ob);
|
||||||
|
@ -51,8 +51,7 @@ extern "C" {
|
|||||||
void BKE_key_free(struct Key *sc);
|
void BKE_key_free(struct Key *sc);
|
||||||
void BKE_key_free_nolib(struct Key *key);
|
void BKE_key_free_nolib(struct Key *key);
|
||||||
struct Key *BKE_key_add(struct ID *id);
|
struct Key *BKE_key_add(struct ID *id);
|
||||||
struct Key *BKE_key_copy(struct Key *key);
|
struct Key *BKE_key_copy(struct Main *bmain, struct Key *key);
|
||||||
struct Key *BKE_key_copy_ex(struct Main *bmain, struct Key *key);
|
|
||||||
struct Key *BKE_key_copy_nolib(struct Key *key);
|
struct Key *BKE_key_copy_nolib(struct Key *key);
|
||||||
void BKE_key_make_local(struct Main *bmain, struct Key *key);
|
void BKE_key_make_local(struct Main *bmain, struct Key *key);
|
||||||
void BKE_key_sort(struct Key *key);
|
void BKE_key_sort(struct Key *key);
|
||||||
|
@ -44,7 +44,7 @@ struct Scene;
|
|||||||
|
|
||||||
void BKE_lamp_init(struct Lamp *la);
|
void BKE_lamp_init(struct Lamp *la);
|
||||||
struct Lamp *BKE_lamp_add(struct Main *bmain, const char *name) ATTR_WARN_UNUSED_RESULT;
|
struct Lamp *BKE_lamp_add(struct Main *bmain, const char *name) ATTR_WARN_UNUSED_RESULT;
|
||||||
struct Lamp *BKE_lamp_copy(struct Lamp *la) ATTR_WARN_UNUSED_RESULT;
|
struct Lamp *BKE_lamp_copy(struct Main *bmain, struct Lamp *la) ATTR_WARN_UNUSED_RESULT;
|
||||||
struct Lamp *localize_lamp(struct Lamp *la) ATTR_WARN_UNUSED_RESULT;
|
struct Lamp *localize_lamp(struct Lamp *la) ATTR_WARN_UNUSED_RESULT;
|
||||||
void BKE_lamp_make_local(struct Lamp *la);
|
void BKE_lamp_make_local(struct Lamp *la);
|
||||||
void BKE_lamp_free(struct Lamp *la);
|
void BKE_lamp_free(struct Lamp *la);
|
||||||
|
@ -47,8 +47,7 @@ struct MDeformVert;
|
|||||||
void BKE_lattice_resize(struct Lattice *lt, int u, int v, int w, struct Object *ltOb);
|
void BKE_lattice_resize(struct Lattice *lt, int u, int v, int w, struct Object *ltOb);
|
||||||
void BKE_lattice_init(struct Lattice *lt);
|
void BKE_lattice_init(struct Lattice *lt);
|
||||||
struct Lattice *BKE_lattice_add(struct Main *bmain, const char *name);
|
struct Lattice *BKE_lattice_add(struct Main *bmain, const char *name);
|
||||||
struct Lattice *BKE_lattice_copy(struct Lattice *lt);
|
struct Lattice *BKE_lattice_copy(struct Main *bmain, struct Lattice *lt);
|
||||||
struct Lattice *BKE_lattice_copy_ex(struct Main *bmain, struct Lattice *lt);
|
|
||||||
void BKE_lattice_free(struct Lattice *lt);
|
void BKE_lattice_free(struct Lattice *lt);
|
||||||
void BKE_lattice_make_local(struct Main *bmain, struct Lattice *lt);
|
void BKE_lattice_make_local(struct Main *bmain, struct Lattice *lt);
|
||||||
void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du);
|
void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du);
|
||||||
|
@ -52,9 +52,8 @@ struct PropertyRNA;
|
|||||||
void *BKE_libblock_alloc_notest(short type);
|
void *BKE_libblock_alloc_notest(short type);
|
||||||
void *BKE_libblock_alloc(struct Main *bmain, short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
void *BKE_libblock_alloc(struct Main *bmain, short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||||
void BKE_libblock_init_empty(struct ID *id);
|
void BKE_libblock_init_empty(struct ID *id);
|
||||||
void *BKE_libblock_copy_ex(struct Main *bmain, struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
void *BKE_libblock_copy(struct Main *bmain, struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||||
void *BKE_libblock_copy_nolib(struct ID *id, const bool do_action) ATTR_NONNULL();
|
void *BKE_libblock_copy_nolib(struct ID *id, const bool do_action) ATTR_NONNULL();
|
||||||
void *BKE_libblock_copy(struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
|
||||||
void BKE_libblock_copy_data(struct ID *id, const struct ID *id_from, const bool do_action);
|
void BKE_libblock_copy_data(struct ID *id, const struct ID *id_from, const bool do_action);
|
||||||
void BKE_libblock_relink(struct ID *id);
|
void BKE_libblock_relink(struct ID *id);
|
||||||
void BKE_libblock_rename(struct Main *bmain, struct ID *id, const char *name) ATTR_NONNULL();
|
void BKE_libblock_rename(struct Main *bmain, struct ID *id, const char *name) ATTR_NONNULL();
|
||||||
@ -83,7 +82,7 @@ void id_fake_user_clear(struct ID *id);
|
|||||||
|
|
||||||
bool id_make_local(struct Main *bmain, struct ID *id, bool test);
|
bool id_make_local(struct Main *bmain, struct ID *id, bool test);
|
||||||
bool id_single_user(struct bContext *C, struct ID *id, struct PointerRNA *ptr, struct PropertyRNA *prop);
|
bool id_single_user(struct bContext *C, struct ID *id, struct PointerRNA *ptr, struct PropertyRNA *prop);
|
||||||
bool id_copy(struct ID *id, struct ID **newid, bool test);
|
bool id_copy(struct Main *bmain, struct ID *id, struct ID **newid, bool test);
|
||||||
void id_sort_by_name(struct ListBase *lb, struct ID *id);
|
void id_sort_by_name(struct ListBase *lb, struct ID *id);
|
||||||
|
|
||||||
bool new_id(struct ListBase *lb, struct ID *id, const char *name);
|
bool new_id(struct ListBase *lb, struct ID *id, const char *name);
|
||||||
|
@ -123,7 +123,7 @@ void BKE_mask_point_select_set_handle(struct MaskSplinePoint *point, const eMask
|
|||||||
/* general */
|
/* general */
|
||||||
struct Mask *BKE_mask_new(struct Main *bmain, const char *name);
|
struct Mask *BKE_mask_new(struct Main *bmain, const char *name);
|
||||||
struct Mask *BKE_mask_copy_nolib(struct Mask *mask);
|
struct Mask *BKE_mask_copy_nolib(struct Mask *mask);
|
||||||
struct Mask *BKE_mask_copy(struct Mask *mask);
|
struct Mask *BKE_mask_copy(struct Main *bmain, struct Mask *mask);
|
||||||
|
|
||||||
void BKE_mask_free(struct Mask *mask);
|
void BKE_mask_free(struct Mask *mask);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ void BKE_material_init(struct Material *ma);
|
|||||||
void BKE_material_remap_object(struct Object *ob, const unsigned int *remap);
|
void BKE_material_remap_object(struct Object *ob, const unsigned int *remap);
|
||||||
void BKE_material_remap_object_calc(struct Object *ob_dst, struct Object *ob_src, short *remap_src_to_dst);
|
void BKE_material_remap_object_calc(struct Object *ob_dst, struct Object *ob_src, short *remap_src_to_dst);
|
||||||
struct Material *BKE_material_add(struct Main *bmain, const char *name);
|
struct Material *BKE_material_add(struct Main *bmain, const char *name);
|
||||||
struct Material *BKE_material_copy(struct Material *ma);
|
struct Material *BKE_material_copy(struct Main *bmain, struct Material *ma);
|
||||||
struct Material *localize_material(struct Material *ma);
|
struct Material *localize_material(struct Material *ma);
|
||||||
struct Material *give_node_material(struct Material *ma); /* returns node material or self */
|
struct Material *give_node_material(struct Material *ma); /* returns node material or self */
|
||||||
void BKE_material_make_local(struct Material *ma);
|
void BKE_material_make_local(struct Material *ma);
|
||||||
|
@ -41,8 +41,7 @@ struct MetaElem;
|
|||||||
void BKE_mball_free(struct MetaBall *mb);
|
void BKE_mball_free(struct MetaBall *mb);
|
||||||
void BKE_mball_init(struct MetaBall *mb);
|
void BKE_mball_init(struct MetaBall *mb);
|
||||||
struct MetaBall *BKE_mball_add(struct Main *bmain, const char *name);
|
struct MetaBall *BKE_mball_add(struct Main *bmain, const char *name);
|
||||||
struct MetaBall *BKE_mball_copy(struct MetaBall *mb);
|
struct MetaBall *BKE_mball_copy(struct Main *bmain, struct MetaBall *mb);
|
||||||
struct MetaBall *BKE_mball_copy_ex(struct Main *bmain, struct MetaBall *mb);
|
|
||||||
|
|
||||||
void BKE_mball_make_local(struct Main *bmain, struct MetaBall *mb);
|
void BKE_mball_make_local(struct Main *bmain, struct MetaBall *mb);
|
||||||
|
|
||||||
|
@ -87,8 +87,7 @@ int BKE_mesh_edge_other_vert(const struct MEdge *e, int v);
|
|||||||
void BKE_mesh_free(struct Mesh *me);
|
void BKE_mesh_free(struct Mesh *me);
|
||||||
void BKE_mesh_init(struct Mesh *me);
|
void BKE_mesh_init(struct Mesh *me);
|
||||||
struct Mesh *BKE_mesh_add(struct Main *bmain, const char *name);
|
struct Mesh *BKE_mesh_add(struct Main *bmain, const char *name);
|
||||||
struct Mesh *BKE_mesh_copy_ex(struct Main *bmain, struct Mesh *me);
|
struct Mesh *BKE_mesh_copy(struct Main *bmain, struct Mesh *me);
|
||||||
struct Mesh *BKE_mesh_copy(struct Mesh *me);
|
|
||||||
void BKE_mesh_update_customdata_pointers(struct Mesh *me, const bool do_ensure_tess_cd);
|
void BKE_mesh_update_customdata_pointers(struct Mesh *me, const bool do_ensure_tess_cd);
|
||||||
void BKE_mesh_ensure_skin_customdata(struct Mesh *me);
|
void BKE_mesh_ensure_skin_customdata(struct Mesh *me);
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, const char
|
|||||||
/* copy/free funcs, need to manage ID users */
|
/* copy/free funcs, need to manage ID users */
|
||||||
void ntreeFreeTree(struct bNodeTree *ntree);
|
void ntreeFreeTree(struct bNodeTree *ntree);
|
||||||
struct bNodeTree *ntreeCopyTree_ex(struct bNodeTree *ntree, struct Main *bmain, const bool do_id_user);
|
struct bNodeTree *ntreeCopyTree_ex(struct bNodeTree *ntree, struct Main *bmain, const bool do_id_user);
|
||||||
struct bNodeTree *ntreeCopyTree(struct bNodeTree *ntree);
|
struct bNodeTree *ntreeCopyTree(struct Main *bmain, struct bNodeTree *ntree);
|
||||||
void ntreeSwitchID_ex(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sce_to, const bool do_id_user);
|
void ntreeSwitchID_ex(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sce_to, const bool do_id_user);
|
||||||
void ntreeSwitchID(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sce_to);
|
void ntreeSwitchID(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sce_to);
|
||||||
/* node->id user count */
|
/* node->id user count */
|
||||||
|
@ -106,7 +106,7 @@ struct Object *BKE_object_lod_meshob_get(struct Object *ob, struct Scene *scene)
|
|||||||
struct Object *BKE_object_lod_matob_get(struct Object *ob, struct Scene *scene);
|
struct Object *BKE_object_lod_matob_get(struct Object *ob, struct Scene *scene);
|
||||||
|
|
||||||
struct Object *BKE_object_copy_ex(struct Main *bmain, struct Object *ob, bool copy_caches);
|
struct Object *BKE_object_copy_ex(struct Main *bmain, struct Object *ob, bool copy_caches);
|
||||||
struct Object *BKE_object_copy(struct Object *ob);
|
struct Object *BKE_object_copy(struct Main *bmain, struct Object *ob);
|
||||||
void BKE_object_make_local(struct Main *bmain, struct Object *ob);
|
void BKE_object_make_local(struct Main *bmain, struct Object *ob);
|
||||||
bool BKE_object_is_libdata(struct Object *ob);
|
bool BKE_object_is_libdata(struct Object *ob);
|
||||||
bool BKE_object_obdata_is_libdata(struct Object *ob);
|
bool BKE_object_obdata_is_libdata(struct Object *ob);
|
||||||
|
@ -323,7 +323,7 @@ struct ParticleSystemModifierData *psys_get_modifier(struct Object *ob, struct P
|
|||||||
struct ModifierData *object_add_particle_system(struct Scene *scene, struct Object *ob, const char *name);
|
struct ModifierData *object_add_particle_system(struct Scene *scene, struct Object *ob, const char *name);
|
||||||
void object_remove_particle_system(struct Scene *scene, struct Object *ob);
|
void object_remove_particle_system(struct Scene *scene, struct Object *ob);
|
||||||
struct ParticleSettings *psys_new_settings(const char *name, struct Main *main);
|
struct ParticleSettings *psys_new_settings(const char *name, struct Main *main);
|
||||||
struct ParticleSettings *BKE_particlesettings_copy(struct ParticleSettings *part);
|
struct ParticleSettings *BKE_particlesettings_copy(struct Main *bmain, struct ParticleSettings *part);
|
||||||
void BKE_particlesettings_make_local(struct ParticleSettings *part);
|
void BKE_particlesettings_make_local(struct ParticleSettings *part);
|
||||||
|
|
||||||
void psys_reset(struct ParticleSystem *psys, int mode);
|
void psys_reset(struct ParticleSystem *psys, int mode);
|
||||||
|
@ -98,7 +98,7 @@ void BKE_scene_base_flag_from_objects(struct Scene *scene);
|
|||||||
void BKE_scene_set_background(struct Main *bmain, struct Scene *sce);
|
void BKE_scene_set_background(struct Main *bmain, struct Scene *sce);
|
||||||
struct Scene *BKE_scene_set_name(struct Main *bmain, const char *name);
|
struct Scene *BKE_scene_set_name(struct Main *bmain, const char *name);
|
||||||
|
|
||||||
struct Scene *BKE_scene_copy(struct Scene *sce, int type);
|
struct Scene *BKE_scene_copy(struct Main *bmain, struct Scene *sce, int type);
|
||||||
void BKE_scene_groups_relink(struct Scene *sce);
|
void BKE_scene_groups_relink(struct Scene *sce);
|
||||||
|
|
||||||
struct Object *BKE_scene_camera_find(struct Scene *sc);
|
struct Object *BKE_scene_camera_find(struct Scene *sc);
|
||||||
|
@ -33,7 +33,7 @@ struct Speaker;
|
|||||||
|
|
||||||
void BKE_speaker_init(struct Speaker *spk);
|
void BKE_speaker_init(struct Speaker *spk);
|
||||||
void *BKE_speaker_add(struct Main *bmain, const char *name);
|
void *BKE_speaker_add(struct Main *bmain, const char *name);
|
||||||
struct Speaker *BKE_speaker_copy(struct Speaker *spk);
|
struct Speaker *BKE_speaker_copy(struct Main *bmain, struct Speaker *spk);
|
||||||
void BKE_speaker_make_local(struct Speaker *spk);
|
void BKE_speaker_make_local(struct Speaker *spk);
|
||||||
void BKE_speaker_free(struct Speaker *spk);
|
void BKE_speaker_free(struct Speaker *spk);
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ void colorband_update_sort(struct ColorBand *coba);
|
|||||||
|
|
||||||
void BKE_texture_free(struct Tex *tex);
|
void BKE_texture_free(struct Tex *tex);
|
||||||
void BKE_texture_default(struct Tex *tex);
|
void BKE_texture_default(struct Tex *tex);
|
||||||
struct Tex *BKE_texture_copy(struct Tex *tex);
|
struct Tex *BKE_texture_copy(struct Main *bmain, struct Tex *tex);
|
||||||
struct Tex *BKE_texture_add(struct Main *bmain, const char *name);
|
struct Tex *BKE_texture_add(struct Main *bmain, const char *name);
|
||||||
struct Tex *BKE_texture_localize(struct Tex *tex);
|
struct Tex *BKE_texture_localize(struct Tex *tex);
|
||||||
void BKE_texture_make_local(struct Tex *tex);
|
void BKE_texture_make_local(struct Tex *tex);
|
||||||
|
@ -39,7 +39,7 @@ struct World;
|
|||||||
void BKE_world_free(struct World *sc);
|
void BKE_world_free(struct World *sc);
|
||||||
void BKE_world_init(struct World *wrld);
|
void BKE_world_init(struct World *wrld);
|
||||||
struct World *add_world(struct Main *bmian, const char *name);
|
struct World *add_world(struct Main *bmian, const char *name);
|
||||||
struct World *BKE_world_copy(struct World *wrld);
|
struct World *BKE_world_copy(struct Main *bmain, struct World *wrld);
|
||||||
struct World *localize_world(struct World *wrld);
|
struct World *localize_world(struct World *wrld);
|
||||||
void BKE_world_make_local(struct World *wrld);
|
void BKE_world_make_local(struct World *wrld);
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ void BKE_action_make_local(bAction *act)
|
|||||||
id_clear_lib_data(bmain, &act->id);
|
id_clear_lib_data(bmain, &act->id);
|
||||||
}
|
}
|
||||||
else if (mlac.is_local && mlac.is_lib) {
|
else if (mlac.is_local && mlac.is_lib) {
|
||||||
mlac.act_new = BKE_action_copy(act);
|
mlac.act_new = BKE_action_copy(bmain, act);
|
||||||
mlac.act_new->id.us = 0;
|
mlac.act_new->id.us = 0;
|
||||||
|
|
||||||
BKE_id_lib_local_paths(bmain, act->id.lib, &mlac.act_new->id);
|
BKE_id_lib_local_paths(bmain, act->id.lib, &mlac.act_new->id);
|
||||||
@ -176,7 +176,7 @@ void BKE_action_free(bAction *act)
|
|||||||
|
|
||||||
/* .................................. */
|
/* .................................. */
|
||||||
|
|
||||||
bAction *BKE_action_copy(bAction *src)
|
bAction *BKE_action_copy(Main *bmain, bAction *src)
|
||||||
{
|
{
|
||||||
bAction *dst = NULL;
|
bAction *dst = NULL;
|
||||||
bActionGroup *dgrp, *sgrp;
|
bActionGroup *dgrp, *sgrp;
|
||||||
@ -184,7 +184,7 @@ bAction *BKE_action_copy(bAction *src)
|
|||||||
|
|
||||||
if (src == NULL)
|
if (src == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
dst = BKE_libblock_copy(&src->id);
|
dst = BKE_libblock_copy(bmain, &src->id);
|
||||||
|
|
||||||
/* duplicate the lists of groups and markers */
|
/* duplicate the lists of groups and markers */
|
||||||
BLI_duplicatelist(&dst->groups, &src->groups);
|
BLI_duplicatelist(&dst->groups, &src->groups);
|
||||||
@ -214,7 +214,7 @@ bAction *BKE_action_copy(bAction *src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ID_IS_LINKED_DATABLOCK(src)) {
|
if (ID_IS_LINKED_DATABLOCK(src)) {
|
||||||
BKE_id_lib_local_paths(G.main, src->id.lib, &dst->id);
|
BKE_id_lib_local_paths(bmain, src->id.lib, &dst->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dst;
|
return dst;
|
||||||
|
@ -268,8 +268,8 @@ AnimData *BKE_animdata_copy(AnimData *adt, const bool do_action)
|
|||||||
|
|
||||||
/* make a copy of action - at worst, user has to delete copies... */
|
/* make a copy of action - at worst, user has to delete copies... */
|
||||||
if (do_action) {
|
if (do_action) {
|
||||||
dadt->action = BKE_action_copy(adt->action);
|
dadt->action = BKE_action_copy(G.main, adt->action);
|
||||||
dadt->tmpact = BKE_action_copy(adt->tmpact);
|
dadt->tmpact = BKE_action_copy(G.main, adt->tmpact);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
id_us_plus((ID *)dadt->action);
|
id_us_plus((ID *)dadt->action);
|
||||||
@ -313,11 +313,11 @@ void BKE_animdata_copy_id_action(ID *id)
|
|||||||
if (adt) {
|
if (adt) {
|
||||||
if (adt->action) {
|
if (adt->action) {
|
||||||
id_us_min((ID *)adt->action);
|
id_us_min((ID *)adt->action);
|
||||||
adt->action = BKE_action_copy(adt->action);
|
adt->action = BKE_action_copy(G.main, adt->action);
|
||||||
}
|
}
|
||||||
if (adt->tmpact) {
|
if (adt->tmpact) {
|
||||||
id_us_min((ID *)adt->tmpact);
|
id_us_min((ID *)adt->tmpact);
|
||||||
adt->tmpact = BKE_action_copy(adt->tmpact);
|
adt->tmpact = BKE_action_copy(G.main, adt->tmpact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -341,8 +341,8 @@ void BKE_animdata_merge_copy(ID *dst_id, ID *src_id, eAnimData_MergeCopy_Modes a
|
|||||||
/* handle actions... */
|
/* handle actions... */
|
||||||
if (action_mode == ADT_MERGECOPY_SRC_COPY) {
|
if (action_mode == ADT_MERGECOPY_SRC_COPY) {
|
||||||
/* make a copy of the actions */
|
/* make a copy of the actions */
|
||||||
dst->action = BKE_action_copy(src->action);
|
dst->action = BKE_action_copy(G.main, src->action);
|
||||||
dst->tmpact = BKE_action_copy(src->tmpact);
|
dst->tmpact = BKE_action_copy(G.main, src->tmpact);
|
||||||
}
|
}
|
||||||
else if (action_mode == ADT_MERGECOPY_SRC_REF) {
|
else if (action_mode == ADT_MERGECOPY_SRC_REF) {
|
||||||
/* make a reference to it */
|
/* make a reference to it */
|
||||||
|
@ -168,7 +168,7 @@ void BKE_armature_make_local(bArmature *arm)
|
|||||||
id_clear_lib_data(bmain, &arm->id);
|
id_clear_lib_data(bmain, &arm->id);
|
||||||
}
|
}
|
||||||
else if (is_local && is_lib) {
|
else if (is_local && is_lib) {
|
||||||
bArmature *arm_new = BKE_armature_copy(arm);
|
bArmature *arm_new = BKE_armature_copy(bmain, arm);
|
||||||
arm_new->id.us = 0;
|
arm_new->id.us = 0;
|
||||||
|
|
||||||
/* Remap paths of new ID using old library as base. */
|
/* Remap paths of new ID using old library as base. */
|
||||||
@ -208,13 +208,13 @@ static void copy_bonechildren(Bone *newBone, Bone *oldBone, Bone *actBone, Bone
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bArmature *BKE_armature_copy(bArmature *arm)
|
bArmature *BKE_armature_copy(Main *bmain, bArmature *arm)
|
||||||
{
|
{
|
||||||
bArmature *newArm;
|
bArmature *newArm;
|
||||||
Bone *oldBone, *newBone;
|
Bone *oldBone, *newBone;
|
||||||
Bone *newActBone = NULL;
|
Bone *newActBone = NULL;
|
||||||
|
|
||||||
newArm = BKE_libblock_copy(&arm->id);
|
newArm = BKE_libblock_copy(bmain, &arm->id);
|
||||||
BLI_duplicatelist(&newArm->bonebase, &arm->bonebase);
|
BLI_duplicatelist(&newArm->bonebase, &arm->bonebase);
|
||||||
|
|
||||||
/* Duplicate the childrens' lists */
|
/* Duplicate the childrens' lists */
|
||||||
@ -232,7 +232,7 @@ bArmature *BKE_armature_copy(bArmature *arm)
|
|||||||
newArm->sketch = NULL;
|
newArm->sketch = NULL;
|
||||||
|
|
||||||
if (ID_IS_LINKED_DATABLOCK(arm)) {
|
if (ID_IS_LINKED_DATABLOCK(arm)) {
|
||||||
BKE_id_lib_local_paths(G.main, arm->id.lib, &newArm->id);
|
BKE_id_lib_local_paths(bmain, arm->id.lib, &newArm->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return newArm;
|
return newArm;
|
||||||
|
@ -170,11 +170,11 @@ struct Brush *BKE_brush_first_search(struct Main *bmain, short ob_mode)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Brush *BKE_brush_copy(Brush *brush)
|
Brush *BKE_brush_copy(Main *bmain, Brush *brush)
|
||||||
{
|
{
|
||||||
Brush *brushn;
|
Brush *brushn;
|
||||||
|
|
||||||
brushn = BKE_libblock_copy(&brush->id);
|
brushn = BKE_libblock_copy(bmain, &brush->id);
|
||||||
|
|
||||||
if (brush->mtex.tex)
|
if (brush->mtex.tex)
|
||||||
id_us_plus((ID *)brush->mtex.tex);
|
id_us_plus((ID *)brush->mtex.tex);
|
||||||
@ -196,7 +196,7 @@ Brush *BKE_brush_copy(Brush *brush)
|
|||||||
id_fake_user_set(&brush->id);
|
id_fake_user_set(&brush->id);
|
||||||
|
|
||||||
if (ID_IS_LINKED_DATABLOCK(brush)) {
|
if (ID_IS_LINKED_DATABLOCK(brush)) {
|
||||||
BKE_id_lib_local_paths(G.main, brush->id.lib, &brushn->id);
|
BKE_id_lib_local_paths(bmain, brush->id.lib, &brushn->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return brushn;
|
return brushn;
|
||||||
@ -261,7 +261,7 @@ void BKE_brush_make_local(Brush *brush)
|
|||||||
id_fake_user_set(&brush->id);
|
id_fake_user_set(&brush->id);
|
||||||
}
|
}
|
||||||
else if (is_local && is_lib) {
|
else if (is_local && is_lib) {
|
||||||
Brush *brush_new = BKE_brush_copy(brush); /* Ensures FAKE_USER is set */
|
Brush *brush_new = BKE_brush_copy(bmain, brush); /* Ensures FAKE_USER is set */
|
||||||
id_us_min(&brush_new->id); /* Remove user added by standard BKE_libblock_copy(). */
|
id_us_min(&brush_new->id); /* Remove user added by standard BKE_libblock_copy(). */
|
||||||
|
|
||||||
/* Remap paths of new ID using old library as base. */
|
/* Remap paths of new ID using old library as base. */
|
||||||
@ -469,6 +469,7 @@ void BKE_brush_curve_preset(Brush *b, int preset)
|
|||||||
curvemapping_changed(b->curve, false);
|
curvemapping_changed(b->curve, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* XXX Unused function. */
|
||||||
int BKE_brush_texture_set_nr(Brush *brush, int nr)
|
int BKE_brush_texture_set_nr(Brush *brush, int nr)
|
||||||
{
|
{
|
||||||
ID *idtest, *id = NULL;
|
ID *idtest, *id = NULL;
|
||||||
@ -477,7 +478,7 @@ int BKE_brush_texture_set_nr(Brush *brush, int nr)
|
|||||||
|
|
||||||
idtest = (ID *)BLI_findlink(&G.main->tex, nr - 1);
|
idtest = (ID *)BLI_findlink(&G.main->tex, nr - 1);
|
||||||
if (idtest == NULL) { /* new tex */
|
if (idtest == NULL) { /* new tex */
|
||||||
if (id) idtest = (ID *)BKE_texture_copy((Tex *)id);
|
if (id) idtest = (ID *)BKE_texture_copy(G.main, (Tex *)id);
|
||||||
else idtest = (ID *)BKE_texture_add(G.main, "Tex");
|
else idtest = (ID *)BKE_texture_add(G.main, "Tex");
|
||||||
id_us_min(idtest);
|
id_us_min(idtest);
|
||||||
}
|
}
|
||||||
|
@ -91,16 +91,16 @@ void *BKE_camera_add(Main *bmain, const char *name)
|
|||||||
return cam;
|
return cam;
|
||||||
}
|
}
|
||||||
|
|
||||||
Camera *BKE_camera_copy(Camera *cam)
|
Camera *BKE_camera_copy(Main *bmain, Camera *cam)
|
||||||
{
|
{
|
||||||
Camera *camn;
|
Camera *camn;
|
||||||
|
|
||||||
camn = BKE_libblock_copy(&cam->id);
|
camn = BKE_libblock_copy(bmain, &cam->id);
|
||||||
|
|
||||||
id_lib_extern((ID *)camn->dof_ob);
|
id_lib_extern((ID *)camn->dof_ob);
|
||||||
|
|
||||||
if (ID_IS_LINKED_DATABLOCK(cam)) {
|
if (ID_IS_LINKED_DATABLOCK(cam)) {
|
||||||
BKE_id_lib_local_paths(G.main, cam->id.lib, &camn->id);
|
BKE_id_lib_local_paths(bmain, cam->id.lib, &camn->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return camn;
|
return camn;
|
||||||
@ -134,7 +134,7 @@ void BKE_camera_make_local(Camera *cam)
|
|||||||
id_clear_lib_data(bmain, &cam->id);
|
id_clear_lib_data(bmain, &cam->id);
|
||||||
}
|
}
|
||||||
else if (is_local && is_lib) {
|
else if (is_local && is_lib) {
|
||||||
Camera *cam_new = BKE_camera_copy(cam);
|
Camera *cam_new = BKE_camera_copy(bmain, cam);
|
||||||
|
|
||||||
cam_new->id.us = 0;
|
cam_new->id.us = 0;
|
||||||
|
|
||||||
|
@ -174,12 +174,12 @@ Curve *BKE_curve_add(Main *bmain, const char *name, int type)
|
|||||||
return cu;
|
return cu;
|
||||||
}
|
}
|
||||||
|
|
||||||
Curve *BKE_curve_copy_ex(Main *bmain, Curve *cu)
|
Curve *BKE_curve_copy(Main *bmain, Curve *cu)
|
||||||
{
|
{
|
||||||
Curve *cun;
|
Curve *cun;
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
cun = BKE_libblock_copy_ex(bmain, &cu->id);
|
cun = BKE_libblock_copy(bmain, &cu->id);
|
||||||
|
|
||||||
BLI_listbase_clear(&cun->nurb);
|
BLI_listbase_clear(&cun->nurb);
|
||||||
BKE_nurbList_duplicate(&(cun->nurb), &(cu->nurb));
|
BKE_nurbList_duplicate(&(cun->nurb), &(cu->nurb));
|
||||||
@ -195,7 +195,7 @@ Curve *BKE_curve_copy_ex(Main *bmain, Curve *cu)
|
|||||||
cun->bb = MEM_dupallocN(cu->bb);
|
cun->bb = MEM_dupallocN(cu->bb);
|
||||||
|
|
||||||
if (cu->key) {
|
if (cu->key) {
|
||||||
cun->key = BKE_key_copy_ex(bmain, cu->key);
|
cun->key = BKE_key_copy(bmain, cu->key);
|
||||||
cun->key->from = (ID *)cun;
|
cun->key->from = (ID *)cun;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,11 +219,6 @@ Curve *BKE_curve_copy_ex(Main *bmain, Curve *cu)
|
|||||||
return cun;
|
return cun;
|
||||||
}
|
}
|
||||||
|
|
||||||
Curve *BKE_curve_copy(Curve *cu)
|
|
||||||
{
|
|
||||||
return BKE_curve_copy_ex(G.main, cu);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int extern_local_curve_callback(
|
static int extern_local_curve_callback(
|
||||||
void *UNUSED(user_data), struct ID *UNUSED(id_self), struct ID **id_pointer, int cd_flag)
|
void *UNUSED(user_data), struct ID *UNUSED(id_self), struct ID **id_pointer, int cd_flag)
|
||||||
{
|
{
|
||||||
@ -263,7 +258,7 @@ void BKE_curve_make_local(Main *bmain, Curve *cu)
|
|||||||
extern_local_curve(cu);
|
extern_local_curve(cu);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Curve *cu_new = BKE_curve_copy_ex(bmain, cu);
|
Curve *cu_new = BKE_curve_copy(bmain, cu);
|
||||||
|
|
||||||
cu_new->id.us = 0;
|
cu_new->id.us = 0;
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#include "BKE_global.h"
|
#include "BKE_global.h"
|
||||||
#include "BKE_gpencil.h"
|
#include "BKE_gpencil.h"
|
||||||
#include "BKE_library.h"
|
#include "BKE_library.h"
|
||||||
|
#include "BKE_main.h"
|
||||||
|
|
||||||
|
|
||||||
/* ************************************************** */
|
/* ************************************************** */
|
||||||
@ -358,7 +359,7 @@ bGPDlayer *gpencil_layer_duplicate(bGPDlayer *src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* make a copy of a given gpencil datablock */
|
/* make a copy of a given gpencil datablock */
|
||||||
bGPdata *gpencil_data_duplicate(bGPdata *src, bool internal_copy)
|
bGPdata *gpencil_data_duplicate(Main *bmain, bGPdata *src, bool internal_copy)
|
||||||
{
|
{
|
||||||
bGPDlayer *gpl, *gpld;
|
bGPDlayer *gpl, *gpld;
|
||||||
bGPdata *dst;
|
bGPdata *dst;
|
||||||
@ -374,7 +375,7 @@ bGPdata *gpencil_data_duplicate(bGPdata *src, bool internal_copy)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* make a copy when others use this */
|
/* make a copy when others use this */
|
||||||
dst = BKE_libblock_copy(&src->id);
|
dst = BKE_libblock_copy(bmain, &src->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy layers */
|
/* copy layers */
|
||||||
|
@ -87,18 +87,18 @@ Group *BKE_group_add(Main *bmain, const char *name)
|
|||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
Group *BKE_group_copy(Group *group)
|
Group *BKE_group_copy(Main *bmain, Group *group)
|
||||||
{
|
{
|
||||||
Group *groupn;
|
Group *groupn;
|
||||||
|
|
||||||
groupn = BKE_libblock_copy(&group->id);
|
groupn = BKE_libblock_copy(bmain, &group->id);
|
||||||
BLI_duplicatelist(&groupn->gobject, &group->gobject);
|
BLI_duplicatelist(&groupn->gobject, &group->gobject);
|
||||||
|
|
||||||
/* Do not copy group's preview (same behavior as for objects). */
|
/* Do not copy group's preview (same behavior as for objects). */
|
||||||
groupn->preview = NULL;
|
groupn->preview = NULL;
|
||||||
|
|
||||||
if (ID_IS_LINKED_DATABLOCK(group)) {
|
if (ID_IS_LINKED_DATABLOCK(group)) {
|
||||||
BKE_id_lib_local_paths(G.main, group->id.lib, &groupn->id);
|
BKE_id_lib_local_paths(bmain, group->id.lib, &groupn->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return groupn;
|
return groupn;
|
||||||
|
@ -150,12 +150,12 @@ Key *BKE_key_add(ID *id) /* common function */
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
Key *BKE_key_copy_ex(Main *bmain, Key *key)
|
Key *BKE_key_copy(Main *bmain, Key *key)
|
||||||
{
|
{
|
||||||
Key *keyn;
|
Key *keyn;
|
||||||
KeyBlock *kbn, *kb;
|
KeyBlock *kbn, *kb;
|
||||||
|
|
||||||
keyn = BKE_libblock_copy_ex(bmain, &key->id);
|
keyn = BKE_libblock_copy(bmain, &key->id);
|
||||||
|
|
||||||
BLI_duplicatelist(&keyn->block, &key->block);
|
BLI_duplicatelist(&keyn->block, &key->block);
|
||||||
|
|
||||||
@ -177,11 +177,6 @@ Key *BKE_key_copy_ex(Main *bmain, Key *key)
|
|||||||
return keyn;
|
return keyn;
|
||||||
}
|
}
|
||||||
|
|
||||||
Key *BKE_key_copy(Key *key)
|
|
||||||
{
|
|
||||||
return BKE_key_copy_ex(G.main, key);
|
|
||||||
}
|
|
||||||
|
|
||||||
Key *BKE_key_copy_nolib(Key *key)
|
Key *BKE_key_copy_nolib(Key *key)
|
||||||
{
|
{
|
||||||
Key *keyn;
|
Key *keyn;
|
||||||
|
@ -114,12 +114,12 @@ Lamp *BKE_lamp_add(Main *bmain, const char *name)
|
|||||||
return la;
|
return la;
|
||||||
}
|
}
|
||||||
|
|
||||||
Lamp *BKE_lamp_copy(Lamp *la)
|
Lamp *BKE_lamp_copy(Main *bmain, Lamp *la)
|
||||||
{
|
{
|
||||||
Lamp *lan;
|
Lamp *lan;
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
lan = BKE_libblock_copy(&la->id);
|
lan = BKE_libblock_copy(bmain, &la->id);
|
||||||
|
|
||||||
for (a = 0; a < MAX_MTEX; a++) {
|
for (a = 0; a < MAX_MTEX; a++) {
|
||||||
if (lan->mtex[a]) {
|
if (lan->mtex[a]) {
|
||||||
@ -132,13 +132,13 @@ Lamp *BKE_lamp_copy(Lamp *la)
|
|||||||
lan->curfalloff = curvemapping_copy(la->curfalloff);
|
lan->curfalloff = curvemapping_copy(la->curfalloff);
|
||||||
|
|
||||||
if (la->nodetree)
|
if (la->nodetree)
|
||||||
lan->nodetree = ntreeCopyTree(la->nodetree);
|
lan->nodetree = ntreeCopyTree(bmain, la->nodetree);
|
||||||
|
|
||||||
if (la->preview)
|
if (la->preview)
|
||||||
lan->preview = BKE_previewimg_copy(la->preview);
|
lan->preview = BKE_previewimg_copy(la->preview);
|
||||||
|
|
||||||
if (ID_IS_LINKED_DATABLOCK(la)) {
|
if (ID_IS_LINKED_DATABLOCK(la)) {
|
||||||
BKE_id_lib_local_paths(G.main, la->id.lib, &lan->id);
|
BKE_id_lib_local_paths(bmain, la->id.lib, &lan->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return lan;
|
return lan;
|
||||||
@ -200,7 +200,7 @@ void BKE_lamp_make_local(Lamp *la)
|
|||||||
id_clear_lib_data(bmain, &la->id);
|
id_clear_lib_data(bmain, &la->id);
|
||||||
}
|
}
|
||||||
else if (is_local && is_lib) {
|
else if (is_local && is_lib) {
|
||||||
Lamp *la_new = BKE_lamp_copy(la);
|
Lamp *la_new = BKE_lamp_copy(bmain, la);
|
||||||
la_new->id.us = 0;
|
la_new->id.us = 0;
|
||||||
|
|
||||||
/* Remap paths of new ID using old library as base. */
|
/* Remap paths of new ID using old library as base. */
|
||||||
|
@ -277,15 +277,15 @@ Lattice *BKE_lattice_add(Main *bmain, const char *name)
|
|||||||
return lt;
|
return lt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Lattice *BKE_lattice_copy_ex(Main *bmain, Lattice *lt)
|
Lattice *BKE_lattice_copy(Main *bmain, Lattice *lt)
|
||||||
{
|
{
|
||||||
Lattice *ltn;
|
Lattice *ltn;
|
||||||
|
|
||||||
ltn = BKE_libblock_copy_ex(bmain, <->id);
|
ltn = BKE_libblock_copy(bmain, <->id);
|
||||||
ltn->def = MEM_dupallocN(lt->def);
|
ltn->def = MEM_dupallocN(lt->def);
|
||||||
|
|
||||||
if (lt->key) {
|
if (lt->key) {
|
||||||
ltn->key = BKE_key_copy_ex(bmain, ltn->key);
|
ltn->key = BKE_key_copy(bmain, ltn->key);
|
||||||
ltn->key->from = (ID *)ltn;
|
ltn->key->from = (ID *)ltn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,11 +304,6 @@ Lattice *BKE_lattice_copy_ex(Main *bmain, Lattice *lt)
|
|||||||
return ltn;
|
return ltn;
|
||||||
}
|
}
|
||||||
|
|
||||||
Lattice *BKE_lattice_copy(Lattice *lt)
|
|
||||||
{
|
|
||||||
return BKE_lattice_copy_ex(G.main, lt);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Free (or release) any data used by this lattice (does not free the lattice itself). */
|
/** Free (or release) any data used by this lattice (does not free the lattice itself). */
|
||||||
void BKE_lattice_free(Lattice *lt)
|
void BKE_lattice_free(Lattice *lt)
|
||||||
{
|
{
|
||||||
@ -358,7 +353,7 @@ void BKE_lattice_make_local(Main *bmain, Lattice *lt)
|
|||||||
/* No extern_local_lattice... */
|
/* No extern_local_lattice... */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Lattice *lt_new = BKE_lattice_copy_ex(bmain, lt);
|
Lattice *lt_new = BKE_lattice_copy(bmain, lt);
|
||||||
|
|
||||||
lt_new->id.us = 0;
|
lt_new->id.us = 0;
|
||||||
|
|
||||||
|
@ -344,9 +344,11 @@ bool id_make_local(Main *bmain, ID *id, bool test)
|
|||||||
* Invokes the appropriate copy method for the block and returns the result in
|
* Invokes the appropriate copy method for the block and returns the result in
|
||||||
* newid, unless test. Returns true if the block can be copied.
|
* newid, unless test. Returns true if the block can be copied.
|
||||||
*/
|
*/
|
||||||
bool id_copy(ID *id, ID **newid, bool test)
|
bool id_copy(Main *bmain, ID *id, ID **newid, bool test)
|
||||||
{
|
{
|
||||||
if (!test) *newid = NULL;
|
if (!test) {
|
||||||
|
*newid = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* conventions:
|
/* conventions:
|
||||||
* - make shallow copy, only this ID block
|
* - make shallow copy, only this ID block
|
||||||
@ -357,83 +359,83 @@ bool id_copy(ID *id, ID **newid, bool test)
|
|||||||
case ID_LI:
|
case ID_LI:
|
||||||
return false; /* can't be copied from here */
|
return false; /* can't be copied from here */
|
||||||
case ID_OB:
|
case ID_OB:
|
||||||
if (!test) *newid = (ID *)BKE_object_copy((Object *)id);
|
if (!test) *newid = (ID *)BKE_object_copy(bmain, (Object *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_ME:
|
case ID_ME:
|
||||||
if (!test) *newid = (ID *)BKE_mesh_copy((Mesh *)id);
|
if (!test) *newid = (ID *)BKE_mesh_copy(bmain, (Mesh *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_CU:
|
case ID_CU:
|
||||||
if (!test) *newid = (ID *)BKE_curve_copy((Curve *)id);
|
if (!test) *newid = (ID *)BKE_curve_copy(bmain, (Curve *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_MB:
|
case ID_MB:
|
||||||
if (!test) *newid = (ID *)BKE_mball_copy((MetaBall *)id);
|
if (!test) *newid = (ID *)BKE_mball_copy(bmain, (MetaBall *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_MA:
|
case ID_MA:
|
||||||
if (!test) *newid = (ID *)BKE_material_copy((Material *)id);
|
if (!test) *newid = (ID *)BKE_material_copy(bmain, (Material *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_TE:
|
case ID_TE:
|
||||||
if (!test) *newid = (ID *)BKE_texture_copy((Tex *)id);
|
if (!test) *newid = (ID *)BKE_texture_copy(bmain, (Tex *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_IM:
|
case ID_IM:
|
||||||
if (!test) *newid = (ID *)BKE_image_copy(G.main, (Image *)id);
|
if (!test) *newid = (ID *)BKE_image_copy(bmain, (Image *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_LT:
|
case ID_LT:
|
||||||
if (!test) *newid = (ID *)BKE_lattice_copy((Lattice *)id);
|
if (!test) *newid = (ID *)BKE_lattice_copy(bmain, (Lattice *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_LA:
|
case ID_LA:
|
||||||
if (!test) *newid = (ID *)BKE_lamp_copy((Lamp *)id);
|
if (!test) *newid = (ID *)BKE_lamp_copy(bmain, (Lamp *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_SPK:
|
case ID_SPK:
|
||||||
if (!test) *newid = (ID *)BKE_speaker_copy((Speaker *)id);
|
if (!test) *newid = (ID *)BKE_speaker_copy(bmain, (Speaker *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_CA:
|
case ID_CA:
|
||||||
if (!test) *newid = (ID *)BKE_camera_copy((Camera *)id);
|
if (!test) *newid = (ID *)BKE_camera_copy(bmain, (Camera *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_IP:
|
case ID_IP:
|
||||||
return false; /* deprecated */
|
return false; /* deprecated */
|
||||||
case ID_KE:
|
case ID_KE:
|
||||||
if (!test) *newid = (ID *)BKE_key_copy((Key *)id);
|
if (!test) *newid = (ID *)BKE_key_copy(bmain, (Key *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_WO:
|
case ID_WO:
|
||||||
if (!test) *newid = (ID *)BKE_world_copy((World *)id);
|
if (!test) *newid = (ID *)BKE_world_copy(bmain, (World *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_SCR:
|
case ID_SCR:
|
||||||
return false; /* can't be copied from here */
|
return false; /* can't be copied from here */
|
||||||
case ID_VF:
|
case ID_VF:
|
||||||
return false; /* not implemented */
|
return false; /* not implemented */
|
||||||
case ID_TXT:
|
case ID_TXT:
|
||||||
if (!test) *newid = (ID *)BKE_text_copy(G.main, (Text *)id);
|
if (!test) *newid = (ID *)BKE_text_copy(bmain, (Text *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_SO:
|
case ID_SO:
|
||||||
return false; /* not implemented */
|
return false; /* not implemented */
|
||||||
case ID_GR:
|
case ID_GR:
|
||||||
if (!test) *newid = (ID *)BKE_group_copy((Group *)id);
|
if (!test) *newid = (ID *)BKE_group_copy(bmain, (Group *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_AR:
|
case ID_AR:
|
||||||
if (!test) *newid = (ID *)BKE_armature_copy((bArmature *)id);
|
if (!test) *newid = (ID *)BKE_armature_copy(bmain, (bArmature *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_AC:
|
case ID_AC:
|
||||||
if (!test) *newid = (ID *)BKE_action_copy((bAction *)id);
|
if (!test) *newid = (ID *)BKE_action_copy(bmain, (bAction *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_NT:
|
case ID_NT:
|
||||||
if (!test) *newid = (ID *)ntreeCopyTree((bNodeTree *)id);
|
if (!test) *newid = (ID *)ntreeCopyTree(bmain, (bNodeTree *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_BR:
|
case ID_BR:
|
||||||
if (!test) *newid = (ID *)BKE_brush_copy((Brush *)id);
|
if (!test) *newid = (ID *)BKE_brush_copy(bmain, (Brush *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_PA:
|
case ID_PA:
|
||||||
if (!test) *newid = (ID *)BKE_particlesettings_copy((ParticleSettings *)id);
|
if (!test) *newid = (ID *)BKE_particlesettings_copy(bmain, (ParticleSettings *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_WM:
|
case ID_WM:
|
||||||
return false; /* can't be copied from here */
|
return false; /* can't be copied from here */
|
||||||
case ID_GD:
|
case ID_GD:
|
||||||
if (!test) *newid = (ID *)gpencil_data_duplicate((bGPdata *)id, false);
|
if (!test) *newid = (ID *)gpencil_data_duplicate(bmain, (bGPdata *)id, false);
|
||||||
return true;
|
return true;
|
||||||
case ID_MSK:
|
case ID_MSK:
|
||||||
if (!test) *newid = (ID *)BKE_mask_copy((Mask *)id);
|
if (!test) *newid = (ID *)BKE_mask_copy(bmain, (Mask *)id);
|
||||||
return true;
|
return true;
|
||||||
case ID_LS:
|
case ID_LS:
|
||||||
if (!test) *newid = (ID *)BKE_linestyle_copy(G.main, (FreestyleLineStyle *)id);
|
if (!test) *newid = (ID *)BKE_linestyle_copy(bmain, (FreestyleLineStyle *)id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +450,7 @@ bool id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop)
|
|||||||
if (id) {
|
if (id) {
|
||||||
/* if property isn't editable, we're going to have an extra block hanging around until we save */
|
/* if property isn't editable, we're going to have an extra block hanging around until we save */
|
||||||
if (RNA_property_editable(ptr, prop)) {
|
if (RNA_property_editable(ptr, prop)) {
|
||||||
if (id_copy(id, &newid, false) && newid) {
|
if (id_copy(CTX_data_main(C), id, &newid, false) && newid) {
|
||||||
/* copy animation actions too */
|
/* copy animation actions too */
|
||||||
BKE_animdata_copy_id_action(id);
|
BKE_animdata_copy_id_action(id);
|
||||||
/* us is 1 by convention, but RNA_property_pointer_set
|
/* us is 1 by convention, but RNA_property_pointer_set
|
||||||
@ -976,7 +978,7 @@ void BKE_libblock_copy_data(ID *id, const ID *id_from, const bool do_action)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* used everywhere in blenkernel */
|
/* used everywhere in blenkernel */
|
||||||
void *BKE_libblock_copy_ex(Main *bmain, ID *id)
|
void *BKE_libblock_copy(Main *bmain, ID *id)
|
||||||
{
|
{
|
||||||
ID *idn;
|
ID *idn;
|
||||||
size_t idn_len;
|
size_t idn_len;
|
||||||
@ -1028,11 +1030,6 @@ void *BKE_libblock_copy_nolib(ID *id, const bool do_action)
|
|||||||
return idn;
|
return idn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *BKE_libblock_copy(ID *id)
|
|
||||||
{
|
|
||||||
return BKE_libblock_copy_ex(G.main, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int id_relink_looper(void *UNUSED(user_data), ID *UNUSED(self_id), ID **id_pointer, const int cd_flag)
|
static int id_relink_looper(void *UNUSED(user_data), ID *UNUSED(self_id), ID **id_pointer, const int cd_flag)
|
||||||
{
|
{
|
||||||
ID *id = *id_pointer;
|
ID *id = *id_pointer;
|
||||||
|
@ -171,7 +171,7 @@ FreestyleLineStyle *BKE_linestyle_copy(struct Main *bmain, FreestyleLineStyle *l
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (linestyle->nodetree) {
|
if (linestyle->nodetree) {
|
||||||
new_linestyle->nodetree = ntreeCopyTree(linestyle->nodetree);
|
new_linestyle->nodetree = ntreeCopyTree(bmain, linestyle->nodetree);
|
||||||
}
|
}
|
||||||
|
|
||||||
new_linestyle->r = linestyle->r;
|
new_linestyle->r = linestyle->r;
|
||||||
|
@ -848,11 +848,11 @@ Mask *BKE_mask_copy_nolib(Mask *mask)
|
|||||||
return mask_new;
|
return mask_new;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mask *BKE_mask_copy(Mask *mask)
|
Mask *BKE_mask_copy(Main *bmain, Mask *mask)
|
||||||
{
|
{
|
||||||
Mask *mask_new;
|
Mask *mask_new;
|
||||||
|
|
||||||
mask_new = BKE_libblock_copy(&mask->id);
|
mask_new = BKE_libblock_copy(bmain, &mask->id);
|
||||||
|
|
||||||
BLI_listbase_clear(&mask_new->masklayers);
|
BLI_listbase_clear(&mask_new->masklayers);
|
||||||
|
|
||||||
@ -862,7 +862,7 @@ Mask *BKE_mask_copy(Mask *mask)
|
|||||||
id_fake_user_set(&mask->id);
|
id_fake_user_set(&mask->id);
|
||||||
|
|
||||||
if (ID_IS_LINKED_DATABLOCK(mask)) {
|
if (ID_IS_LINKED_DATABLOCK(mask)) {
|
||||||
BKE_id_lib_local_paths(G.main, mask->id.lib, &mask_new->id);
|
BKE_id_lib_local_paths(bmain, mask->id.lib, &mask_new->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mask_new;
|
return mask_new;
|
||||||
|
@ -217,12 +217,12 @@ Material *BKE_material_add(Main *bmain, const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* XXX keep synced with next function */
|
/* XXX keep synced with next function */
|
||||||
Material *BKE_material_copy(Material *ma)
|
Material *BKE_material_copy(Main *bmain, Material *ma)
|
||||||
{
|
{
|
||||||
Material *man;
|
Material *man;
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
man = BKE_libblock_copy(&ma->id);
|
man = BKE_libblock_copy(bmain, &ma->id);
|
||||||
|
|
||||||
id_lib_extern((ID *)man->group);
|
id_lib_extern((ID *)man->group);
|
||||||
|
|
||||||
@ -240,13 +240,13 @@ Material *BKE_material_copy(Material *ma)
|
|||||||
if (ma->preview) man->preview = BKE_previewimg_copy(ma->preview);
|
if (ma->preview) man->preview = BKE_previewimg_copy(ma->preview);
|
||||||
|
|
||||||
if (ma->nodetree) {
|
if (ma->nodetree) {
|
||||||
man->nodetree = ntreeCopyTree(ma->nodetree);
|
man->nodetree = ntreeCopyTree(bmain, ma->nodetree);
|
||||||
}
|
}
|
||||||
|
|
||||||
BLI_listbase_clear(&man->gpumaterial);
|
BLI_listbase_clear(&man->gpumaterial);
|
||||||
|
|
||||||
if (ID_IS_LINKED_DATABLOCK(ma)) {
|
if (ID_IS_LINKED_DATABLOCK(ma)) {
|
||||||
BKE_id_lib_local_paths(G.main, ma->id.lib, &man->id);
|
BKE_id_lib_local_paths(bmain, ma->id.lib, &man->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return man;
|
return man;
|
||||||
@ -376,7 +376,7 @@ void BKE_material_make_local(Material *ma)
|
|||||||
}
|
}
|
||||||
/* Both user and local, so copy. */
|
/* Both user and local, so copy. */
|
||||||
else if (is_local && is_lib) {
|
else if (is_local && is_lib) {
|
||||||
Material *ma_new = BKE_material_copy(ma);
|
Material *ma_new = BKE_material_copy(bmain, ma);
|
||||||
|
|
||||||
ma_new->id.us = 0;
|
ma_new->id.us = 0;
|
||||||
|
|
||||||
@ -2161,7 +2161,7 @@ static void convert_tfacematerial(Main *main, Material *ma)
|
|||||||
}
|
}
|
||||||
/* create a new material */
|
/* create a new material */
|
||||||
else {
|
else {
|
||||||
mat_new = BKE_material_copy(ma);
|
mat_new = BKE_material_copy(main, ma);
|
||||||
if (mat_new) {
|
if (mat_new) {
|
||||||
/* rename the material*/
|
/* rename the material*/
|
||||||
BLI_strncpy(mat_new->id.name, idname, sizeof(mat_new->id.name));
|
BLI_strncpy(mat_new->id.name, idname, sizeof(mat_new->id.name));
|
||||||
|
@ -102,12 +102,12 @@ MetaBall *BKE_mball_add(Main *bmain, const char *name)
|
|||||||
return mb;
|
return mb;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaBall *BKE_mball_copy_ex(Main *bmain, MetaBall *mb)
|
MetaBall *BKE_mball_copy(Main *bmain, MetaBall *mb)
|
||||||
{
|
{
|
||||||
MetaBall *mbn;
|
MetaBall *mbn;
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
mbn = BKE_libblock_copy_ex(bmain, &mb->id);
|
mbn = BKE_libblock_copy(bmain, &mb->id);
|
||||||
|
|
||||||
BLI_duplicatelist(&mbn->elems, &mb->elems);
|
BLI_duplicatelist(&mbn->elems, &mb->elems);
|
||||||
|
|
||||||
@ -126,11 +126,6 @@ MetaBall *BKE_mball_copy_ex(Main *bmain, MetaBall *mb)
|
|||||||
return mbn;
|
return mbn;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaBall *BKE_mball_copy(MetaBall *mb)
|
|
||||||
{
|
|
||||||
return BKE_mball_copy_ex(G.main, mb);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int extern_local_mball_callback(
|
static int extern_local_mball_callback(
|
||||||
void *UNUSED(user_data), struct ID *UNUSED(id_self), struct ID **id_pointer, int cd_flag)
|
void *UNUSED(user_data), struct ID *UNUSED(id_self), struct ID **id_pointer, int cd_flag)
|
||||||
{
|
{
|
||||||
@ -167,7 +162,7 @@ void BKE_mball_make_local(Main *bmain, MetaBall *mb)
|
|||||||
extern_local_mball(mb);
|
extern_local_mball(mb);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MetaBall *mb_new = BKE_mball_copy_ex(bmain, mb);
|
MetaBall *mb_new = BKE_mball_copy(bmain, mb);
|
||||||
|
|
||||||
mb_new->id.us = 0;
|
mb_new->id.us = 0;
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ Mesh *BKE_mesh_add(Main *bmain, const char *name)
|
|||||||
return me;
|
return me;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh *BKE_mesh_copy_ex(Main *bmain, Mesh *me)
|
Mesh *BKE_mesh_copy(Main *bmain, Mesh *me)
|
||||||
{
|
{
|
||||||
Mesh *men;
|
Mesh *men;
|
||||||
MTFace *tface;
|
MTFace *tface;
|
||||||
@ -501,7 +501,7 @@ Mesh *BKE_mesh_copy_ex(Main *bmain, Mesh *me)
|
|||||||
int a, i;
|
int a, i;
|
||||||
const int do_tessface = ((me->totface != 0) && (me->totpoly == 0)); /* only do tessface if we have no polys */
|
const int do_tessface = ((me->totface != 0) && (me->totpoly == 0)); /* only do tessface if we have no polys */
|
||||||
|
|
||||||
men = BKE_libblock_copy_ex(bmain, &me->id);
|
men = BKE_libblock_copy(bmain, &me->id);
|
||||||
|
|
||||||
men->mat = MEM_dupallocN(me->mat);
|
men->mat = MEM_dupallocN(me->mat);
|
||||||
for (a = 0; a < men->totcol; a++) {
|
for (a = 0; a < men->totcol; a++) {
|
||||||
@ -549,7 +549,7 @@ Mesh *BKE_mesh_copy_ex(Main *bmain, Mesh *me)
|
|||||||
men->bb = MEM_dupallocN(men->bb);
|
men->bb = MEM_dupallocN(men->bb);
|
||||||
|
|
||||||
if (me->key) {
|
if (me->key) {
|
||||||
men->key = BKE_key_copy_ex(bmain, me->key);
|
men->key = BKE_key_copy(bmain, me->key);
|
||||||
men->key->from = (ID *)men;
|
men->key->from = (ID *)men;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,11 +560,6 @@ Mesh *BKE_mesh_copy_ex(Main *bmain, Mesh *me)
|
|||||||
return men;
|
return men;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh *BKE_mesh_copy(Mesh *me)
|
|
||||||
{
|
|
||||||
return BKE_mesh_copy_ex(G.main, me);
|
|
||||||
}
|
|
||||||
|
|
||||||
BMesh *BKE_mesh_to_bmesh(
|
BMesh *BKE_mesh_to_bmesh(
|
||||||
Mesh *me, Object *ob,
|
Mesh *me, Object *ob,
|
||||||
const bool add_key_index, const struct BMeshCreateParams *params)
|
const bool add_key_index, const struct BMeshCreateParams *params)
|
||||||
@ -650,7 +645,7 @@ void BKE_mesh_make_local(Main *bmain, Mesh *me)
|
|||||||
expand_local_mesh(me);
|
expand_local_mesh(me);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Mesh *me_new = BKE_mesh_copy_ex(bmain, me);
|
Mesh *me_new = BKE_mesh_copy(bmain, me);
|
||||||
|
|
||||||
me_new->id.us = 0;
|
me_new->id.us = 0;
|
||||||
|
|
||||||
@ -2338,7 +2333,7 @@ Mesh *BKE_mesh_new_from_object(
|
|||||||
BKE_object_free_modifiers(tmpobj);
|
BKE_object_free_modifiers(tmpobj);
|
||||||
|
|
||||||
/* copies the data */
|
/* copies the data */
|
||||||
copycu = tmpobj->data = BKE_curve_copy_ex(bmain, (Curve *) ob->data);
|
copycu = tmpobj->data = BKE_curve_copy(bmain, (Curve *) ob->data);
|
||||||
|
|
||||||
/* temporarily set edit so we get updates from edit mode, but
|
/* temporarily set edit so we get updates from edit mode, but
|
||||||
* also because for text datablocks copying it while in edit
|
* also because for text datablocks copying it while in edit
|
||||||
@ -2419,7 +2414,7 @@ Mesh *BKE_mesh_new_from_object(
|
|||||||
/* copies object and modifiers (but not the data) */
|
/* copies object and modifiers (but not the data) */
|
||||||
if (cage) {
|
if (cage) {
|
||||||
/* copies the data */
|
/* copies the data */
|
||||||
tmpmesh = BKE_mesh_copy_ex(bmain, ob->data);
|
tmpmesh = BKE_mesh_copy(bmain, ob->data);
|
||||||
/* if not getting the original caged mesh, get final derived mesh */
|
/* if not getting the original caged mesh, get final derived mesh */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -183,7 +183,7 @@ NlaStrip *copy_nlastrip(NlaStrip *strip, const bool use_same_action)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* use a copy of the action instead (user count shouldn't have changed yet) */
|
/* use a copy of the action instead (user count shouldn't have changed yet) */
|
||||||
strip_d->act = BKE_action_copy(strip_d->act);
|
strip_d->act = BKE_action_copy(G.main, strip_d->act);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1205,7 +1205,7 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, Main *bmain, bool ski
|
|||||||
|
|
||||||
/* is ntree part of library? */
|
/* is ntree part of library? */
|
||||||
if (bmain && !skip_database && BLI_findindex(&bmain->nodetree, ntree) >= 0) {
|
if (bmain && !skip_database && BLI_findindex(&bmain->nodetree, ntree) >= 0) {
|
||||||
newtree = BKE_libblock_copy(&ntree->id);
|
newtree = BKE_libblock_copy(bmain, &ntree->id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newtree = BKE_libblock_copy_nolib(&ntree->id, true);
|
newtree = BKE_libblock_copy_nolib(&ntree->id, true);
|
||||||
@ -1300,9 +1300,9 @@ bNodeTree *ntreeCopyTree_ex(bNodeTree *ntree, Main *bmain, const bool do_id_user
|
|||||||
{
|
{
|
||||||
return ntreeCopyTree_internal(ntree, bmain, false, do_id_user, true, true);
|
return ntreeCopyTree_internal(ntree, bmain, false, do_id_user, true, true);
|
||||||
}
|
}
|
||||||
bNodeTree *ntreeCopyTree(bNodeTree *ntree)
|
bNodeTree *ntreeCopyTree(Main *bmain, bNodeTree *ntree)
|
||||||
{
|
{
|
||||||
return ntreeCopyTree_ex(ntree, G.main, true);
|
return ntreeCopyTree_ex(ntree, bmain, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* use when duplicating scenes */
|
/* use when duplicating scenes */
|
||||||
@ -1995,11 +1995,11 @@ void ntreeMakeLocal(bNodeTree *ntree, bool id_in_mainlist)
|
|||||||
}
|
}
|
||||||
else if (local && lib) {
|
else if (local && lib) {
|
||||||
/* this is the mixed case, we copy the tree and assign it to local users */
|
/* this is the mixed case, we copy the tree and assign it to local users */
|
||||||
bNodeTree *newtree = ntreeCopyTree(ntree);
|
bNodeTree *newtree = ntreeCopyTree(bmain, ntree);
|
||||||
|
|
||||||
newtree->id.us = 0;
|
newtree->id.us = 0;
|
||||||
|
|
||||||
FOREACH_NODETREE(G.main, tntree, owner_id) {
|
FOREACH_NODETREE(bmain, tntree, owner_id) {
|
||||||
bNode *node;
|
bNode *node;
|
||||||
/* find if group is in tree */
|
/* find if group is in tree */
|
||||||
for (node = tntree->nodes.first; node; node = node->next) {
|
for (node = tntree->nodes.first; node; node = node->next) {
|
||||||
|
@ -1094,7 +1094,7 @@ Object *BKE_object_copy_ex(Main *bmain, Object *ob, bool copy_caches)
|
|||||||
ModifierData *md;
|
ModifierData *md;
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
obn = BKE_libblock_copy_ex(bmain, &ob->id);
|
obn = BKE_libblock_copy(bmain, &ob->id);
|
||||||
|
|
||||||
if (ob->totcol) {
|
if (ob->totcol) {
|
||||||
obn->mat = MEM_dupallocN(ob->mat);
|
obn->mat = MEM_dupallocN(ob->mat);
|
||||||
@ -1181,9 +1181,9 @@ Object *BKE_object_copy_ex(Main *bmain, Object *ob, bool copy_caches)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 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(Main *bmain, Object *ob)
|
||||||
{
|
{
|
||||||
return BKE_object_copy_ex(G.main, ob, false);
|
return BKE_object_copy_ex(bmain, ob, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int extern_local_object_callback(
|
static int extern_local_object_callback(
|
||||||
@ -1223,7 +1223,7 @@ void BKE_object_make_local(Main *bmain, Object *ob)
|
|||||||
extern_local_object(ob);
|
extern_local_object(ob);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Object *ob_new = BKE_object_copy_ex(bmain, ob, false);
|
Object *ob_new = BKE_object_copy(bmain, ob);
|
||||||
|
|
||||||
ob_new->id.us = 0;
|
ob_new->id.us = 0;
|
||||||
ob_new->proxy = ob_new->proxy_from = ob_new->proxy_group = NULL;
|
ob_new->proxy = ob_new->proxy_from = ob_new->proxy_group = NULL;
|
||||||
|
@ -3304,12 +3304,12 @@ void BKE_particlesettings_rough_curve_init(ParticleSettings *part)
|
|||||||
part->roughcurve = cumap;
|
part->roughcurve = cumap;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleSettings *BKE_particlesettings_copy(ParticleSettings *part)
|
ParticleSettings *BKE_particlesettings_copy(Main *bmain, ParticleSettings *part)
|
||||||
{
|
{
|
||||||
ParticleSettings *partn;
|
ParticleSettings *partn;
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
partn = BKE_libblock_copy(&part->id);
|
partn = BKE_libblock_copy(bmain, &part->id);
|
||||||
partn->pd = MEM_dupallocN(part->pd);
|
partn->pd = MEM_dupallocN(part->pd);
|
||||||
partn->pd2 = MEM_dupallocN(part->pd2);
|
partn->pd2 = MEM_dupallocN(part->pd2);
|
||||||
partn->effector_weights = MEM_dupallocN(part->effector_weights);
|
partn->effector_weights = MEM_dupallocN(part->effector_weights);
|
||||||
@ -3333,7 +3333,7 @@ ParticleSettings *BKE_particlesettings_copy(ParticleSettings *part)
|
|||||||
BLI_duplicatelist(&partn->dupliweights, &part->dupliweights);
|
BLI_duplicatelist(&partn->dupliweights, &part->dupliweights);
|
||||||
|
|
||||||
if (ID_IS_LINKED_DATABLOCK(part)) {
|
if (ID_IS_LINKED_DATABLOCK(part)) {
|
||||||
BKE_id_lib_local_paths(G.main, part->id.lib, &partn->id);
|
BKE_id_lib_local_paths(bmain, part->id.lib, &partn->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return partn;
|
return partn;
|
||||||
@ -3383,7 +3383,7 @@ void BKE_particlesettings_make_local(ParticleSettings *part)
|
|||||||
expand_local_particlesettings(part);
|
expand_local_particlesettings(part);
|
||||||
}
|
}
|
||||||
else if (is_local && is_lib) {
|
else if (is_local && is_lib) {
|
||||||
ParticleSettings *part_new = BKE_particlesettings_copy(part);
|
ParticleSettings *part_new = BKE_particlesettings_copy(bmain, part);
|
||||||
part_new->id.us = 0;
|
part_new->id.us = 0;
|
||||||
|
|
||||||
/* Remap paths of new ID using old library as base. */
|
/* Remap paths of new ID using old library as base. */
|
||||||
|
@ -150,7 +150,7 @@ static void remove_sequencer_fcurves(Scene *sce)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Scene *BKE_scene_copy(Scene *sce, int type)
|
Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
|
||||||
{
|
{
|
||||||
Scene *scen;
|
Scene *scen;
|
||||||
SceneRenderLayer *srl, *new_srl;
|
SceneRenderLayer *srl, *new_srl;
|
||||||
@ -161,7 +161,7 @@ Scene *BKE_scene_copy(Scene *sce, int type)
|
|||||||
if (type == SCE_COPY_EMPTY) {
|
if (type == SCE_COPY_EMPTY) {
|
||||||
ListBase rl, rv;
|
ListBase rl, rv;
|
||||||
/* XXX. main should become an arg */
|
/* XXX. main should become an arg */
|
||||||
scen = BKE_scene_add(G.main, sce->id.name + 2);
|
scen = BKE_scene_add(bmain, sce->id.name + 2);
|
||||||
|
|
||||||
rl = scen->r.layers;
|
rl = scen->r.layers;
|
||||||
rv = scen->r.views;
|
rv = scen->r.views;
|
||||||
@ -182,10 +182,10 @@ Scene *BKE_scene_copy(Scene *sce, int type)
|
|||||||
BKE_sound_destroy_scene(scen);
|
BKE_sound_destroy_scene(scen);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scen = BKE_libblock_copy(&sce->id);
|
scen = BKE_libblock_copy(bmain, &sce->id);
|
||||||
BLI_duplicatelist(&(scen->base), &(sce->base));
|
BLI_duplicatelist(&(scen->base), &(sce->base));
|
||||||
|
|
||||||
BKE_main_id_clear_newpoins(G.main);
|
BKE_main_id_clear_newpoins(bmain);
|
||||||
|
|
||||||
id_us_plus((ID *)scen->world);
|
id_us_plus((ID *)scen->world);
|
||||||
id_us_plus((ID *)scen->set);
|
id_us_plus((ID *)scen->set);
|
||||||
@ -209,7 +209,7 @@ Scene *BKE_scene_copy(Scene *sce, int type)
|
|||||||
|
|
||||||
if (sce->nodetree) {
|
if (sce->nodetree) {
|
||||||
/* ID's are managed on both copy and switch */
|
/* ID's are managed on both copy and switch */
|
||||||
scen->nodetree = ntreeCopyTree(sce->nodetree);
|
scen->nodetree = ntreeCopyTree(bmain, sce->nodetree);
|
||||||
ntreeSwitchID(scen->nodetree, &sce->id, &scen->id);
|
ntreeSwitchID(scen->nodetree, &sce->id, &scen->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ Scene *BKE_scene_copy(Scene *sce, int type)
|
|||||||
for (lineset = new_srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
|
for (lineset = new_srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
|
||||||
if (lineset->linestyle) {
|
if (lineset->linestyle) {
|
||||||
id_us_plus((ID *)lineset->linestyle);
|
id_us_plus((ID *)lineset->linestyle);
|
||||||
lineset->linestyle = BKE_linestyle_copy(G.main, lineset->linestyle);
|
lineset->linestyle = BKE_linestyle_copy(bmain, lineset->linestyle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,7 +320,7 @@ Scene *BKE_scene_copy(Scene *sce, int type)
|
|||||||
if (type == SCE_COPY_FULL) {
|
if (type == SCE_COPY_FULL) {
|
||||||
if (scen->world) {
|
if (scen->world) {
|
||||||
id_us_plus((ID *)scen->world);
|
id_us_plus((ID *)scen->world);
|
||||||
scen->world = BKE_world_copy(scen->world);
|
scen->world = BKE_world_copy(bmain, scen->world);
|
||||||
BKE_animdata_copy_id_action((ID *)scen->world);
|
BKE_animdata_copy_id_action((ID *)scen->world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ Scene *BKE_scene_copy(Scene *sce, int type)
|
|||||||
/* grease pencil */
|
/* grease pencil */
|
||||||
if (scen->gpd) {
|
if (scen->gpd) {
|
||||||
if (type == SCE_COPY_FULL) {
|
if (type == SCE_COPY_FULL) {
|
||||||
scen->gpd = gpencil_data_duplicate(scen->gpd, false);
|
scen->gpd = gpencil_data_duplicate(bmain, scen->gpd, false);
|
||||||
}
|
}
|
||||||
else if (type == SCE_COPY_EMPTY) {
|
else if (type == SCE_COPY_EMPTY) {
|
||||||
scen->gpd = NULL;
|
scen->gpd = NULL;
|
||||||
|
@ -66,11 +66,11 @@ void *BKE_speaker_add(Main *bmain, const char *name)
|
|||||||
return spk;
|
return spk;
|
||||||
}
|
}
|
||||||
|
|
||||||
Speaker *BKE_speaker_copy(Speaker *spk)
|
Speaker *BKE_speaker_copy(Main *bmain, Speaker *spk)
|
||||||
{
|
{
|
||||||
Speaker *spkn;
|
Speaker *spkn;
|
||||||
|
|
||||||
spkn = BKE_libblock_copy(&spk->id);
|
spkn = BKE_libblock_copy(bmain, &spk->id);
|
||||||
if (spkn->sound)
|
if (spkn->sound)
|
||||||
id_us_plus(&spkn->sound->id);
|
id_us_plus(&spkn->sound->id);
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ void BKE_speaker_make_local(Speaker *spk)
|
|||||||
extern_local_speaker(spk);
|
extern_local_speaker(spk);
|
||||||
}
|
}
|
||||||
else if (is_local && is_lib) {
|
else if (is_local && is_lib) {
|
||||||
Speaker *spk_new = BKE_speaker_copy(spk);
|
Speaker *spk_new = BKE_speaker_copy(bmain, spk);
|
||||||
spk_new->id.us = 0;
|
spk_new->id.us = 0;
|
||||||
|
|
||||||
/* Remap paths of new ID using old library as base. */
|
/* Remap paths of new ID using old library as base. */
|
||||||
|
@ -452,7 +452,7 @@ Text *BKE_text_copy(Main *bmain, Text *ta)
|
|||||||
Text *tan;
|
Text *tan;
|
||||||
TextLine *line, *tmp;
|
TextLine *line, *tmp;
|
||||||
|
|
||||||
tan = BKE_libblock_copy(&ta->id);
|
tan = BKE_libblock_copy(bmain, &ta->id);
|
||||||
|
|
||||||
/* file name can be NULL */
|
/* file name can be NULL */
|
||||||
if (ta->name) {
|
if (ta->name) {
|
||||||
|
@ -844,11 +844,11 @@ MTex *BKE_texture_mtex_add_id(ID *id, int slot)
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
Tex *BKE_texture_copy(Tex *tex)
|
Tex *BKE_texture_copy(Main *bmain, Tex *tex)
|
||||||
{
|
{
|
||||||
Tex *texn;
|
Tex *texn;
|
||||||
|
|
||||||
texn = BKE_libblock_copy(&tex->id);
|
texn = BKE_libblock_copy(bmain, &tex->id);
|
||||||
if (BKE_texture_is_image_user(tex)) {
|
if (BKE_texture_is_image_user(tex)) {
|
||||||
id_us_plus((ID *)texn->ima);
|
id_us_plus((ID *)texn->ima);
|
||||||
}
|
}
|
||||||
@ -867,11 +867,11 @@ Tex *BKE_texture_copy(Tex *tex)
|
|||||||
if (tex->nodetree->execdata) {
|
if (tex->nodetree->execdata) {
|
||||||
ntreeTexEndExecTree(tex->nodetree->execdata);
|
ntreeTexEndExecTree(tex->nodetree->execdata);
|
||||||
}
|
}
|
||||||
texn->nodetree = ntreeCopyTree(tex->nodetree);
|
texn->nodetree = ntreeCopyTree(bmain, tex->nodetree);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ID_IS_LINKED_DATABLOCK(tex)) {
|
if (ID_IS_LINKED_DATABLOCK(tex)) {
|
||||||
BKE_id_lib_local_paths(G.main, tex->id.lib, &texn->id);
|
BKE_id_lib_local_paths(bmain, tex->id.lib, &texn->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return texn;
|
return texn;
|
||||||
@ -1011,7 +1011,7 @@ void BKE_texture_make_local(Tex *tex)
|
|||||||
extern_local_texture(tex);
|
extern_local_texture(tex);
|
||||||
}
|
}
|
||||||
else if (is_local && is_lib) {
|
else if (is_local && is_lib) {
|
||||||
Tex *tex_new = BKE_texture_copy(tex);
|
Tex *tex_new = BKE_texture_copy(bmain, tex);
|
||||||
|
|
||||||
tex_new->id.us = 0;
|
tex_new->id.us = 0;
|
||||||
|
|
||||||
|
@ -117,12 +117,12 @@ World *add_world(Main *bmain, const char *name)
|
|||||||
return wrld;
|
return wrld;
|
||||||
}
|
}
|
||||||
|
|
||||||
World *BKE_world_copy(World *wrld)
|
World *BKE_world_copy(Main *bmain, World *wrld)
|
||||||
{
|
{
|
||||||
World *wrldn;
|
World *wrldn;
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
wrldn = BKE_libblock_copy(&wrld->id);
|
wrldn = BKE_libblock_copy(bmain, &wrld->id);
|
||||||
|
|
||||||
for (a = 0; a < MAX_MTEX; a++) {
|
for (a = 0; a < MAX_MTEX; a++) {
|
||||||
if (wrld->mtex[a]) {
|
if (wrld->mtex[a]) {
|
||||||
@ -133,7 +133,7 @@ World *BKE_world_copy(World *wrld)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (wrld->nodetree) {
|
if (wrld->nodetree) {
|
||||||
wrldn->nodetree = ntreeCopyTree(wrld->nodetree);
|
wrldn->nodetree = ntreeCopyTree(bmain, wrld->nodetree);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wrld->preview)
|
if (wrld->preview)
|
||||||
@ -142,7 +142,7 @@ World *BKE_world_copy(World *wrld)
|
|||||||
BLI_listbase_clear(&wrldn->gpumaterial);
|
BLI_listbase_clear(&wrldn->gpumaterial);
|
||||||
|
|
||||||
if (ID_IS_LINKED_DATABLOCK(wrld)) {
|
if (ID_IS_LINKED_DATABLOCK(wrld)) {
|
||||||
BKE_id_lib_local_paths(G.main, wrld->id.lib, &wrldn->id);
|
BKE_id_lib_local_paths(bmain, wrld->id.lib, &wrldn->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return wrldn;
|
return wrldn;
|
||||||
@ -202,7 +202,7 @@ void BKE_world_make_local(World *wrld)
|
|||||||
id_clear_lib_data(bmain, &wrld->id);
|
id_clear_lib_data(bmain, &wrld->id);
|
||||||
}
|
}
|
||||||
else if (is_local && is_lib) {
|
else if (is_local && is_lib) {
|
||||||
World *wrld_new = BKE_world_copy(wrld);
|
World *wrld_new = BKE_world_copy(bmain, wrld);
|
||||||
wrld_new->id.us = 0;
|
wrld_new->id.us = 0;
|
||||||
|
|
||||||
/* Remap paths of new ID using old library as base. */
|
/* Remap paths of new ID using old library as base. */
|
||||||
|
@ -416,7 +416,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "create <instance_node> under node id=%s from node id=%s\n", instance_node ? instance_node->getOriginalId().c_str() : NULL, source_node ? source_node->getOriginalId().c_str() : NULL);
|
fprintf(stderr, "create <instance_node> under node id=%s from node id=%s\n", instance_node ? instance_node->getOriginalId().c_str() : NULL, source_node ? source_node->getOriginalId().c_str() : NULL);
|
||||||
|
|
||||||
Object *obn = BKE_object_copy(source_ob);
|
Object *obn = BKE_object_copy(G.main, source_ob);
|
||||||
DAG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
|
DAG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
|
||||||
BKE_scene_base_add(sce, obn);
|
BKE_scene_base_add(sce, obn);
|
||||||
|
|
||||||
|
@ -1301,7 +1301,7 @@ static int separate_exec(bContext *C, wmOperator *op)
|
|||||||
DAG_relations_tag_update(bmain);
|
DAG_relations_tag_update(bmain);
|
||||||
|
|
||||||
newob = newbase->object;
|
newob = newbase->object;
|
||||||
newcu = newob->data = BKE_curve_copy_ex(bmain, oldcu);
|
newcu = newob->data = BKE_curve_copy(bmain, oldcu);
|
||||||
newcu->editnurb = NULL;
|
newcu->editnurb = NULL;
|
||||||
id_us_min(&oldcu->id); /* because new curve is a copy: reduce user count */
|
id_us_min(&oldcu->id); /* because new curve is a copy: reduce user count */
|
||||||
|
|
||||||
|
@ -43,7 +43,9 @@
|
|||||||
|
|
||||||
#include "BKE_blender_undo.h"
|
#include "BKE_blender_undo.h"
|
||||||
#include "BKE_context.h"
|
#include "BKE_context.h"
|
||||||
|
#include "BKE_global.h"
|
||||||
#include "BKE_gpencil.h"
|
#include "BKE_gpencil.h"
|
||||||
|
#include "BKE_main.h"
|
||||||
|
|
||||||
#include "ED_gpencil.h"
|
#include "ED_gpencil.h"
|
||||||
|
|
||||||
@ -151,7 +153,7 @@ void gpencil_undo_push(bGPdata *gpd)
|
|||||||
|
|
||||||
/* create new undo node */
|
/* create new undo node */
|
||||||
undo_node = MEM_callocN(sizeof(bGPundonode), "gpencil undo node");
|
undo_node = MEM_callocN(sizeof(bGPundonode), "gpencil undo node");
|
||||||
undo_node->gpd = gpencil_data_duplicate(gpd, true);
|
undo_node->gpd = gpencil_data_duplicate(G.main, gpd, true);
|
||||||
|
|
||||||
cur_node = undo_node;
|
cur_node = undo_node;
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ static void template_ID(
|
|||||||
|
|
||||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ALONE));
|
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ALONE));
|
||||||
if (/* test only */
|
if (/* test only */
|
||||||
(id_copy(id, NULL, true) == false) ||
|
(id_copy(CTX_data_main(C), id, NULL, true) == false) ||
|
||||||
(idfrom && idfrom->lib) ||
|
(idfrom && idfrom->lib) ||
|
||||||
(!editable) ||
|
(!editable) ||
|
||||||
/* object in editmode - don't change data */
|
/* object in editmode - don't change data */
|
||||||
|
@ -172,7 +172,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
|
|||||||
*/
|
*/
|
||||||
if (key) {
|
if (key) {
|
||||||
/* make a duplicate copy that will only be used here... (must remember to free it!) */
|
/* make a duplicate copy that will only be used here... (must remember to free it!) */
|
||||||
nkey = BKE_key_copy_ex(bmain, key);
|
nkey = BKE_key_copy(bmain, key);
|
||||||
|
|
||||||
/* for all keys in old block, clear data-arrays */
|
/* for all keys in old block, clear data-arrays */
|
||||||
for (kb = key->block.first; kb; kb = kb->next) {
|
for (kb = key->block.first; kb; kb = kb->next) {
|
||||||
|
@ -1299,7 +1299,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
|
|||||||
|
|
||||||
for (dob = lb->first; dob; dob = dob->next) {
|
for (dob = lb->first; dob; dob = dob->next) {
|
||||||
Base *basen;
|
Base *basen;
|
||||||
Object *ob = BKE_object_copy(dob->ob);
|
Object *ob = BKE_object_copy(bmain, dob->ob);
|
||||||
|
|
||||||
/* font duplis can have a totcol without material, we get them from parent
|
/* font duplis can have a totcol without material, we get them from parent
|
||||||
* should be implemented better...
|
* should be implemented better...
|
||||||
@ -1520,7 +1520,7 @@ static int convert_poll(bContext *C)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Helper for convert_exec */
|
/* Helper for convert_exec */
|
||||||
static Base *duplibase_for_convert(Scene *scene, Base *base, Object *ob)
|
static Base *duplibase_for_convert(Main *bmain, Scene *scene, Base *base, Object *ob)
|
||||||
{
|
{
|
||||||
Object *obn;
|
Object *obn;
|
||||||
Base *basen;
|
Base *basen;
|
||||||
@ -1529,7 +1529,7 @@ static Base *duplibase_for_convert(Scene *scene, Base *base, Object *ob)
|
|||||||
ob = base->object;
|
ob = base->object;
|
||||||
}
|
}
|
||||||
|
|
||||||
obn = BKE_object_copy(ob);
|
obn = BKE_object_copy(bmain, ob);
|
||||||
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
|
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
|
||||||
|
|
||||||
basen = MEM_mallocN(sizeof(Base), "duplibase");
|
basen = MEM_mallocN(sizeof(Base), "duplibase");
|
||||||
@ -1609,7 +1609,7 @@ static int convert_exec(bContext *C, wmOperator *op)
|
|||||||
ob->flag |= OB_DONE;
|
ob->flag |= OB_DONE;
|
||||||
|
|
||||||
if (keep_original) {
|
if (keep_original) {
|
||||||
basen = duplibase_for_convert(scene, base, NULL);
|
basen = duplibase_for_convert(bmain, scene, base, NULL);
|
||||||
newob = basen->object;
|
newob = basen->object;
|
||||||
|
|
||||||
/* decrement original mesh's usage count */
|
/* decrement original mesh's usage count */
|
||||||
@ -1617,7 +1617,7 @@ static int convert_exec(bContext *C, wmOperator *op)
|
|||||||
id_us_min(&me->id);
|
id_us_min(&me->id);
|
||||||
|
|
||||||
/* make a new copy of the mesh */
|
/* make a new copy of the mesh */
|
||||||
newob->data = BKE_mesh_copy(me);
|
newob->data = BKE_mesh_copy(bmain, me);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newob = ob;
|
newob = ob;
|
||||||
@ -1634,7 +1634,7 @@ static int convert_exec(bContext *C, wmOperator *op)
|
|||||||
ob->flag |= OB_DONE;
|
ob->flag |= OB_DONE;
|
||||||
|
|
||||||
if (keep_original) {
|
if (keep_original) {
|
||||||
basen = duplibase_for_convert(scene, base, NULL);
|
basen = duplibase_for_convert(bmain, scene, base, NULL);
|
||||||
newob = basen->object;
|
newob = basen->object;
|
||||||
|
|
||||||
/* decrement original mesh's usage count */
|
/* decrement original mesh's usage count */
|
||||||
@ -1642,7 +1642,7 @@ static int convert_exec(bContext *C, wmOperator *op)
|
|||||||
id_us_min(&me->id);
|
id_us_min(&me->id);
|
||||||
|
|
||||||
/* make a new copy of the mesh */
|
/* make a new copy of the mesh */
|
||||||
newob->data = BKE_mesh_copy(me);
|
newob->data = BKE_mesh_copy(bmain, me);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newob = ob;
|
newob = ob;
|
||||||
@ -1666,14 +1666,14 @@ static int convert_exec(bContext *C, wmOperator *op)
|
|||||||
ob->flag |= OB_DONE;
|
ob->flag |= OB_DONE;
|
||||||
|
|
||||||
if (keep_original) {
|
if (keep_original) {
|
||||||
basen = duplibase_for_convert(scene, base, NULL);
|
basen = duplibase_for_convert(bmain, scene, base, NULL);
|
||||||
newob = basen->object;
|
newob = basen->object;
|
||||||
|
|
||||||
/* decrement original curve's usage count */
|
/* decrement original curve's usage count */
|
||||||
id_us_min(&((Curve *)newob->data)->id);
|
id_us_min(&((Curve *)newob->data)->id);
|
||||||
|
|
||||||
/* make a new copy of the curve */
|
/* make a new copy of the curve */
|
||||||
newob->data = BKE_curve_copy_ex(bmain, ob->data);
|
newob->data = BKE_curve_copy(bmain, ob->data);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newob = ob;
|
newob = ob;
|
||||||
@ -1737,14 +1737,14 @@ static int convert_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
if (target == OB_MESH) {
|
if (target == OB_MESH) {
|
||||||
if (keep_original) {
|
if (keep_original) {
|
||||||
basen = duplibase_for_convert(scene, base, NULL);
|
basen = duplibase_for_convert(bmain, scene, base, NULL);
|
||||||
newob = basen->object;
|
newob = basen->object;
|
||||||
|
|
||||||
/* decrement original curve's usage count */
|
/* decrement original curve's usage count */
|
||||||
id_us_min(&((Curve *)newob->data)->id);
|
id_us_min(&((Curve *)newob->data)->id);
|
||||||
|
|
||||||
/* make a new copy of the curve */
|
/* make a new copy of the curve */
|
||||||
newob->data = BKE_curve_copy_ex(bmain, ob->data);
|
newob->data = BKE_curve_copy(bmain, ob->data);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newob = ob;
|
newob = ob;
|
||||||
@ -1772,7 +1772,7 @@ static int convert_exec(bContext *C, wmOperator *op)
|
|||||||
if (!(baseob->flag & OB_DONE)) {
|
if (!(baseob->flag & OB_DONE)) {
|
||||||
baseob->flag |= OB_DONE;
|
baseob->flag |= OB_DONE;
|
||||||
|
|
||||||
basen = duplibase_for_convert(scene, base, baseob);
|
basen = duplibase_for_convert(bmain, scene, base, baseob);
|
||||||
newob = basen->object;
|
newob = basen->object;
|
||||||
|
|
||||||
mb = newob->data;
|
mb = newob->data;
|
||||||
@ -1910,7 +1910,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
|||||||
; /* nothing? */
|
; /* nothing? */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
obn = BKE_object_copy(ob);
|
obn = BKE_object_copy(bmain, ob);
|
||||||
DAG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
|
DAG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
|
||||||
|
|
||||||
basen = MEM_mallocN(sizeof(Base), "duplibase");
|
basen = MEM_mallocN(sizeof(Base), "duplibase");
|
||||||
@ -1941,7 +1941,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
|||||||
if (id) {
|
if (id) {
|
||||||
ID_NEW_US(obn->mat[a])
|
ID_NEW_US(obn->mat[a])
|
||||||
else
|
else
|
||||||
obn->mat[a] = BKE_material_copy(obn->mat[a]);
|
obn->mat[a] = BKE_material_copy(bmain, obn->mat[a]);
|
||||||
id_us_min(id);
|
id_us_min(id);
|
||||||
|
|
||||||
if (dupflag & USER_DUP_ACT) {
|
if (dupflag & USER_DUP_ACT) {
|
||||||
@ -1957,7 +1957,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
|||||||
if (id) {
|
if (id) {
|
||||||
ID_NEW_US(psys->part)
|
ID_NEW_US(psys->part)
|
||||||
else
|
else
|
||||||
psys->part = BKE_particlesettings_copy(psys->part);
|
psys->part = BKE_particlesettings_copy(bmain, psys->part);
|
||||||
|
|
||||||
if (dupflag & USER_DUP_ACT) {
|
if (dupflag & USER_DUP_ACT) {
|
||||||
BKE_animdata_copy_id_action(&psys->part->id);
|
BKE_animdata_copy_id_action(&psys->part->id);
|
||||||
@ -1976,7 +1976,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
|||||||
if (dupflag & USER_DUP_MESH) {
|
if (dupflag & USER_DUP_MESH) {
|
||||||
ID_NEW_US2(obn->data)
|
ID_NEW_US2(obn->data)
|
||||||
else {
|
else {
|
||||||
obn->data = BKE_mesh_copy(obn->data);
|
obn->data = BKE_mesh_copy(bmain, obn->data);
|
||||||
didit = 1;
|
didit = 1;
|
||||||
}
|
}
|
||||||
id_us_min(id);
|
id_us_min(id);
|
||||||
@ -1986,7 +1986,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
|||||||
if (dupflag & USER_DUP_CURVE) {
|
if (dupflag & USER_DUP_CURVE) {
|
||||||
ID_NEW_US2(obn->data)
|
ID_NEW_US2(obn->data)
|
||||||
else {
|
else {
|
||||||
obn->data = BKE_curve_copy_ex(bmain, obn->data);
|
obn->data = BKE_curve_copy(bmain, obn->data);
|
||||||
didit = 1;
|
didit = 1;
|
||||||
}
|
}
|
||||||
id_us_min(id);
|
id_us_min(id);
|
||||||
@ -1996,7 +1996,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
|||||||
if (dupflag & USER_DUP_SURF) {
|
if (dupflag & USER_DUP_SURF) {
|
||||||
ID_NEW_US2(obn->data)
|
ID_NEW_US2(obn->data)
|
||||||
else {
|
else {
|
||||||
obn->data = BKE_curve_copy_ex(bmain, obn->data);
|
obn->data = BKE_curve_copy(bmain, obn->data);
|
||||||
didit = 1;
|
didit = 1;
|
||||||
}
|
}
|
||||||
id_us_min(id);
|
id_us_min(id);
|
||||||
@ -2006,7 +2006,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
|||||||
if (dupflag & USER_DUP_FONT) {
|
if (dupflag & USER_DUP_FONT) {
|
||||||
ID_NEW_US2(obn->data)
|
ID_NEW_US2(obn->data)
|
||||||
else {
|
else {
|
||||||
obn->data = BKE_curve_copy_ex(bmain, obn->data);
|
obn->data = BKE_curve_copy(bmain, obn->data);
|
||||||
didit = 1;
|
didit = 1;
|
||||||
}
|
}
|
||||||
id_us_min(id);
|
id_us_min(id);
|
||||||
@ -2016,7 +2016,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
|||||||
if (dupflag & USER_DUP_MBALL) {
|
if (dupflag & USER_DUP_MBALL) {
|
||||||
ID_NEW_US2(obn->data)
|
ID_NEW_US2(obn->data)
|
||||||
else {
|
else {
|
||||||
obn->data = BKE_mball_copy_ex(bmain, obn->data);
|
obn->data = BKE_mball_copy(bmain, obn->data);
|
||||||
didit = 1;
|
didit = 1;
|
||||||
}
|
}
|
||||||
id_us_min(id);
|
id_us_min(id);
|
||||||
@ -2026,7 +2026,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
|||||||
if (dupflag & USER_DUP_LAMP) {
|
if (dupflag & USER_DUP_LAMP) {
|
||||||
ID_NEW_US2(obn->data)
|
ID_NEW_US2(obn->data)
|
||||||
else {
|
else {
|
||||||
obn->data = BKE_lamp_copy(obn->data);
|
obn->data = BKE_lamp_copy(bmain, obn->data);
|
||||||
didit = 1;
|
didit = 1;
|
||||||
}
|
}
|
||||||
id_us_min(id);
|
id_us_min(id);
|
||||||
@ -2039,7 +2039,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
|||||||
if (dupflag & USER_DUP_ARM) {
|
if (dupflag & USER_DUP_ARM) {
|
||||||
ID_NEW_US2(obn->data)
|
ID_NEW_US2(obn->data)
|
||||||
else {
|
else {
|
||||||
obn->data = BKE_armature_copy(obn->data);
|
obn->data = BKE_armature_copy(bmain, obn->data);
|
||||||
BKE_pose_rebuild(obn, obn->data);
|
BKE_pose_rebuild(obn, obn->data);
|
||||||
didit = 1;
|
didit = 1;
|
||||||
}
|
}
|
||||||
@ -2050,7 +2050,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
|||||||
if (dupflag != 0) {
|
if (dupflag != 0) {
|
||||||
ID_NEW_US2(obn->data)
|
ID_NEW_US2(obn->data)
|
||||||
else {
|
else {
|
||||||
obn->data = BKE_lattice_copy_ex(bmain, obn->data);
|
obn->data = BKE_lattice_copy(bmain, obn->data);
|
||||||
didit = 1;
|
didit = 1;
|
||||||
}
|
}
|
||||||
id_us_min(id);
|
id_us_min(id);
|
||||||
@ -2060,7 +2060,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
|||||||
if (dupflag != 0) {
|
if (dupflag != 0) {
|
||||||
ID_NEW_US2(obn->data)
|
ID_NEW_US2(obn->data)
|
||||||
else {
|
else {
|
||||||
obn->data = BKE_camera_copy(obn->data);
|
obn->data = BKE_camera_copy(bmain, obn->data);
|
||||||
didit = 1;
|
didit = 1;
|
||||||
}
|
}
|
||||||
id_us_min(id);
|
id_us_min(id);
|
||||||
@ -2070,7 +2070,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
|||||||
if (dupflag != 0) {
|
if (dupflag != 0) {
|
||||||
ID_NEW_US2(obn->data)
|
ID_NEW_US2(obn->data)
|
||||||
else {
|
else {
|
||||||
obn->data = BKE_speaker_copy(obn->data);
|
obn->data = BKE_speaker_copy(bmain, obn->data);
|
||||||
didit = 1;
|
didit = 1;
|
||||||
}
|
}
|
||||||
id_us_min(id);
|
id_us_min(id);
|
||||||
@ -2109,7 +2109,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
|||||||
if (id) {
|
if (id) {
|
||||||
ID_NEW_US((*matarar)[a])
|
ID_NEW_US((*matarar)[a])
|
||||||
else
|
else
|
||||||
(*matarar)[a] = BKE_material_copy((*matarar)[a]);
|
(*matarar)[a] = BKE_material_copy(bmain, (*matarar)[a]);
|
||||||
id_us_min(id);
|
id_us_min(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1751,7 +1751,7 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in
|
|||||||
if ((base->flag & flag) == flag) {
|
if ((base->flag & flag) == flag) {
|
||||||
if (!ID_IS_LINKED_DATABLOCK(ob) && ob->id.us > 1) {
|
if (!ID_IS_LINKED_DATABLOCK(ob) && ob->id.us > 1) {
|
||||||
/* base gets copy of object */
|
/* base gets copy of object */
|
||||||
obn = BKE_object_copy(ob);
|
obn = BKE_object_copy(bmain, ob);
|
||||||
base->object = obn;
|
base->object = obn;
|
||||||
|
|
||||||
if (copy_groups) {
|
if (copy_groups) {
|
||||||
@ -1784,7 +1784,7 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (all_duplicated) {
|
if (all_duplicated) {
|
||||||
groupn = BKE_group_copy(group);
|
groupn = BKE_group_copy(bmain, group);
|
||||||
|
|
||||||
for (go = groupn->gobject.first; go; go = go->next)
|
for (go = groupn->gobject.first; go; go = go->next)
|
||||||
go->ob = (Object *)go->ob->id.newid;
|
go->ob = (Object *)go->ob->id.newid;
|
||||||
@ -1821,7 +1821,7 @@ void ED_object_single_user(Main *bmain, Scene *scene, Object *ob)
|
|||||||
single_object_users(bmain, scene, NULL, OB_DONE, copy_groups);
|
single_object_users(bmain, scene, NULL, OB_DONE, copy_groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void new_id_matar(Material **matar, const int totcol)
|
static void new_id_matar(Main *bmain, Material **matar, const int totcol)
|
||||||
{
|
{
|
||||||
ID *id;
|
ID *id;
|
||||||
int a;
|
int a;
|
||||||
@ -1835,7 +1835,7 @@ static void new_id_matar(Material **matar, const int totcol)
|
|||||||
id_us_min(id);
|
id_us_min(id);
|
||||||
}
|
}
|
||||||
else if (id->us > 1) {
|
else if (id->us > 1) {
|
||||||
matar[a] = BKE_material_copy(matar[a]);
|
matar[a] = BKE_material_copy(bmain, matar[a]);
|
||||||
id_us_min(id);
|
id_us_min(id);
|
||||||
id->newid = (ID *)matar[a];
|
id->newid = (ID *)matar[a];
|
||||||
}
|
}
|
||||||
@ -1865,7 +1865,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, const int flag)
|
|||||||
|
|
||||||
switch (ob->type) {
|
switch (ob->type) {
|
||||||
case OB_LAMP:
|
case OB_LAMP:
|
||||||
ob->data = la = BKE_lamp_copy(ob->data);
|
ob->data = la = BKE_lamp_copy(bmain, ob->data);
|
||||||
for (a = 0; a < MAX_MTEX; a++) {
|
for (a = 0; a < MAX_MTEX; a++) {
|
||||||
if (la->mtex[a]) {
|
if (la->mtex[a]) {
|
||||||
ID_NEW(la->mtex[a]->object);
|
ID_NEW(la->mtex[a]->object);
|
||||||
@ -1873,37 +1873,37 @@ static void single_obdata_users(Main *bmain, Scene *scene, const int flag)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OB_CAMERA:
|
case OB_CAMERA:
|
||||||
ob->data = BKE_camera_copy(ob->data);
|
ob->data = BKE_camera_copy(bmain, ob->data);
|
||||||
break;
|
break;
|
||||||
case OB_MESH:
|
case OB_MESH:
|
||||||
ob->data = me = BKE_mesh_copy(ob->data);
|
ob->data = me = BKE_mesh_copy(bmain, ob->data);
|
||||||
if (me->key)
|
if (me->key)
|
||||||
BKE_animdata_copy_id_action((ID *)me->key);
|
BKE_animdata_copy_id_action((ID *)me->key);
|
||||||
break;
|
break;
|
||||||
case OB_MBALL:
|
case OB_MBALL:
|
||||||
ob->data = BKE_mball_copy_ex(bmain, ob->data);
|
ob->data = BKE_mball_copy(bmain, ob->data);
|
||||||
break;
|
break;
|
||||||
case OB_CURVE:
|
case OB_CURVE:
|
||||||
case OB_SURF:
|
case OB_SURF:
|
||||||
case OB_FONT:
|
case OB_FONT:
|
||||||
ob->data = cu = BKE_curve_copy_ex(bmain, ob->data);
|
ob->data = cu = BKE_curve_copy(bmain, ob->data);
|
||||||
ID_NEW(cu->bevobj);
|
ID_NEW(cu->bevobj);
|
||||||
ID_NEW(cu->taperobj);
|
ID_NEW(cu->taperobj);
|
||||||
if (cu->key)
|
if (cu->key)
|
||||||
BKE_animdata_copy_id_action((ID *)cu->key);
|
BKE_animdata_copy_id_action((ID *)cu->key);
|
||||||
break;
|
break;
|
||||||
case OB_LATTICE:
|
case OB_LATTICE:
|
||||||
ob->data = lat = BKE_lattice_copy_ex(bmain, ob->data);
|
ob->data = lat = BKE_lattice_copy(bmain, ob->data);
|
||||||
if (lat->key)
|
if (lat->key)
|
||||||
BKE_animdata_copy_id_action((ID *)lat->key);
|
BKE_animdata_copy_id_action((ID *)lat->key);
|
||||||
break;
|
break;
|
||||||
case OB_ARMATURE:
|
case OB_ARMATURE:
|
||||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||||
ob->data = BKE_armature_copy(ob->data);
|
ob->data = BKE_armature_copy(bmain, ob->data);
|
||||||
BKE_pose_rebuild(ob, ob->data);
|
BKE_pose_rebuild(ob, ob->data);
|
||||||
break;
|
break;
|
||||||
case OB_SPEAKER:
|
case OB_SPEAKER:
|
||||||
ob->data = BKE_speaker_copy(ob->data);
|
ob->data = BKE_speaker_copy(bmain, ob->data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (G.debug & G_DEBUG)
|
if (G.debug & G_DEBUG)
|
||||||
@ -1945,7 +1945,7 @@ static void single_object_action_users(Scene *scene, const int flag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void single_mat_users(Scene *scene, const int flag, const bool do_textures)
|
static void single_mat_users(Main *bmain, Scene *scene, const int flag, const bool do_textures)
|
||||||
{
|
{
|
||||||
Object *ob;
|
Object *ob;
|
||||||
Base *base;
|
Base *base;
|
||||||
@ -1962,7 +1962,7 @@ static void single_mat_users(Scene *scene, const int flag, const bool do_texture
|
|||||||
/* do not test for LIB_TAG_NEW: this functions guaranteed delivers single_users! */
|
/* do not test for LIB_TAG_NEW: this functions guaranteed delivers single_users! */
|
||||||
|
|
||||||
if (ma->id.us > 1) {
|
if (ma->id.us > 1) {
|
||||||
man = BKE_material_copy(ma);
|
man = BKE_material_copy(bmain, ma);
|
||||||
BKE_animdata_copy_id_action(&man->id);
|
BKE_animdata_copy_id_action(&man->id);
|
||||||
|
|
||||||
man->id.us = 0;
|
man->id.us = 0;
|
||||||
@ -1973,7 +1973,7 @@ static void single_mat_users(Scene *scene, const int flag, const bool do_texture
|
|||||||
if (ma->mtex[b] && (tex = ma->mtex[b]->tex)) {
|
if (ma->mtex[b] && (tex = ma->mtex[b]->tex)) {
|
||||||
if (tex->id.us > 1) {
|
if (tex->id.us > 1) {
|
||||||
id_us_min(&tex->id);
|
id_us_min(&tex->id);
|
||||||
tex = BKE_texture_copy(tex);
|
tex = BKE_texture_copy(bmain, tex);
|
||||||
BKE_animdata_copy_id_action(&tex->id);
|
BKE_animdata_copy_id_action(&tex->id);
|
||||||
man->mtex[b]->tex = tex;
|
man->mtex[b]->tex = tex;
|
||||||
}
|
}
|
||||||
@ -1987,7 +1987,7 @@ static void single_mat_users(Scene *scene, const int flag, const bool do_texture
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_single_tex_user(Tex **from)
|
static void do_single_tex_user(Main *bmain, Tex **from)
|
||||||
{
|
{
|
||||||
Tex *tex, *texn;
|
Tex *tex, *texn;
|
||||||
|
|
||||||
@ -2000,7 +2000,7 @@ static void do_single_tex_user(Tex **from)
|
|||||||
id_us_min(&tex->id);
|
id_us_min(&tex->id);
|
||||||
}
|
}
|
||||||
else if (tex->id.us > 1) {
|
else if (tex->id.us > 1) {
|
||||||
texn = BKE_texture_copy(tex);
|
texn = BKE_texture_copy(bmain, tex);
|
||||||
BKE_animdata_copy_id_action(&texn->id);
|
BKE_animdata_copy_id_action(&texn->id);
|
||||||
tex->id.newid = (ID *)texn;
|
tex->id.newid = (ID *)texn;
|
||||||
id_us_min(&tex->id);
|
id_us_min(&tex->id);
|
||||||
@ -2020,7 +2020,7 @@ static void single_tex_users_expand(Main *bmain)
|
|||||||
if (ma->id.tag & LIB_TAG_NEW) {
|
if (ma->id.tag & LIB_TAG_NEW) {
|
||||||
for (b = 0; b < MAX_MTEX; b++) {
|
for (b = 0; b < MAX_MTEX; b++) {
|
||||||
if (ma->mtex[b] && ma->mtex[b]->tex) {
|
if (ma->mtex[b] && ma->mtex[b]->tex) {
|
||||||
do_single_tex_user(&(ma->mtex[b]->tex));
|
do_single_tex_user(bmain, &(ma->mtex[b]->tex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2030,7 +2030,7 @@ static void single_tex_users_expand(Main *bmain)
|
|||||||
if (la->id.tag & LIB_TAG_NEW) {
|
if (la->id.tag & LIB_TAG_NEW) {
|
||||||
for (b = 0; b < MAX_MTEX; b++) {
|
for (b = 0; b < MAX_MTEX; b++) {
|
||||||
if (la->mtex[b] && la->mtex[b]->tex) {
|
if (la->mtex[b] && la->mtex[b]->tex) {
|
||||||
do_single_tex_user(&(la->mtex[b]->tex));
|
do_single_tex_user(bmain, &(la->mtex[b]->tex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2040,7 +2040,7 @@ static void single_tex_users_expand(Main *bmain)
|
|||||||
if (wo->id.tag & LIB_TAG_NEW) {
|
if (wo->id.tag & LIB_TAG_NEW) {
|
||||||
for (b = 0; b < MAX_MTEX; b++) {
|
for (b = 0; b < MAX_MTEX; b++) {
|
||||||
if (wo->mtex[b] && wo->mtex[b]->tex) {
|
if (wo->mtex[b] && wo->mtex[b]->tex) {
|
||||||
do_single_tex_user(&(wo->mtex[b]->tex));
|
do_single_tex_user(bmain, &(wo->mtex[b]->tex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2059,19 +2059,19 @@ static void single_mat_users_expand(Main *bmain)
|
|||||||
|
|
||||||
for (ob = bmain->object.first; ob; ob = ob->id.next)
|
for (ob = bmain->object.first; ob; ob = ob->id.next)
|
||||||
if (ob->id.tag & LIB_TAG_NEW)
|
if (ob->id.tag & LIB_TAG_NEW)
|
||||||
new_id_matar(ob->mat, ob->totcol);
|
new_id_matar(bmain, ob->mat, ob->totcol);
|
||||||
|
|
||||||
for (me = bmain->mesh.first; me; me = me->id.next)
|
for (me = bmain->mesh.first; me; me = me->id.next)
|
||||||
if (me->id.tag & LIB_TAG_NEW)
|
if (me->id.tag & LIB_TAG_NEW)
|
||||||
new_id_matar(me->mat, me->totcol);
|
new_id_matar(bmain, me->mat, me->totcol);
|
||||||
|
|
||||||
for (cu = bmain->curve.first; cu; cu = cu->id.next)
|
for (cu = bmain->curve.first; cu; cu = cu->id.next)
|
||||||
if (cu->id.tag & LIB_TAG_NEW)
|
if (cu->id.tag & LIB_TAG_NEW)
|
||||||
new_id_matar(cu->mat, cu->totcol);
|
new_id_matar(bmain, cu->mat, cu->totcol);
|
||||||
|
|
||||||
for (mb = bmain->mball.first; mb; mb = mb->id.next)
|
for (mb = bmain->mball.first; mb; mb = mb->id.next)
|
||||||
if (mb->id.tag & LIB_TAG_NEW)
|
if (mb->id.tag & LIB_TAG_NEW)
|
||||||
new_id_matar(mb->mat, mb->totcol);
|
new_id_matar(bmain, mb->mat, mb->totcol);
|
||||||
|
|
||||||
/* material imats */
|
/* material imats */
|
||||||
for (ma = bmain->mat.first; ma; ma = ma->id.next)
|
for (ma = bmain->mat.first; ma; ma = ma->id.next)
|
||||||
@ -2376,7 +2376,7 @@ static int make_single_user_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (RNA_boolean_get(op->ptr, "material")) {
|
if (RNA_boolean_get(op->ptr, "material")) {
|
||||||
single_mat_users(scene, flag, RNA_boolean_get(op->ptr, "texture"));
|
single_mat_users(bmain, scene, flag, RNA_boolean_get(op->ptr, "texture"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* can't do this separate from materials */
|
#if 0 /* can't do this separate from materials */
|
||||||
|
@ -195,7 +195,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
|
|
||||||
/* add or copy particle setting */
|
/* add or copy particle setting */
|
||||||
if (psys->part)
|
if (psys->part)
|
||||||
part= BKE_particlesettings_copy(psys->part);
|
part= BKE_particlesettings_copy(bmain, psys->part);
|
||||||
else
|
else
|
||||||
part= psys_new_settings("ParticleSettings", bmain);
|
part= psys_new_settings("ParticleSettings", bmain);
|
||||||
|
|
||||||
|
@ -464,7 +464,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
|
|
||||||
/* add or copy material */
|
/* add or copy material */
|
||||||
if (ma) {
|
if (ma) {
|
||||||
ma = BKE_material_copy(ma);
|
ma = BKE_material_copy(bmain, ma);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ma = BKE_material_add(bmain, DATA_("Material"));
|
ma = BKE_material_add(bmain, DATA_("Material"));
|
||||||
@ -518,7 +518,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
|
|
||||||
/* add or copy texture */
|
/* add or copy texture */
|
||||||
if (tex) {
|
if (tex) {
|
||||||
tex = BKE_texture_copy(tex);
|
tex = BKE_texture_copy(bmain, tex);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tex = BKE_texture_add(bmain, DATA_("Texture"));
|
tex = BKE_texture_add(bmain, DATA_("Texture"));
|
||||||
@ -576,7 +576,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
|
|
||||||
/* add or copy world */
|
/* add or copy world */
|
||||||
if (wo) {
|
if (wo) {
|
||||||
wo = BKE_world_copy(wo);
|
wo = BKE_world_copy(bmain, wo);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wo = add_world(bmain, DATA_("World"));
|
wo = add_world(bmain, DATA_("World"));
|
||||||
|
@ -3955,7 +3955,7 @@ static int scene_new_exec(bContext *C, wmOperator *op)
|
|||||||
newscene = BKE_scene_add(bmain, DATA_("Scene"));
|
newscene = BKE_scene_add(bmain, DATA_("Scene"));
|
||||||
}
|
}
|
||||||
else { /* different kinds of copying */
|
else { /* different kinds of copying */
|
||||||
newscene = BKE_scene_copy(scene, type);
|
newscene = BKE_scene_copy(bmain, scene, type);
|
||||||
|
|
||||||
/* these can't be handled in blenkernel currently, so do them here */
|
/* these can't be handled in blenkernel currently, so do them here */
|
||||||
if (type == SCE_COPY_LINK_DATA) {
|
if (type == SCE_COPY_LINK_DATA) {
|
||||||
|
@ -69,7 +69,7 @@ static int brush_add_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
PaintMode mode = BKE_paintmode_get_active_from_context(C);
|
PaintMode mode = BKE_paintmode_get_active_from_context(C);
|
||||||
|
|
||||||
if (br)
|
if (br)
|
||||||
br = BKE_brush_copy(br);
|
br = BKE_brush_copy(bmain, br);
|
||||||
else
|
else
|
||||||
br = BKE_brush_add(bmain, "Brush", BKE_paint_object_mode_from_paint_mode(mode));
|
br = BKE_brush_add(bmain, "Brush", BKE_paint_object_mode_from_paint_mode(mode));
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ static bAction *action_create_new(bContext *C, bAction *oldact)
|
|||||||
*/
|
*/
|
||||||
if (oldact && GS(oldact->id.name) == ID_AC) {
|
if (oldact && GS(oldact->id.name) == ID_AC) {
|
||||||
/* make a copy of the existing action */
|
/* make a copy of the existing action */
|
||||||
action = BKE_action_copy(oldact);
|
action = BKE_action_copy(CTX_data_main(C), oldact);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* just make a new (empty) action */
|
/* just make a new (empty) action */
|
||||||
|
@ -1856,6 +1856,7 @@ void NLA_OT_action_sync_length(wmOperatorType *ot)
|
|||||||
|
|
||||||
static int nlaedit_make_single_user_exec(bContext *C, wmOperator *UNUSED(op))
|
static int nlaedit_make_single_user_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
|
Main *bmain = CTX_data_main(C);
|
||||||
bAnimContext ac;
|
bAnimContext ac;
|
||||||
|
|
||||||
ListBase anim_data = {NULL, NULL};
|
ListBase anim_data = {NULL, NULL};
|
||||||
@ -1887,7 +1888,7 @@ static int nlaedit_make_single_user_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
/* multi-user? */
|
/* multi-user? */
|
||||||
if (ID_REAL_USERS(strip->act) > 1) {
|
if (ID_REAL_USERS(strip->act) > 1) {
|
||||||
/* make a new copy of the action for us to use (it will have 1 user already) */
|
/* make a new copy of the action for us to use (it will have 1 user already) */
|
||||||
bAction *new_action = BKE_action_copy(strip->act);
|
bAction *new_action = BKE_action_copy(bmain, strip->act);
|
||||||
|
|
||||||
/* decrement user count of our existing action */
|
/* decrement user count of our existing action */
|
||||||
id_us_min(&strip->act->id);
|
id_us_min(&strip->act->id);
|
||||||
@ -1945,6 +1946,7 @@ static short bezt_apply_nlamapping(KeyframeEditData *ked, BezTriple *bezt)
|
|||||||
|
|
||||||
static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op))
|
static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
|
Main *bmain = CTX_data_main(C);
|
||||||
bAnimContext ac;
|
bAnimContext ac;
|
||||||
|
|
||||||
ListBase anim_data = {NULL, NULL};
|
ListBase anim_data = {NULL, NULL};
|
||||||
@ -1974,7 +1976,7 @@ static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
continue;
|
continue;
|
||||||
if (strip->act->id.us > 1) {
|
if (strip->act->id.us > 1) {
|
||||||
/* make a copy of the Action to work on */
|
/* make a copy of the Action to work on */
|
||||||
bAction *act = BKE_action_copy(strip->act);
|
bAction *act = BKE_action_copy(bmain, strip->act);
|
||||||
|
|
||||||
/* set this as the new referenced action, decrementing the users of the old one */
|
/* set this as the new referenced action, decrementing the users of the old one */
|
||||||
id_us_min(&strip->act->id);
|
id_us_min(&strip->act->id);
|
||||||
|
@ -255,7 +255,7 @@ static int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
|
|||||||
bAction *waction;
|
bAction *waction;
|
||||||
|
|
||||||
/* firstly, wgroup needs to temporary dummy action that can be destroyed, as it shares copies */
|
/* firstly, wgroup needs to temporary dummy action that can be destroyed, as it shares copies */
|
||||||
waction = wgroup->adt->action = BKE_action_copy(wgroup->adt->action);
|
waction = wgroup->adt->action = BKE_action_copy(G.main, wgroup->adt->action);
|
||||||
|
|
||||||
/* now perform the moving */
|
/* now perform the moving */
|
||||||
BKE_animdata_separate_by_basepath(&wgroup->id, &ntree->id, &anim_basepaths);
|
BKE_animdata_separate_by_basepath(&wgroup->id, &ntree->id, &anim_basepaths);
|
||||||
|
@ -277,11 +277,11 @@ StructRNA *rna_PropertyGroup_refine(PointerRNA *ptr)
|
|||||||
return ptr->type;
|
return ptr->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ID *rna_ID_copy(ID *id)
|
static ID *rna_ID_copy(ID *id, Main *bmain)
|
||||||
{
|
{
|
||||||
ID *newid;
|
ID *newid;
|
||||||
|
|
||||||
if (id_copy(id, &newid, false)) {
|
if (id_copy(bmain, id, &newid, false)) {
|
||||||
if (newid) id_us_min(newid);
|
if (newid) id_us_min(newid);
|
||||||
return newid;
|
return newid;
|
||||||
}
|
}
|
||||||
@ -981,6 +981,7 @@ static void rna_def_ID(BlenderRNA *brna)
|
|||||||
/* functions */
|
/* functions */
|
||||||
func = RNA_def_function(srna, "copy", "rna_ID_copy");
|
func = RNA_def_function(srna, "copy", "rna_ID_copy");
|
||||||
RNA_def_function_ui_description(func, "Create a copy of this data-block (not supported for all data-blocks)");
|
RNA_def_function_ui_description(func, "Create a copy of this data-block (not supported for all data-blocks)");
|
||||||
|
RNA_def_function_flag(func, FUNC_USE_MAIN);
|
||||||
parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID");
|
parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID");
|
||||||
RNA_def_function_return(func, parm);
|
RNA_def_function_return(func, parm);
|
||||||
|
|
||||||
|
@ -233,8 +233,8 @@ BL_ArmatureObject::BL_ArmatureObject(
|
|||||||
m_lastapplyframe(0.0)
|
m_lastapplyframe(0.0)
|
||||||
{
|
{
|
||||||
m_origObjArma = armature; // Keep a copy of the original armature so we can fix drivers later
|
m_origObjArma = armature; // Keep a copy of the original armature so we can fix drivers later
|
||||||
m_objArma = BKE_object_copy(armature);
|
m_objArma = BKE_object_copy(G.main, armature);
|
||||||
m_objArma->data = BKE_armature_copy((bArmature *)armature->data);
|
m_objArma->data = BKE_armature_copy(G.main, (bArmature *)armature->data);
|
||||||
// During object replication ob->data is increase, we decrease it now because we get a copy.
|
// During object replication ob->data is increase, we decrease it now because we get a copy.
|
||||||
id_us_min(&((bArmature *)m_origObjArma->data)->id);
|
id_us_min(&((bArmature *)m_origObjArma->data)->id);
|
||||||
m_pose = m_objArma->pose;
|
m_pose = m_objArma->pose;
|
||||||
@ -433,8 +433,8 @@ void BL_ArmatureObject::ProcessReplica()
|
|||||||
KX_GameObject::ProcessReplica();
|
KX_GameObject::ProcessReplica();
|
||||||
|
|
||||||
bArmature* tmp = (bArmature*)m_objArma->data;
|
bArmature* tmp = (bArmature*)m_objArma->data;
|
||||||
m_objArma = BKE_object_copy(m_objArma);
|
m_objArma = BKE_object_copy(G.main, m_objArma);
|
||||||
m_objArma->data = BKE_armature_copy(tmp);
|
m_objArma->data = BKE_armature_copy(G.main, tmp);
|
||||||
m_pose = m_objArma->pose;
|
m_pose = m_objArma->pose;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ BL_ShapeDeformer::BL_ShapeDeformer(BL_DeformableGameObject *gameobj,
|
|||||||
m_useShapeDrivers(false),
|
m_useShapeDrivers(false),
|
||||||
m_lastShapeUpdate(-1)
|
m_lastShapeUpdate(-1)
|
||||||
{
|
{
|
||||||
m_key = m_bmesh->key ? BKE_key_copy(m_bmesh->key) : NULL;
|
m_key = m_bmesh->key ? BKE_key_copy(G.main, m_bmesh->key) : NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* this second constructor is needed for making a mesh deformable on the fly. */
|
/* this second constructor is needed for making a mesh deformable on the fly. */
|
||||||
@ -91,7 +91,7 @@ BL_ShapeDeformer::BL_ShapeDeformer(BL_DeformableGameObject *gameobj,
|
|||||||
m_useShapeDrivers(false),
|
m_useShapeDrivers(false),
|
||||||
m_lastShapeUpdate(-1)
|
m_lastShapeUpdate(-1)
|
||||||
{
|
{
|
||||||
m_key = m_bmesh->key ? BKE_key_copy(m_bmesh->key) : NULL;
|
m_key = m_bmesh->key ? BKE_key_copy(G.main, m_bmesh->key) : NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
BL_ShapeDeformer::~BL_ShapeDeformer()
|
BL_ShapeDeformer::~BL_ShapeDeformer()
|
||||||
@ -117,7 +117,7 @@ void BL_ShapeDeformer::ProcessReplica()
|
|||||||
BL_SkinDeformer::ProcessReplica();
|
BL_SkinDeformer::ProcessReplica();
|
||||||
m_lastShapeUpdate = -1;
|
m_lastShapeUpdate = -1;
|
||||||
|
|
||||||
m_key = m_key ? BKE_key_copy(m_key) : NULL;
|
m_key = m_key ? BKE_key_copy(G.main, m_key) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BL_ShapeDeformer::LoadShapeDrivers(KX_GameObject* parent)
|
bool BL_ShapeDeformer::LoadShapeDrivers(KX_GameObject* parent)
|
||||||
|
@ -1425,7 +1425,7 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene *kx_scene,
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Mesh has a user \"%s\"\n", name);
|
printf("Mesh has a user \"%s\"\n", name);
|
||||||
#endif
|
#endif
|
||||||
me = (ID*)BKE_mesh_copy_ex(from_maggie, (Mesh*)me);
|
me = (ID*)BKE_mesh_copy(from_maggie, (Mesh*)me);
|
||||||
id_us_min(me);
|
id_us_min(me);
|
||||||
}
|
}
|
||||||
BLI_remlink(&from_maggie->mesh, me); /* even if we made the copy it needs to be removed */
|
BLI_remlink(&from_maggie->mesh, me); /* even if we made the copy it needs to be removed */
|
||||||
@ -1447,12 +1447,12 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene *kx_scene,
|
|||||||
/* if its tagged its a replaced material */
|
/* if its tagged its a replaced material */
|
||||||
if (mat_old && (mat_old->id.tag & LIB_TAG_DOIT) == 0) {
|
if (mat_old && (mat_old->id.tag & LIB_TAG_DOIT) == 0) {
|
||||||
Material *mat_old = mesh->mat[i];
|
Material *mat_old = mesh->mat[i];
|
||||||
Material *mat_new = BKE_material_copy(mat_old);
|
Material *mat_new = BKE_material_copy(from_maggie, mat_old);
|
||||||
|
|
||||||
mat_new->id.tag |= LIB_TAG_DOIT;
|
mat_new->id.tag |= LIB_TAG_DOIT;
|
||||||
id_us_min(&mat_old->id);
|
id_us_min(&mat_old->id);
|
||||||
|
|
||||||
BLI_remlink(&G.main->mat, mat_new); // BKE_material_copy uses G.main, and there is no BKE_material_copy_ex
|
BLI_remlink(&from_maggie->mat, mat_new); // BKE_material_copy uses G.main, and there is no BKE_material_copy_ex
|
||||||
BLI_addtail(&maggie->mat, mat_new);
|
BLI_addtail(&maggie->mat, mat_new);
|
||||||
|
|
||||||
mesh->mat[i] = mat_new;
|
mesh->mat[i] = mat_new;
|
||||||
|
@ -161,7 +161,7 @@ bool BL_Action::Play(const char* name,
|
|||||||
BKE_libblock_free(G.main, m_tmpaction);
|
BKE_libblock_free(G.main, m_tmpaction);
|
||||||
m_tmpaction = NULL;
|
m_tmpaction = NULL;
|
||||||
}
|
}
|
||||||
m_tmpaction = BKE_action_copy(m_action);
|
m_tmpaction = BKE_action_copy(G.main, m_action);
|
||||||
|
|
||||||
// First get rid of any old controllers
|
// First get rid of any old controllers
|
||||||
ClearControllerList();
|
ClearControllerList();
|
||||||
|
Loading…
Reference in New Issue
Block a user