Commit: 1f3b5532936032d42091a4aad4435a42c6cc5384
Author: Lukas Tönne
Date:   Wed Jan 28 18:50:28 2015 +0100
Branches: strand_editmode
https://developer.blender.org/rB1f3b5532936032d42091a4aad4435a42c6cc5384

Merge branch 'gooseberry' into strand_editmode

Conflicts:
        source/blender/blenkernel/CMakeLists.txt
        source/blender/blenkernel/intern/customdata.c
        source/blender/blenkernel/intern/particle.c
        source/blender/blenloader/intern/readfile.c
        source/blender/editors/physics/particle_edit.c
        source/blender/editors/space_view3d/drawobject.c
        source/blender/makesdna/DNA_brush_types.h
        source/blender/makesdna/DNA_customdata_types.h
        source/blender/physics/intern/implicit.h

===================================================================



===================================================================

diff --cc source/blender/blenkernel/BKE_editstrands.h
index d8b822d,0000000..017cdf9
mode 100644,000000..100644
--- a/source/blender/blenkernel/BKE_editstrands.h
+++ b/source/blender/blenkernel/BKE_editstrands.h
@@@ -1,95 -1,0 +1,93 @@@
 +/*
 + * ***** BEGIN GPL LICENSE BLOCK *****
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
 + * as published by the Free Software Foundation; either version 2
 + * of the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software Foundation,
 + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 + *
 + * The Original Code is Copyright (C) Blender Foundation
 + * All rights reserved.
 + *
 + * The Original Code is: all of this file.
 + *
 + * Contributor(s): Lukas Toenne
 + *
 + * ***** END GPL LICENSE BLOCK *****
 + */
 +
 +#ifndef __BKE_EDITSTRANDS_H__
 +#define __BKE_EDITSTRANDS_H__
 +
 +/** \file blender/blenkernel/BKE_editstrands.h
 + *  \ingroup bke
 + */
 +
 +#include "BLI_utildefines.h"
 +
 +#include "DNA_customdata_types.h"
 +
 +#include "BKE_customdata.h"
 +#include "bmesh.h"
 +
 +struct BMesh;
 +struct DerivedMesh;
 +struct Object;
 +
 +typedef struct BMEditStrands {
 +      struct BMesh *bm;
 +      
 +      /*this is for undoing failed operations*/
 +      struct BMEditStrands *emcopy;
 +      int emcopyusers;
 +      
 +      /* Object this editmesh came from (if it came from one) */
 +      struct Object *ob;
 +      struct DerivedMesh *root_dm;
 +      
 +      int flag;
 +      
 +      unsigned int vertex_glbuf;
 +      unsigned int elem_glbuf;
 +      unsigned int dot_glbuf;
-       
-       struct SimDebugData *debug_data;
 +} BMEditStrands;
 +
 +/* BMEditStrands->flag */
 +typedef enum BMEditStrandsFlag {
 +      BM_STRANDS_DIRTY_SEGLEN     = 1,
 +} BMEditStrandsFlag;
 +
 +struct BMEditStrands *BKE_editstrands_create(struct BMesh *bm, struct 
DerivedMesh *root_dm);
 +struct BMEditStrands *BKE_editstrands_copy(struct BMEditStrands *es);
 +struct BMEditStrands *BKE_editstrands_from_object(struct Object *ob);
 +void BKE_editstrands_update_linked_customdata(struct BMEditStrands *es);
 +void BKE_editstrands_free(struct BMEditStrands *es);
 +
 +/* === constraints === */
 +
 +/* Stores vertex locations for temporary reference:
 + * Vertex locations get modified by tools, but then need to be corrected
 + * by calculating a smooth solution based on the difference to original 
pre-tool locations.
 + */
 +typedef float (*BMEditStrandsLocations)[3];
 +BMEditStrandsLocations BKE_editstrands_get_locations(struct BMEditStrands 
*edit);
 +void BKE_editstrands_free_locations(BMEditStrandsLocations locs);
 +
 +void BKE_editstrands_solve_constraints(struct Object *ob, struct 
BMEditStrands *es, BMEditStrandsLocations orig);
 +void BKE_editstrands_ensure(struct BMEditStrands *es);
 +
 +/* === particle conversion === */
 +
 +struct BMesh *BKE_particles_to_bmesh(struct Object *ob, struct ParticleSystem 
*psys);
 +void BKE_particles_from_bmesh(struct Object *ob, struct ParticleSystem *psys);
 +
 +#endif
