[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20779] branches/soc-2009-kazanbas/source/ blender: - added copy_mesh_data C function which, unlike copy_mesh, copies data
Arystan Dyussenov
arystan.d at gmail.com
Wed Jun 10 11:59:19 CEST 2009
LOL, forgot to specify --username again!
On Wed, Jun 10, 2009 at 3:56 PM, Chingiz Dyussenov <chingiz.ds at gmail.com>wrote:
> Revision: 20779
>
> http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20779
> Author: chingachgook
> Date: 2009-06-10 11:56:22 +0200 (Wed, 10 Jun 2009)
>
> Log Message:
> -----------
> - added copy_mesh_data C function which, unlike copy_mesh, copies data
> between two existing meshes.
> - API's Mesh.copy reflects copy_mesh_data.
>
> Modified Paths:
> --------------
> branches/soc-2009-kazanbas/source/blender/editors/mesh/editmesh.c
> branches/soc-2009-kazanbas/source/blender/makesrna/intern/rna_internal.h
> branches/soc-2009-kazanbas/source/blender/makesrna/intern/rna_mesh.c
>
> Modified: branches/soc-2009-kazanbas/source/blender/editors/mesh/editmesh.c
> ===================================================================
> --- branches/soc-2009-kazanbas/source/blender/editors/mesh/editmesh.c
> 2009-06-10 09:47:30 UTC (rev 20778)
> +++ branches/soc-2009-kazanbas/source/blender/editors/mesh/editmesh.c
> 2009-06-10 09:56:22 UTC (rev 20779)
> @@ -2029,17 +2029,64 @@
> }
>
> /* Python API */
> +void copy_mesh_data(Mesh *dest, Mesh *src);
> +
> Mesh *RNA_api_add_mesh(Main *main, char *name)
> {
> return add_mesh(name);
> }
>
> -Mesh *RNA_api_mesh_copy(Mesh *me)
> +void RNA_api_mesh_copy(Mesh *me, Mesh *from)
> {
> - return copy_mesh(me);
> + copy_mesh_data(me, from);
> }
>
> +void RNA_api_mesh_copy_transformed()
> +{
> +}
> +
> /*
> + * This version of copy_mesh doesn't allocate a new mesh,
> + * instead it copies data between two existing meshes.
> + */
> +void copy_mesh_data(Mesh *dest, Mesh *src)
> +{
> + int totvert, totedge, totface;
> + int has_layer;
> +
> + CustomData_free(&dest->vdata, dest->totvert);
> + CustomData_free(&dest->edata, dest->totedge);
> + CustomData_free(&dest->fdata, dest->totface);
> +
> + memset(&dest->vdata, 0, sizeof(dest->vdata));
> + memset(&dest->edata, 0, sizeof(dest->edata));
> + memset(&dest->fdata, 0, sizeof(dest->fdata));
> +
> + totvert = dest->totvert = src->totvert;
> + totedge = dest->totedge = src->totedge;
> + totface = dest->totface = src->totface;
> +
> + CustomData_copy(&src->vdata, &dest->vdata, CD_MASK_MESH,
> CD_DUPLICATE, totvert);
> + CustomData_copy(&src->edata, &dest->edata, CD_MASK_MESH,
> CD_DUPLICATE, totedge);
> + CustomData_copy(&src->fdata, &dest->fdata, CD_MASK_MESH,
> CD_DUPLICATE, totface);
> +
> + CustomData_has_layer(&dest->vdata, CD_MVERT);
> +
> + CustomData_add_layer(&dest->vdata, CD_MVERT, CD_ASSIGN, src->mvert,
> totvert);
> + CustomData_add_layer(&dest->edata, CD_MEDGE, CD_ASSIGN, src->medge,
> totedge);
> + CustomData_add_layer(&dest->fdata, CD_MFACE, CD_ASSIGN, src->mface,
> totface);
> +
> + mesh_update_customdata_pointers(dest);
> +}
> +
> +/*
> +void RNA_api_mesh_apply_transform(Mesh *me)
> +{
> +
> +}
> +*/
> +
> +/*
> void RNA_api_mesh_copy_(Mesh *me, Object *ob, int apply_transform)
> {
> if (ob->type != OB_MESH) {
>
> Modified:
> branches/soc-2009-kazanbas/source/blender/makesrna/intern/rna_internal.h
> ===================================================================
> ---
> branches/soc-2009-kazanbas/source/blender/makesrna/intern/rna_internal.h
> 2009-06-10 09:47:30 UTC (rev 20778)
> +++
> branches/soc-2009-kazanbas/source/blender/makesrna/intern/rna_internal.h
> 2009-06-10 09:56:22 UTC (rev 20779)
> @@ -190,7 +190,7 @@
>
> void RNA_api_ui_layout(struct StructRNA *srna);
> struct Mesh *RNA_api_add_mesh(struct Main *main, char *name);
> -struct Mesh *RNA_api_mesh_copy(struct Mesh *me);
> +void RNA_api_mesh_copy(struct Mesh *me, struct Mesh *from);
>
> /* ID Properties */
>
>
> Modified:
> branches/soc-2009-kazanbas/source/blender/makesrna/intern/rna_mesh.c
> ===================================================================
> --- branches/soc-2009-kazanbas/source/blender/makesrna/intern/rna_mesh.c
> 2009-06-10 09:47:30 UTC (rev 20778)
> +++ branches/soc-2009-kazanbas/source/blender/makesrna/intern/rna_mesh.c
> 2009-06-10 09:56:22 UTC (rev 20779)
> @@ -1129,9 +1129,13 @@
> rna_def_texmat_common(srna, "rna_Mesh_texspace_editable");
>
> func= RNA_def_function(srna, "copy", "RNA_api_mesh_copy");
> - RNA_def_function_ui_description(func, "Create a copy of this
> mesh.");
> + RNA_def_function_ui_description(func, "Copy mesh data.");
> + prop= RNA_def_pointer(func, "src", "Mesh", "", "A mesh to copy data
> from.");
> + RNA_def_property_flag(prop, PROP_REQUIRED);
> + /*
> prop= RNA_def_pointer(func, "mesh", "Mesh", "", "A new mesh.");
> RNA_def_function_return(func, prop);
> + */
> }
>
> void RNA_def_mesh(BlenderRNA *brna)
>
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
More information about the Bf-committers
mailing list