diff --cc source/blender/blenkernel/CMakeLists.txt
index 0cb2acf,a943ad6..434eb70
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@@ -93,8 -94,8 +94,9 @@@ set(SR
        intern/editderivedmesh.c
        intern/editmesh.c
        intern/editmesh_bvh.c
 +      intern/editstrands.c
        intern/effect.c
+       intern/facemap.c
        intern/fcurve.c
        intern/fluidsim.c
        intern/fmodifier.c
@@@ -122,7 -123,7 +124,8 @@@
        intern/mesh.c
        intern/mesh_evaluate.c
        intern/mesh_mapping.c
+       intern/mesh_remap.c
 +      intern/mesh_sample.c
        intern/mesh_validate.c
        intern/modifier.c
        intern/modifiers_bmesh.c
@@@ -208,8 -211,8 +213,9 @@@
        BKE_depsgraph.h
        BKE_displist.h
        BKE_dynamicpaint.h
 +      BKE_editstrands.h
        BKE_effect.h
+       BKE_facemap.h
        BKE_fcurve.h
        BKE_fluidsim.h
        BKE_font.h
@@@ -234,7 -237,7 +240,8 @@@
        BKE_mball.h
        BKE_mesh.h
        BKE_mesh_mapping.h
+       BKE_mesh_remap.h
 +      BKE_mesh_sample.h
        BKE_modifier.h
        BKE_movieclip.h
        BKE_multires.h
diff --cc source/blender/blenkernel/intern/customdata.c
index d1e6163,15e1492..99bd42d
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@@ -54,9 -55,10 +55,11 @@@
  
  #include "BKE_customdata.h"
  #include "BKE_customdata_file.h"
 +#include "BKE_editstrands.h"
  #include "BKE_global.h"
  #include "BKE_main.h"
+ #include "BKE_mesh_mapping.h"
+ #include "BKE_mesh_remap.h"
  #include "BKE_multires.h"
  
  #include "bmesh.h"
@@@ -1217,10 -1265,8 +1266,10 @@@ static const LayerTypeInfo LAYERTYPEINF
        {sizeof(float[4]), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
        /* 40: CD_TESSLOOPNORMAL */
        {sizeof(short[4][3]), "", 0, NULL, NULL, NULL, NULL, layerSwap_flnor, 
NULL},
-       /* 41: CD_MASK_FACEMAP */
-       {sizeof(int), "", 1, NULL, NULL, NULL, NULL, NULL, layerDefault_fmap, 
NULL},
+       /* 41: CD_FACEMAP */
+       {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, layerDefault_fmap, 
NULL},
 +      /* 42: CD_MESH_SAMPLE */
 +      {sizeof(MSurfaceSample), "MSurfaceSample", 1, NULL, NULL, NULL, NULL, 
NULL, NULL},
  };
  
  /* note, numbers are from trunk and need updating for bmesh */
diff --cc source/blender/blenkernel/intern/editstrands.c
index 777c8bd,0000000..5dc0402
mode 100644,000000..100644
--- a/source/blender/blenkernel/intern/editstrands.c
+++ b/source/blender/blenkernel/intern/editstrands.c
@@@ -1,207 -1,0 +1,204 @@@
 +/*
 + * ***** BEGIN GPL LICENSE BLOCK *****
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
 + * as published by the Free Software Foundation; either version 2
 + * of the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software Foundation,
 + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 + *
 + * The Original Code is Copyright (C) Blender Foundation
 + * All rights reserved.
 + *
 + * The Original Code is: all of this file.
 + *
 + * Contributor(s): Lukas Toenne
 + *
 + * ***** END GPL LICENSE BLOCK *****
 + */
 +
 +/** \file blender/blenkernel/intern/editstrands.c
 + *  \ingroup bke
 + */
 +
 +#include "MEM_guardedalloc.h"
 +
 +#include "BLI_math.h"
 +#include "BLI_mempool.h"
 +
 +#include "DNA_customdata_types.h"
 +#include "DNA_modifier_types.h"
 +#include "DNA_object_types.h"
 +#include "DNA_particle_types.h"
 +
 +#include "BKE_bvhutils.h"
 +#include "BKE_customdata.h"
 +#include "BKE_cdderivedmesh.h"
 +#include "BKE_DerivedMesh.h"
 +#include "BKE_editstrands.h"
 +#include "BKE_effect.h"
 +#include "BKE_mesh_sample.h"
 +#include "BKE_particle.h"
 +
 +#include "BPH_strands.h"
 +
 +#include "intern/bmesh_strands_conv.h"
 +
 +BMEditStrands *BKE_editstrands_create(BMesh *bm, DerivedMesh *root_dm)
 +{
 +      BMEditStrands *es = MEM_callocN(sizeof(BMEditStrands), __func__);
 +      
 +      es->bm = bm;
 +      es->root_dm = CDDM_copy(root_dm);
 +      
 +      return es;
 +}
 +
 +BMEditStrands *BKE_editstrands_copy(BMEditStrands *es)
 +{
 +      BMEditStrands *es_copy = MEM_callocN(sizeof(BMEditStrands), __func__);
 +      *es_copy = *es;
 +      
 +      es_copy->bm = BM_mesh_copy(es->bm);
 +      es_copy->root_dm = CDDM_copy(es->root_dm);
-       es_copy->debug_data = NULL;
 +      
 +      return es_copy;
 +}
 +
 +/**
 + * \brief Return the BMEditStrands for a given object
 + */
 +BMEditStrands *BKE_editstrands_from_object(Object *ob)
 +{
 +      ParticleSystem *psys = psys_get_current(ob);
 +      if (psys) {
 +              return psys->hairedit;
 +      }
 +      return NULL;
 +}
 +
 +void BKE_editstrands_update_linked_customdata(BMEditStrands *es)
 +{
 +      BMesh *bm = es->bm;
 +      
 +      /* this is done for BMEditMesh, but should never exist for strands */
 +      BLI_assert(!CustomData_has_layer(&bm->pdata, CD_MTEXPOLY));
 +}
 +
 +/*does not free the BMEditStrands struct itself*/
 +void BKE_editstrands_free(BMEditStrands *es)
 +{
 +      if (es->bm)
 +              BM_mesh_free(es->bm);
 +      if (es->root_dm)
 +              es->root_dm->release(es->root_dm);
-       if (es->debug_data)
-               BKE_sim_debug_data_free(es->debug_data);
 +}
 +
 +/* === constraints === */
 +
 +BMEditStrandsLocations BKE_editstrands_get_locations(BMEditStrands *edit)
 +{
 +      BMesh *bm = edit->bm;
 +      BMEditStrandsLocations locs = MEM_mallocN(3*sizeof(float) * 
bm->totvert, "editstrands locations");
 +      
 +      BMVert *v;
 +      BMIter iter;
 +      int i;
 +      
 +      BM_ITER_MESH_INDEX(v, &iter, bm, BM_VERTS_OF_MESH, i) {
 +              copy_v3_v3(locs[i], v->co);
 +      }
 +      
 +      return locs;
 +}
 +
 +void BKE_editstrands_free_locations(BMEditStrandsLocations locs)
 +{
 +      MEM_freeN(locs);
 +}
 +
 +void BKE_editstrands_solve_constraints(Object *ob, BMEditStrands *es, 
BMEditStrandsLocations orig)
 +{
 +      BKE_editstrands_ensure(es);
 +      
 +      BPH_strands_solve_constraints(ob, es, orig);
 +}
 +
 +static void editstrands_calc_segment_lengths(BMesh *bm)
 +{
 +      BMVert *root, *v, *vprev;
 +      BMIter iter, iter_strand;
 +      int k;
 +      
 +      BM_ITER_STRANDS(root, &iter, bm, BM_STRANDS_OF_MESH) {
 +              BM_ITER_STRANDS_ELEM_INDEX(v, &iter_strand, root, 
BM_VERTS_OF_STRAND, k) {
 +                      if (k > 0) {
 +                              float length = len_v3v3(v->co, vprev->co);
 +                              BM_elem_float_data_named_set(&bm->vdata, v, 
CD_PROP_FLT, CD_HAIR_SEGMENT_LENGTH, length);
 +                      }
 +                      vprev = v;
 +              }
 +      }
 +}
 +
 +void BKE_editstrands_ensure(BMEditStrands *es)
 +{
 +      BM_strands_cd_flag_ensure(es->bm, 0);
 +      
 +      if (es->flag & BM_STRANDS_DIRTY_SEGLEN) {
 +              editstrands_calc_segment_lengths(es->bm);
 +              
 +              es->flag &= ~BM_STRANDS_DIRTY_SEGLEN;
 +      }
 +}
 +
 +
 +/* === particle conversion === */
 +
 +BMesh *BKE_particles_to_bmesh(Object *ob, ParticleSystem *

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to