Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt1
-rw-r--r--source/blender/makesrna/intern/SConscript2
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c1620
-rw-r--r--source/blender/makesrna/intern/rna_mesh_api.c17
-rw-r--r--source/blender/makesrna/intern/rna_mesh_utils.h105
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c42
-rw-r--r--source/blender/makesrna/intern/rna_object.c9
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_scene.c10
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c2
10 files changed, 1203 insertions, 607 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 5bbdac646a7..2782aa8aca5 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -240,6 +240,7 @@ blender_include_dirs(
../../blenkernel
../../blenloader
../../blenlib
+ ../../bmesh
../../blenfont
../../gpu
../../imbuf
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript
index 26fa793de9d..60818680d0c 100644
--- a/source/blender/makesrna/intern/SConscript
+++ b/source/blender/makesrna/intern/SConscript
@@ -32,7 +32,7 @@ defs = []
incs = '#/intern/guardedalloc ../../blenlib ../../blenkernel ../../blenloader'
incs += ' ../../imbuf ../../makesdna ../../makesrna ../../ikplugin'
incs += ' ../../windowmanager ../../editors/include ../../blenfont'
-incs += ' ../../render/extern/include'
+incs += ' ../../render/extern/include ../../bmesh'
incs += ' #/intern/audaspace/intern #/intern/cycles/blender'
incs += ' #/extern/glew/include '
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 689b19b9371..c75cdf525b0 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1,4 +1,4 @@
-/*
+/**
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -8,7 +8,7 @@
*
* 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
+ * 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
@@ -20,6 +20,10 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/*note: the original vertex color stuff is now just used for
+ getting info on the layers themselves, accessing the data is
+ done through the (not yet written) mpoly interfaces.*/
+
/** \file blender/makesrna/intern/rna_mesh.c
* \ingroup RNA
*/
@@ -27,7 +31,10 @@
#include <stdlib.h>
+#include "MEM_guardedalloc.h"
+
#include "RNA_define.h"
+#include "RNA_types.h"
#include "rna_internal.h"
@@ -38,6 +45,7 @@
#include "WM_types.h"
+#include "BLI_array.h"
#include "BLI_math_base.h"
#include "BLI_math_rotation.h"
@@ -52,14 +60,55 @@
#include "BKE_depsgraph.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
-
+#include "BKE_tessmesh.h"
#include "ED_mesh.h" /* XXX Bad level call */
#include "WM_api.h"
#include "WM_types.h"
-static void rna_Mesh_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+#include "rna_mesh_utils.h"
+
+static Mesh *rna_mesh(PointerRNA *ptr)
+{
+ Mesh *me = (Mesh *)ptr->id.data;
+ return me;
+}
+
+static CustomData *rna_mesh_pdata_helper(Mesh *me)
+{
+ return (me->edit_btmesh) ? &me->edit_btmesh->bm->pdata : &me->pdata;
+}
+
+static CustomData *rna_mesh_ldata_helper(Mesh *me)
+{
+ return (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata;
+}
+
+static CustomData *rna_mesh_fdata_helper(Mesh *me)
+{
+ return (me->edit_btmesh) ? NULL : &me->fdata;
+}
+
+static CustomData *rna_mesh_pdata(PointerRNA *ptr)
+{
+ Mesh *me = rna_mesh(ptr);
+ return rna_mesh_pdata_helper(me);
+}
+
+static CustomData *rna_mesh_ldata(PointerRNA *ptr)
+{
+ Mesh *me = rna_mesh(ptr);
+ return rna_mesh_ldata_helper(me);
+}
+
+static CustomData *rna_mesh_fdata(PointerRNA *ptr)
+{
+ Mesh *me = rna_mesh(ptr);
+ return rna_mesh_fdata_helper(me);
+}
+
+static void rna_Mesh_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ID *id= ptr->id.data;
@@ -70,7 +119,7 @@ static void rna_Mesh_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), Poin
}
}
-static void rna_Mesh_update_select(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_Mesh_update_select(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ID *id= ptr->id.data;
/* cheating way for importers to avoid slow updates */
@@ -79,7 +128,7 @@ static void rna_Mesh_update_select(Main *UNUSED(bmain), Scene *UNUSED(scene), Po
}
}
-void rna_Mesh_update_draw(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+void rna_Mesh_update_draw(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ID *id= ptr->id.data;
/* cheating way for importers to avoid slow updates */
@@ -158,21 +207,37 @@ static void rna_MEdge_crease_set(PointerRNA *ptr, float value)
medge->crease= (char)(CLAMPIS(value*255.0f, 0, 255));
}
+static void rna_MeshPolygon_normal_get(PointerRNA *ptr, float *values)
+{
+ Mesh *me = rna_mesh(ptr);
+ MPoly *mp= (MPoly*)ptr->data;
+
+ /* BMESH_TODO: might be faster to look for a CD_NORMALS layer and use that */
+ mesh_calc_poly_normal(mp, me->mloop+mp->loopstart, me->mvert, values);
+}
+
+static float rna_MeshPolygon_area_get(PointerRNA *ptr)
+{
+ Mesh *me = (Mesh*)ptr->id.data;
+ MPoly *mp = (MPoly*)ptr->data;
+
+ return mesh_calc_poly_area(mp, me->mloop+mp->loopstart, me->mvert, NULL);
+}
+
static void rna_MeshFace_normal_get(PointerRNA *ptr, float *values)
{
- Mesh *me= (Mesh*)ptr->id.data;
+ Mesh *me = rna_mesh(ptr);
MFace *mface= (MFace*)ptr->data;
-
+
if(mface->v4)
- normal_quad_v3(values,me->mvert[mface->v1].co, me->mvert[mface->v2].co,
- me->mvert[mface->v3].co, me->mvert[mface->v4].co);
+ normal_quad_v3( values,me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co, me->mvert[mface->v4].co);
else
normal_tri_v3( values,me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co);
}
static float rna_MeshFace_area_get(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
+ Mesh *me = rna_mesh(ptr);
MFace *mface= (MFace*)ptr->data;
if(mface->v4)
@@ -181,6 +246,112 @@ static float rna_MeshFace_area_get(PointerRNA *ptr)
return area_tri_v3(me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co);
}
+static void rna_MeshTextureFace_uv1_get(PointerRNA *ptr, float *values)
+{
+ MTFace *mtface= (MTFace*)ptr->data;
+
+ values[0]= mtface->uv[0][0];
+ values[1]= mtface->uv[0][1];
+}
+
+static void rna_MeshTextureFace_uv1_set(PointerRNA *ptr, const float *values)
+{
+ MTFace *mtface= (MTFace*)ptr->data;
+
+ mtface->uv[0][0]= values[0];
+ mtface->uv[0][1]= values[1];
+}
+
+static void rna_MeshTextureFace_uv2_get(PointerRNA *ptr, float *values)
+{
+ MTFace *mtface= (MTFace*)ptr->data;
+
+ values[0]= mtface->uv[1][0];
+ values[1]= mtface->uv[1][1];
+}
+
+static void rna_MeshTextureFace_uv2_set(PointerRNA *ptr, const float *values)
+{
+ MTFace *mtface= (MTFace*)ptr->data;
+
+ mtface->uv[1][0]= values[0];
+ mtface->uv[1][1]= values[1];
+}
+
+static void rna_MeshTextureFace_uv3_get(PointerRNA *ptr, float *values)
+{
+ MTFace *mtface= (MTFace*)ptr->data;
+
+ values[0]= mtface->uv[2][0];
+ values[1]= mtface->uv[2][1];
+}
+
+static void rna_MeshTextureFace_uv3_set(PointerRNA *ptr, const float *values)
+{
+ MTFace *mtface= (MTFace*)ptr->data;
+
+ mtface->uv[2][0]= values[0];
+ mtface->uv[2][1]= values[1];
+}
+
+static void rna_MeshTextureFace_uv4_get(PointerRNA *ptr, float *values)
+{
+ MTFace *mtface= (MTFace*)ptr->data;
+
+ values[0]= mtface->uv[3][0];
+ values[1]= mtface->uv[3][1];
+}
+
+static void rna_MeshTextureFace_uv4_set(PointerRNA *ptr, const float *values)
+{
+ MTFace *mtface= (MTFace*)ptr->data;
+
+ mtface->uv[3][0]= values[0];
+ mtface->uv[3][1]= values[1];
+}
+
+static int rna_CustomDataData_numverts(PointerRNA *ptr, int type)
+{
+ Mesh *me = rna_mesh(ptr);
+ CustomData *fdata = rna_mesh_fdata(ptr);
+ CustomDataLayer *cdl;
+ int a, b;
+
+ for (cdl = fdata->layers, a = 0; a < fdata->totlayer; cdl++, a++) {
+ if(cdl->type == type) {
+ b = ((char *)ptr->data - ((char*)cdl->data)) / CustomData_sizeof(type);
+ if(b >= 0 && b < me->totface) {
+ return (me->mface[b].v4 ? 4 : 3);
+ }
+ }
+ }
+
+ return 0;
+}
+
+static int rna_MeshTextureFace_uv_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+{
+ length[0]= rna_CustomDataData_numverts(ptr, CD_MTFACE);
+ length[1]= 2;
+ return length[0]*length[1];
+}
+
+static void rna_MeshTextureFace_uv_get(PointerRNA *ptr, float *values)
+{
+ MTFace *mtface= (MTFace*)ptr->data;
+ int totvert= rna_CustomDataData_numverts(ptr, CD_MTFACE);
+
+ memcpy(values, mtface->uv, totvert * 2 * sizeof(float));
+}
+
+static void rna_MeshTextureFace_uv_set(PointerRNA *ptr, const float *values)
+{
+ MTFace *mtface= (MTFace*)ptr->data;
+ int totvert= rna_CustomDataData_numverts(ptr, CD_MTFACE);
+
+ memcpy(mtface->uv, values, totvert * 2 * sizeof(float));
+}
+
/* notice red and blue are swapped */
static void rna_MeshColor_color1_get(PointerRNA *ptr, float *values)
{
@@ -254,58 +425,33 @@ static void rna_MeshColor_color4_set(PointerRNA *ptr, const float *values)
(&mcol[3].r)[0]= (char)(CLAMPIS(values[2]*255.0f, 0, 255));
}
-static void rna_Mesh_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_MeshLoopColor_color_get(PointerRNA *ptr, float *values)
{
- Mesh *me= (Mesh*)ptr->data;
-
- if (me->texflag & AUTOSPACE)
- tex_space_mesh(me);
-}
+ MLoopCol *mcol= (MLoopCol *)ptr->data;
-
-static int rna_Mesh_texspace_editable(PointerRNA *ptr)
-{
- Mesh *me= (Mesh*)ptr->data;
- return (me->texflag & AUTOSPACE)? 0: PROP_EDITABLE;
+ values[2]= (&mcol->r)[0]/255.0f;
+ values[1]= (&mcol->r)[1]/255.0f;
+ values[0]= (&mcol->r)[2]/255.0f;
}
-static void rna_Mesh_texspace_loc_get(PointerRNA *ptr, float *values)
+static void rna_MeshLoopColor_color_set(PointerRNA *ptr, const float *values)
{
- Mesh *me= (Mesh *)ptr->data;
-
- if (!me->bb)
- tex_space_mesh(me);
-
- copy_v3_v3(values, me->loc);
-}
+ MLoopCol *mcol= (MLoopCol *)ptr->data;
-static void rna_Mesh_texspace_loc_set(PointerRNA *ptr, const float *values)
-{
- Mesh *me= (Mesh *)ptr->data;
-
- copy_v3_v3(me->loc, values);
-}
-
-static void rna_Mesh_texspace_size_get(PointerRNA *ptr, float *values)
-{
- Mesh *me= (Mesh *)ptr->data;
-
- if (!me->bb)
- tex_space_mesh(me);
-
- copy_v3_v3(values, me->size);
+ (&mcol->r)[2]= (char)(CLAMPIS(values[0]*255.0f, 0, 255));
+ (&mcol->r)[1]= (char)(CLAMPIS(values[1]*255.0f, 0, 255));
+ (&mcol->r)[0]= (char)(CLAMPIS(values[2]*255.0f, 0, 255));
}
-static void rna_Mesh_texspace_size_set(PointerRNA *ptr, const float *values)
+static int rna_Mesh_texspace_editable(PointerRNA *ptr)
{
- Mesh *me= (Mesh *)ptr->data;
-
- copy_v3_v3(me->size, values);
+ Mesh *me= (Mesh*)ptr->data;
+ return (me->texflag & AUTOSPACE)? 0: PROP_EDITABLE;
}
static void rna_MeshVertex_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
+ Mesh *me = rna_mesh(ptr);
if(me->dvert) {
MVert *mvert= (MVert*)ptr->data;
@@ -319,524 +465,293 @@ static void rna_MeshVertex_groups_begin(CollectionPropertyIterator *iter, Pointe
static void rna_MeshFace_material_index_range(PointerRNA *ptr, int *min, int *max)
{
- Mesh *me= (Mesh*)ptr->id.data;
+ Mesh *me = rna_mesh(ptr);
*min= 0;
*max= me->totcol-1;
*max= MAX2(0, *max);
}
-static CustomData *rna_mesh_fdata(Mesh *me)
-{
- return (me->edit_mesh)? &me->edit_mesh->fdata: &me->fdata;
-}
-
-static int rna_CustomDataLayer_length(PointerRNA *ptr, int type)
-{
- Mesh *me= (Mesh*)ptr->id.data;
- CustomData *fdata= rna_mesh_fdata(me);
- CustomDataLayer *layer;
- int i, length= 0;
-
- for(layer=fdata->layers, i=0; i<fdata->totlayer; layer++, i++)
- if(layer->type == type)
- length++;
-
- return length;
-}
-
-static int rna_CustomDataLayer_active_get(PointerRNA *ptr, int type, int render)
+static int rna_CustomDataLayer_active_get(PointerRNA *ptr, CustomData *data, int type, int render)
{
- Mesh *me= (Mesh*)ptr->id.data;
- CustomData *fdata= rna_mesh_fdata(me);
- int n= ((CustomDataLayer*)ptr->data) - fdata->layers;
+ int n= ((CustomDataLayer*)ptr->data) - data->layers;
- if(render) return (n == CustomData_get_render_layer_index(fdata, type));
- else return (n == CustomData_get_active_layer_index(fdata, type));
+ if(render) return (n == CustomData_get_render_layer_index(data, type));
+ else return (n == CustomData_get_active_layer_index(data, type));
}
-static int rna_CustomDataLayer_clone_get(PointerRNA *ptr, int type, int UNUSED(render))
+static int rna_CustomDataLayer_clone_get(PointerRNA *ptr, CustomData *data, int type, int render)
{
- Mesh *me= (Mesh*)ptr->id.data;
- CustomData *fdata= rna_mesh_fdata(me);
- int n= ((CustomDataLayer*)ptr->data) - fdata->layers;
+ int n= ((CustomDataLayer*)ptr->data) - data->layers;
- return (n == CustomData_get_clone_layer_index(fdata, type));
+ return (n == CustomData_get_clone_layer_index(data, type));
}
-static void rna_CustomDataLayer_active_set(PointerRNA *ptr, int value, int type, int render)
+static void rna_CustomDataLayer_active_set(PointerRNA *ptr, CustomData *data, int value, int type, int render)
{
- Mesh *me= (Mesh*)ptr->id.data;
- CustomData *fdata= rna_mesh_fdata(me);
- int n= ((CustomDataLayer*)ptr->data) - fdata->layers;
+ int n= ((CustomDataLayer*)ptr->data) - data->layers;
if(value == 0)
return;
- if(render) CustomData_set_layer_render_index(fdata, type, n);
- else CustomData_set_layer_active_index(fdata, type, n);
+ if(render) CustomData_set_layer_render_index(data, type, n);
+ else CustomData_set_layer_active_index(data, type, n);
}
-static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, int value, int type, int UNUSED(render))
+static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int value, int type, int render)
{
- Mesh *me= (Mesh*)ptr->id.data;
- CustomData *fdata= rna_mesh_fdata(me);
- int n= ((CustomDataLayer*)ptr->data) - fdata->layers;
+ int n= ((CustomDataLayer*)ptr->data) - data->layers;
if(value == 0)
return;
- CustomData_set_layer_clone_index(fdata, type, n);
-}
-
-static int rna_uv_texture_check(CollectionPropertyIterator *UNUSED(iter), void *data)
-{
- CustomDataLayer *layer= (CustomDataLayer*)data;
- return (layer->type != CD_MTFACE);
-}
-
-static void rna_Mesh_uv_textures_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_uv_texture_check);
+ CustomData_set_layer_clone_index(data, type, n);
}
-static int rna_Mesh_uv_textures_length(PointerRNA *ptr)
-{
- return rna_CustomDataLayer_length(ptr, CD_MTFACE);
-}
+/* uv_loop_layers */
-static PointerRNA rna_Mesh_active_uv_texture_get(PointerRNA *ptr)
-{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- int index= CustomData_get_active_layer_index(fdata, CD_MTFACE);
- CustomDataLayer *cdl= (index == -1)? NULL: &fdata->layers[index];
+DEFINE_CUSTOMDATA_LAYER_COLLECTION(uv_loop_layer, ldata, CD_MLOOPUV)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_loop_layer, ldata, CD_MLOOPUV, active, MeshUVLoopLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_loop_layer, ldata, CD_MLOOPUV, clone, MeshUVLoopLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_loop_layer, ldata, CD_MLOOPUV, stencil, MeshUVLoopLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_loop_layer, ldata, CD_MLOOPUV, render, MeshUVLoopLayer)
- return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFaceLayer, cdl);
-}
+/* MeshUVLoopLayer */
-static PointerRNA rna_Mesh_uv_texture_clone_get(PointerRNA *ptr)
+static char *rna_MeshUVLoopLayer_path(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- int index= CustomData_get_clone_layer_index(fdata, CD_MTFACE);
- CustomDataLayer *cdl= (index == -1)? NULL: &fdata->layers[index];
-
- return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFaceLayer, cdl);
+ return BLI_sprintfN("uv_loop_layer[\"%s\"]", ((CustomDataLayer*)ptr->data)->name);
}
-static PointerRNA rna_Mesh_uv_texture_stencil_get(PointerRNA *ptr)
+static void rna_MeshUVLoopLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- int index= CustomData_get_stencil_layer_index(fdata, CD_MTFACE);
- CustomDataLayer *cdl= (index == -1)? NULL: &fdata->layers[index];
-
- return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFaceLayer, cdl);
+ Mesh *me = rna_mesh(ptr);
+ CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+ rna_iterator_array_begin(iter, layer->data, sizeof(MLoopUV), (me->edit_btmesh) ? 0 : me->totloop, 0, NULL);
}
-static void rna_Mesh_active_uv_texture_set(PointerRNA *ptr, PointerRNA value)
+static int rna_MeshUVLoopLayer_data_length(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- CustomDataLayer *cdl;
- int a;
-
- for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) {
- if(value.data == cdl) {
- CustomData_set_layer_active_index(fdata, CD_MTFACE, a);
- mesh_update_customdata_pointers(me);
- return;
- }
- }
+ Mesh *me = rna_mesh(ptr);
+ return (me->edit_btmesh) ? 0 : me->totloop;
}
-static void rna_Mesh_uv_texture_clone_set(PointerRNA *ptr, PointerRNA value)
-{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- CustomDataLayer *cdl;
- int a;
+/* face uv_textures */
- for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) {
- if(value.data == cdl) {
- CustomData_set_layer_clone_index(fdata, CD_MTFACE, a);
- return;
- }
- }
-}
+DEFINE_CUSTOMDATA_LAYER_COLLECTION(tessface_uv_texture, fdata, CD_MTFACE)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(tessface_uv_texture, fdata, CD_MTFACE, active, MeshTextureFaceLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(tessface_uv_texture, fdata, CD_MTFACE, clone, MeshTextureFaceLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(tessface_uv_texture, fdata, CD_MTFACE, stencil, MeshTextureFaceLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(tessface_uv_texture, fdata, CD_MTFACE, render, MeshTextureFaceLayer)
-static void rna_Mesh_uv_texture_stencil_set(PointerRNA *ptr, PointerRNA value)
-{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- CustomDataLayer *cdl;
- int a;
-
- for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) {
- if(value.data == cdl) {
- CustomData_set_layer_stencil_index(fdata, CD_MTFACE, a);
- return;
- }
- }
-}
-
-static int rna_Mesh_active_uv_texture_index_get(PointerRNA *ptr)
-{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- return CustomData_get_active_layer(fdata, CD_MTFACE);
-}
-
-static int rna_Mesh_uv_texture_clone_index_get(PointerRNA *ptr)
-{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- return CustomData_get_clone_layer(fdata, CD_MTFACE);
-}
-
-static int rna_Mesh_uv_texture_stencil_index_get(PointerRNA *ptr)
-{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- return CustomData_get_stencil_layer(fdata, CD_MTFACE);
-}
-
-static void rna_Mesh_active_uv_texture_index_set(PointerRNA *ptr, int value)
-{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
-
- CustomData_set_layer_active(fdata, CD_MTFACE, value);
- mesh_update_customdata_pointers(me);
-}
-
-static void rna_Mesh_uv_texture_clone_index_set(PointerRNA *ptr, int value)
-{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
-
- CustomData_set_layer_clone(fdata, CD_MTFACE, value);
-}
-
-static void rna_Mesh_uv_texture_stencil_index_set(PointerRNA *ptr, int value)
-{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
-
- CustomData_set_layer_stencil(fdata, CD_MTFACE, value);
-}
-
-static void rna_Mesh_active_uv_texture_index_range(PointerRNA *ptr, int *min, int *max)
-{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
-
- *min= 0;
- *max= CustomData_number_of_layers(fdata, CD_MTFACE)-1;
- *max= MAX2(0, *max);
-}
-
-static PointerRNA rna_Mesh_active_mtface_get(PointerRNA *ptr)
-{
- Mesh *me= (Mesh*)ptr->data;
- EditMesh *em= BKE_mesh_get_editmesh(me);
- MTFace *tf;
-
- if (em && EM_texFaceCheck(em))
- {
- tf = EM_get_active_mtface(em, NULL, NULL, 1);
-
- return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFace, tf);
- }
-
- return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFace, NULL);
-}
-
-static void rna_MeshTextureFace_uv1_get(PointerRNA *ptr, float *values)
-{
- MTFace *mtface= (MTFace*)ptr->data;
-
- values[0]= mtface->uv[0][0];
- values[1]= mtface->uv[0][1];
-}
-
-static void rna_MeshTextureFace_uv1_set(PointerRNA *ptr, const float *values)
-{
- MTFace *mtface= (MTFace*)ptr->data;
-
- mtface->uv[0][0]= values[0];
- mtface->uv[0][1]= values[1];
-}
-
-static void rna_MeshTextureFace_uv2_get(PointerRNA *ptr, float *values)
+static void rna_MeshTextureFaceLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- MTFace *mtface= (MTFace*)ptr->data;
-
- values[0]= mtface->uv[1][0];
- values[1]= mtface->uv[1][1];
+ Mesh *me = rna_mesh(ptr);
+ CustomDataLayer *layer= (CustomDataLayer*)ptr->data;
+ rna_iterator_array_begin(iter, layer->data, sizeof(MTFace), (me->edit_btmesh)? 0: me->totface, 0, NULL);
}
-static void rna_MeshTextureFace_uv2_set(PointerRNA *ptr, const float *values)
+static int rna_MeshTextureFaceLayer_data_length(PointerRNA *ptr)
{
- MTFace *mtface= (MTFace*)ptr->data;
-
- mtface->uv[1][0]= values[0];
- mtface->uv[1][1]= values[1];
+ Mesh *me = rna_mesh(ptr);
+ return (me->edit_btmesh)? 0: me->totface;
}
-static void rna_MeshTextureFace_uv3_get(PointerRNA *ptr, float *values)
+static int rna_MeshTextureFaceLayer_active_render_get(PointerRNA *ptr)
{
- MTFace *mtface= (MTFace*)ptr->data;
-
- values[0]= mtface->uv[2][0];
- values[1]= mtface->uv[2][1];
+ return rna_CustomDataLayer_active_get(ptr, rna_mesh_fdata(ptr), CD_MTFACE, 1);
}
-static void rna_MeshTextureFace_uv3_set(PointerRNA *ptr, const float *values)
+static int rna_MeshTextureFaceLayer_active_get(PointerRNA *ptr)
{
- MTFace *mtface= (MTFace*)ptr->data;
-
- mtface->uv[2][0]= values[0];
- mtface->uv[2][1]= values[1];
+ return rna_CustomDataLayer_active_get(ptr, rna_mesh_fdata(ptr), CD_MTFACE, 0);
}
-static void rna_MeshTextureFace_uv4_get(PointerRNA *ptr, float *values)
+static int rna_MeshTextureFaceLayer_clone_get(PointerRNA *ptr)
{
- MTFace *mtface= (MTFace*)ptr->data;
-
- values[0]= mtface->uv[3][0];
- values[1]= mtface->uv[3][1];
+ return rna_CustomDataLayer_clone_get(ptr, rna_mesh_fdata(ptr), CD_MTFACE, 0);
}
-static void rna_MeshTextureFace_uv4_set(PointerRNA *ptr, const float *values)
+static void rna_MeshTextureFaceLayer_active_render_set(PointerRNA *ptr, int value)
{
- MTFace *mtface= (MTFace*)ptr->data;
-
- mtface->uv[3][0]= values[0];
- mtface->uv[3][1]= values[1];
+ rna_CustomDataLayer_active_set(ptr, rna_mesh_fdata(ptr), value, CD_MTFACE, 1);
}
-static int rna_CustomDataData_numverts(PointerRNA *ptr, int type)
+static void rna_MeshTextureFaceLayer_active_set(PointerRNA *ptr, int value)
{
- Mesh *me= (Mesh*)ptr->id.data;
- CustomData *fdata= rna_mesh_fdata(me);
- CustomDataLayer *cdl;
- int a, b;
-
- for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) {
- if(cdl->type == type) {
- b= ((char*)ptr->data - ((char*)cdl->data))/CustomData_sizeof(type);
- if(b >= 0 && b < me->totface)
- return (me->mface[b].v4? 4: 3);
- }
- }
-
- return 0;
+ rna_CustomDataLayer_active_set(ptr, rna_mesh_fdata(ptr), value, CD_MTFACE, 0);
}
-static int rna_MeshTextureFace_uv_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+static void rna_MeshTextureFaceLayer_clone_set(PointerRNA *ptr, int value)
{
- length[0]= rna_CustomDataData_numverts(ptr, CD_MTFACE);
- length[1]= 2;
- return length[0]*length[1];
+ rna_CustomDataLayer_clone_set(ptr, rna_mesh_fdata(ptr), value, CD_MTFACE, 0);
}
-static void rna_MeshTextureFace_uv_get(PointerRNA *ptr, float *values)
+static void rna_MeshTextureFaceLayer_name_set(PointerRNA *ptr, const char *value)
{
- MTFace *mtface= (MTFace*)ptr->data;
- int totvert= rna_CustomDataData_numverts(ptr, CD_MTFACE);
-
- memcpy(values, mtface->uv, totvert * 2 * sizeof(float));
+ CustomData *fdata= rna_mesh_fdata(ptr);
+ CustomDataLayer *cdl= (CustomDataLayer*)ptr->data;
+ BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name));
+ CustomData_set_layer_unique_name(fdata, cdl - fdata->layers);
}
-static void rna_MeshTextureFace_uv_set(PointerRNA *ptr, const float *values)
-{
- MTFace *mtface= (MTFace*)ptr->data;
- int totvert= rna_CustomDataData_numverts(ptr, CD_MTFACE);
+/* poly uv_textures */
- memcpy(mtface->uv, values, totvert * 2 * sizeof(float));
-}
+DEFINE_CUSTOMDATA_LAYER_COLLECTION(uv_texture, pdata, CD_MTEXPOLY)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_texture, pdata, CD_MTEXPOLY, active, MeshTexturePolyLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_texture, pdata, CD_MTEXPOLY, clone, MeshTexturePolyLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_texture, pdata, CD_MTEXPOLY, stencil, MeshTexturePolyLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_texture, pdata, CD_MTEXPOLY, render, MeshTexturePolyLayer)
-static void rna_MeshTextureFaceLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_MeshTexturePolyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
+ Mesh *me = rna_mesh(ptr);
CustomDataLayer *layer= (CustomDataLayer*)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MTFace), (me->edit_mesh)? 0: me->totface, 0, NULL);
+ rna_iterator_array_begin(iter, layer->data, sizeof(MTexPoly), (me->edit_btmesh) ? 0 : me->totpoly, 0, NULL);
}
-static int rna_MeshTextureFaceLayer_data_length(PointerRNA *ptr)
+static int rna_MeshTexturePolyLayer_data_length(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
- return (me->edit_mesh)? 0: me->totface;
+ Mesh *me = rna_mesh(ptr);
+ return (me->edit_btmesh) ? 0 : me->totpoly;
}
-static int rna_MeshTextureFaceLayer_active_render_get(PointerRNA *ptr)
+static int rna_MeshTexturePolyLayer_active_render_get(PointerRNA *ptr)
{
- return rna_CustomDataLayer_active_get(ptr, CD_MTFACE, 1);
+ return rna_CustomDataLayer_active_get(ptr, rna_mesh_pdata(ptr), CD_MTEXPOLY, 1);
}
-static int rna_MeshTextureFaceLayer_active_get(PointerRNA *ptr)
+static int rna_MeshTexturePolyLayer_active_get(PointerRNA *ptr)
{
- return rna_CustomDataLayer_active_get(ptr, CD_MTFACE, 0);
+ return rna_CustomDataLayer_active_get(ptr, rna_mesh_pdata(ptr), CD_MTEXPOLY, 0);
}
-static int rna_MeshTextureFaceLayer_clone_get(PointerRNA *ptr)
+static int rna_MeshTexturePolyLayer_clone_get(PointerRNA *ptr)
{
- return rna_CustomDataLayer_clone_get(ptr, CD_MTFACE, 0);
+ return rna_CustomDataLayer_clone_get(ptr, rna_mesh_pdata(ptr), CD_MTEXPOLY, 0);
}
-static void rna_MeshTextureFaceLayer_active_render_set(PointerRNA *ptr, int value)
+static void rna_MeshTexturePolyLayer_active_render_set(PointerRNA *ptr, int value)
{
- rna_CustomDataLayer_active_set(ptr, value, CD_MTFACE, 1);
+ rna_CustomDataLayer_active_set(ptr, rna_mesh_pdata(ptr), value, CD_MTEXPOLY, 1);
}
-static void rna_MeshTextureFaceLayer_active_set(PointerRNA *ptr, int value)
+static void rna_MeshTexturePolyLayer_active_set(PointerRNA *ptr, int value)
{
- rna_CustomDataLayer_active_set(ptr, value, CD_MTFACE, 0);
+ rna_CustomDataLayer_active_set(ptr, rna_mesh_pdata(ptr), value, CD_MTEXPOLY, 0);
}
-static void rna_MeshTextureFaceLayer_clone_set(PointerRNA *ptr, int value)
+static void rna_MeshTexturePolyLayer_clone_set(PointerRNA *ptr, int value)
{
- rna_CustomDataLayer_clone_set(ptr, value, CD_MTFACE, 0);
+ rna_CustomDataLayer_clone_set(ptr, rna_mesh_pdata(ptr), value, CD_MTEXPOLY, 0);
}
-static void rna_MeshTextureFaceLayer_name_set(PointerRNA *ptr, const char *value)
+static void rna_MeshTexturePolyLayer_name_set(PointerRNA *ptr, const char *value)
{
- Mesh *me= (Mesh*)ptr->id.data;
- CustomData *fdata= rna_mesh_fdata(me);
+ CustomData *pdata= rna_mesh_pdata(ptr);
CustomDataLayer *cdl= (CustomDataLayer*)ptr->data;
BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name));
- CustomData_set_layer_unique_name(fdata, cdl - fdata->layers);
+ CustomData_set_layer_unique_name(pdata, cdl - pdata->layers);
}
-static int rna_vertex_color_check(CollectionPropertyIterator *UNUSED(iter), void *data)
-{
- CustomDataLayer *layer= (CustomDataLayer*)data;
- return (layer->type != CD_MCOL);
-}
+/* vertex_color_layers */
-static void rna_Mesh_vertex_colors_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_vertex_color_check);
-}
+DEFINE_CUSTOMDATA_LAYER_COLLECTION(tessface_vertex_color, fdata, CD_MCOL)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(tessface_vertex_color, fdata, CD_MCOL, active, MeshColorLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(tessface_vertex_color, fdata, CD_MCOL, render, MeshColorLayer)
-static int rna_Mesh_vertex_colors_length(PointerRNA *ptr)
+static void rna_MeshColorLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- return rna_CustomDataLayer_length(ptr, CD_MCOL);
+ Mesh *me = rna_mesh(ptr);
+ CustomDataLayer *layer= (CustomDataLayer*)ptr->data;
+ rna_iterator_array_begin(iter, layer->data, sizeof(CD_MCOL), me->totloop, 0, NULL);
}
-static PointerRNA rna_Mesh_active_vertex_color_get(PointerRNA *ptr)
+static int rna_MeshColorLayer_data_length(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- int index= CustomData_get_active_layer_index(fdata, CD_MCOL);
- CustomDataLayer *cdl= (index == -1)? NULL: &fdata->layers[index];
-
- return rna_pointer_inherit_refine(ptr, &RNA_MeshColorLayer, cdl);
+ Mesh *me = rna_mesh(ptr);
+ return me->totloop;
}
-static void rna_Mesh_active_vertex_color_set(PointerRNA *ptr, PointerRNA value)
+static int rna_MeshColorLayer_active_render_get(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- CustomDataLayer *cdl;
- int a;
-
- for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) {
- if(value.data == cdl) {
- CustomData_set_layer_active_index(fdata, CD_MCOL, a);
- mesh_update_customdata_pointers(me);
- return;
- }
- }
+ return rna_CustomDataLayer_active_get(ptr, rna_mesh_fdata(ptr), CD_MCOL, 1);
}
-static int rna_Mesh_active_vertex_color_index_get(PointerRNA *ptr)
+static int rna_MeshColorLayer_active_get(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- return CustomData_get_active_layer(fdata, CD_MCOL);
+ return rna_CustomDataLayer_active_get(ptr, rna_mesh_fdata(ptr), CD_MCOL, 0);
}
-static void rna_Mesh_active_vertex_color_index_set(PointerRNA *ptr, int value)
+static void rna_MeshColorLayer_active_render_set(PointerRNA *ptr, int value)
{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
-
- CustomData_set_layer_active(fdata, CD_MCOL, value);
- mesh_update_customdata_pointers(me);
+ rna_CustomDataLayer_active_set(ptr, rna_mesh_fdata(ptr), value, CD_MCOL, 1);
}
-static void rna_Mesh_active_vertex_color_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_MeshColorLayer_active_set(PointerRNA *ptr, int value)
{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
-
- *min= 0;
- *max= CustomData_number_of_layers(fdata, CD_MCOL)-1;
- *max= MAX2(0, *max);
+ rna_CustomDataLayer_active_set(ptr, rna_mesh_fdata(ptr), value, CD_MCOL, 0);
}
-static void rna_MeshColorLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION(vertex_color, ldata, CD_MLOOPCOL)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(vertex_color, ldata, CD_MLOOPCOL, active, MeshLoopColorLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(vertex_color, ldata, CD_MLOOPCOL, render, MeshLoopColorLayer)
+
+static void rna_MeshLoopColorLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
+ Mesh *me = rna_mesh(ptr);
CustomDataLayer *layer= (CustomDataLayer*)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MCol)*4, (me->edit_mesh)? 0: me->totface, 0, NULL);
+ rna_iterator_array_begin(iter, layer->data, sizeof(CD_MLOOPCOL), me->totloop, 0, NULL);
}
-static int rna_MeshColorLayer_data_length(PointerRNA *ptr)
+static int rna_MeshLoopColorLayer_data_length(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
- return (me->edit_mesh)? 0: me->totface;
+ Mesh *me = rna_mesh(ptr);
+ return me->totloop;
}
-static int rna_MeshColorLayer_active_render_get(PointerRNA *ptr)
+static int rna_MeshLoopColorLayer_active_render_get(PointerRNA *ptr)
{
- return rna_CustomDataLayer_active_get(ptr, CD_MCOL, 1);
+ return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPCOL, 1);
}
-static int rna_MeshColorLayer_active_get(PointerRNA *ptr)
+static int rna_MeshLoopColorLayer_active_get(PointerRNA *ptr)
{
- return rna_CustomDataLayer_active_get(ptr, CD_MCOL, 0);
+ return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPCOL, 0);
}
-static void rna_MeshColorLayer_active_render_set(PointerRNA *ptr, int value)
+static void rna_MeshLoopColorLayer_active_render_set(PointerRNA *ptr, int value)
{
- rna_CustomDataLayer_active_set(ptr, value, CD_MCOL, 1);
+ rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPCOL, 1);
}
-static void rna_MeshColorLayer_active_set(PointerRNA *ptr, int value)
+static void rna_MeshLoopColorLayer_active_set(PointerRNA *ptr, int value)
{
- rna_CustomDataLayer_active_set(ptr, value, CD_MCOL, 0);
+ rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPCOL, 0);
}
-static void rna_MeshColorLayer_name_set(PointerRNA *ptr, const char *value)
+static void rna_MeshLoopColorLayer_name_set(PointerRNA *ptr, const char *value)
{
- Mesh *me= (Mesh*)ptr->id.data;
- CustomData *fdata= rna_mesh_fdata(me);
+ /* Mesh *me = rna_mesh(ptr); */ /* UNUSED */
+ /* CustomData *pdata = rna_mesh_pdata(ptr); */ /* UNUSED */
CustomDataLayer *cdl= (CustomDataLayer*)ptr->data;
BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name));
- CustomData_set_layer_unique_name(fdata, cdl - fdata->layers);
+ CustomData_set_layer_unique_name(rna_mesh_ldata(ptr), cdl - rna_mesh_ldata(ptr)->layers);
}
static void rna_MeshFloatPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
+ Mesh *me = rna_mesh(ptr);
CustomDataLayer *layer= (CustomDataLayer*)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), (me->edit_mesh)? 0: me->totface, 0, NULL);
+ rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), me->totface, 0, NULL);
}
static int rna_MeshFloatPropertyLayer_data_length(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
- return (me->edit_mesh)? 0: me->totface;
+ Mesh *me = rna_mesh(ptr);
+ return me->totface;
}
-static int rna_float_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
+static int rna_float_layer_check(CollectionPropertyIterator *iter, void *data)
{
CustomDataLayer *layer= (CustomDataLayer*)data;
return (layer->type != CD_PROP_FLT);
@@ -844,17 +759,16 @@ static int rna_float_layer_check(CollectionPropertyIterator *UNUSED(iter), void
static void rna_Mesh_float_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_float_layer_check);
+ CustomData *pdata = rna_mesh_pdata(ptr);
+ rna_iterator_array_begin(iter, (void*)pdata->layers, sizeof(CustomDataLayer), pdata->totlayer, 0, rna_float_layer_check);
}
static int rna_Mesh_float_layers_length(PointerRNA *ptr)
{
- return rna_CustomDataLayer_length(ptr, CD_PROP_FLT);
+ return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_FLT);
}
-static int rna_int_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
+static int rna_int_layer_check(CollectionPropertyIterator *iter, void *data)
{
CustomDataLayer *layer= (CustomDataLayer*)data;
return (layer->type != CD_PROP_INT);
@@ -862,30 +776,29 @@ static int rna_int_layer_check(CollectionPropertyIterator *UNUSED(iter), void *d
static void rna_MeshIntPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
+ Mesh *me = rna_mesh(ptr);
CustomDataLayer *layer= (CustomDataLayer*)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MIntProperty), (me->edit_mesh)? 0: me->totface, 0, NULL);
+ rna_iterator_array_begin(iter, layer->data, sizeof(MIntProperty), me->totface, 0, NULL);
}
static int rna_MeshIntPropertyLayer_data_length(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
- return (me->edit_mesh)? 0: me->totface;
+ Mesh *me = rna_mesh(ptr);
+ return me->totface;
}
static void rna_Mesh_int_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_int_layer_check);
+ CustomData *pdata = rna_mesh_pdata(ptr);
+ rna_iterator_array_begin(iter, (void*)pdata->layers, sizeof(CustomDataLayer), pdata->totlayer, 0, rna_int_layer_check);
}
static int rna_Mesh_int_layers_length(PointerRNA *ptr)
{
- return rna_CustomDataLayer_length(ptr, CD_PROP_INT);
+ return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_INT);
}
-static int rna_string_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
+static int rna_string_layer_check(CollectionPropertyIterator *iter, void *data)
{
CustomDataLayer *layer= (CustomDataLayer*)data;
return (layer->type != CD_PROP_STR);
@@ -893,32 +806,31 @@ static int rna_string_layer_check(CollectionPropertyIterator *UNUSED(iter), void
static void rna_MeshStringPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
+ Mesh *me = rna_mesh(ptr);
CustomDataLayer *layer= (CustomDataLayer*)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MStringProperty), (me->edit_mesh)? 0: me->totface, 0, NULL);
+ rna_iterator_array_begin(iter, layer->data, sizeof(MStringProperty), me->totface, 0, NULL);
}
static int rna_MeshStringPropertyLayer_data_length(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
- return (me->edit_mesh)? 0: me->totface;
+ Mesh *me = rna_mesh(ptr);
+ return me->totface;
}
static void rna_Mesh_string_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->data;
- CustomData *fdata= rna_mesh_fdata(me);
- rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_string_layer_check);
+ CustomData *pdata = rna_mesh_pdata(ptr);
+ rna_iterator_array_begin(iter, (void*)pdata->layers, sizeof(CustomDataLayer), pdata->totlayer, 0, rna_string_layer_check);
}
static int rna_Mesh_string_layers_length(PointerRNA *ptr)
{
- return rna_CustomDataLayer_length(ptr, CD_PROP_STR);
+ return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_STR);
}
static void rna_TextureFace_image_set(PointerRNA *ptr, PointerRNA value)
{
- MTFace *tf= (MTFace*)ptr->data;
+ MTexPoly *tf= (MTexPoly*)ptr->data;
ID *id= value.data;
if(id) {
@@ -935,7 +847,7 @@ static void rna_TextureFace_image_set(PointerRNA *ptr, PointerRNA value)
static void rna_Mesh_auto_smooth_angle_set(PointerRNA *ptr, float value)
{
- Mesh *me= (Mesh*)ptr->id.data;
+ Mesh *me = rna_mesh(ptr);
value= RAD2DEGF(value);
CLAMP(value, 1.0f, 80.0f);
me->smoothresh= (int)value;
@@ -943,7 +855,7 @@ static void rna_Mesh_auto_smooth_angle_set(PointerRNA *ptr, float value)
static float rna_Mesh_auto_smooth_angle_get(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
+ Mesh *me = rna_mesh(ptr);
return DEG2RADF((float)me->smoothresh);
}
@@ -971,94 +883,165 @@ static void rna_MeshFace_verts_set(PointerRNA *ptr, const int *values)
memcpy(&face->v1, values, (face->v4 ? 4 : 3) * sizeof(int));
}
+/* poly.vertices - this is faked loop access for convenience */
+static int rna_MeshPoly_vertices_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+{
+ MPoly *mp= (MPoly*)ptr->data;
+ /* note, raw access uses dummy item, this _could_ crash, watch out for this, mface uses it but it cant work here */
+ return (length[0]= mp->totloop);
+}
+
+static void rna_MeshPoly_vertices_get(PointerRNA *ptr, int *values)
+{
+ Mesh *me = rna_mesh(ptr);
+ MPoly *mp= (MPoly*)ptr->data;
+ MLoop *ml= &me->mloop[mp->loopstart];
+ unsigned int i;
+ for(i= mp->totloop; i > 0; i--, values++, ml++) {
+ *values = ml->v;
+ }
+}
+
+static void rna_MeshPoly_vertices_set(PointerRNA *ptr, const int *values)
+{
+ Mesh *me = rna_mesh(ptr);
+ MPoly *mp= (MPoly*)ptr->data;
+ MLoop *ml= &me->mloop[mp->loopstart];
+ unsigned int i;
+ for(i= mp->totloop; i > 0; i--, values++, ml++) {
+ ml->v = *values;
+ }
+}
+
+
static int rna_MeshVertex_index_get(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
+ Mesh *me = rna_mesh(ptr);
MVert *vert= (MVert*)ptr->data;
return (int)(vert - me->mvert);
}
static int rna_MeshEdge_index_get(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
+ Mesh *me = rna_mesh(ptr);
MEdge *edge= (MEdge*)ptr->data;
return (int)(edge - me->medge);
}
static int rna_MeshFace_index_get(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
+ Mesh *me = rna_mesh(ptr);
MFace *face= (MFace*)ptr->data;
return (int)(face - me->mface);
}
+static int rna_MeshPolygon_index_get(PointerRNA *ptr)
+{
+ Mesh *me = rna_mesh(ptr);
+ MPoly *mpoly= (MPoly*)ptr->data;
+ return (int)(mpoly - me->mpoly);
+}
+
/* path construction */
static char *rna_VertexGroupElement_path(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data; /* XXX not always! */
+ Mesh *me = rna_mesh(ptr); /* XXX not always! */
MDeformWeight *dw= (MDeformWeight*)ptr->data;
MDeformVert *dvert;
int a, b;
- /* sanity check: make sure that mesh pointer is valid */
- if (me == NULL)
- return NULL;
- else if (GS(me->id.name) != ID_ME) {
- /* if object pointer, try to resolve the object's data to mesh pointer */
- if (GS(me->id.name) == ID_OB) {
- Object *ob = (Object *)me;
-
- if (ob->type == OB_MESH)
- me = (Mesh *)ob->data;
- else
- return NULL; /* nothing can be done */
- }
- else
- return NULL; /* nothing can be done */
- }
-
- for(a=0, dvert=me->dvert; a<me->totvert; a++, dvert++) {
- for(b=0; b<dvert->totweight; b++) {
+ for(a=0, dvert=me->dvert; a<me->totvert; a++, dvert++)
+ for(b=0; b<dvert->totweight; b++)
if(dw == &dvert->dw[b])
- return BLI_sprintfN("vertices[%d].groups[%d]", a, b);
- }
- }
+ return BLI_sprintfN("verts[%d].groups[%d]", a, b);
return NULL;
}
+static char *rna_MeshPolygon_path(PointerRNA *ptr)
+{
+ return BLI_sprintfN("polygons[%d]", (int)((MPoly*)ptr->data - rna_mesh(ptr)->mpoly));
+}
+
static char *rna_MeshFace_path(PointerRNA *ptr)
{
- return BLI_sprintfN("faces[%d]", (int)((MFace*)ptr->data - ((Mesh*)ptr->id.data)->mface));
+ return BLI_sprintfN("faces[%d]", (int)((MFace*)ptr->data - rna_mesh(ptr)->mface));
}
static char *rna_MeshEdge_path(PointerRNA *ptr)
{
- return BLI_sprintfN("edges[%d]", (int)((MEdge*)ptr->data - ((Mesh*)ptr->id.data)->medge));
+ return BLI_sprintfN("edges[%d]", (int)((MEdge*)ptr->data - rna_mesh(ptr)->medge));
+}
+
+static char *rna_MeshLoop_path(PointerRNA *ptr)
+{
+ return BLI_sprintfN("loops[%d]", (int)((MLoop*)ptr->data - rna_mesh(ptr)->mloop));
}
+
static char *rna_MeshVertex_path(PointerRNA *ptr)
{
- return BLI_sprintfN("vertices[%d]", (int)((MVert*)ptr->data - ((Mesh*)ptr->id.data)->mvert));
+ return BLI_sprintfN("vertices[%d]", (int)((MVert*)ptr->data - rna_mesh(ptr)->mvert));
}
static char *rna_MeshTextureFaceLayer_path(PointerRNA *ptr)
{
+ return BLI_sprintfN("tessface_uv_textures[\"%s\"]", ((CustomDataLayer*)ptr->data)->name);
+}
+
+static char *rna_MeshTexturePolyLayer_path(PointerRNA *ptr)
+{
return BLI_sprintfN("uv_textures[\"%s\"]", ((CustomDataLayer*)ptr->data)->name);
}
-static char *rna_CustomDataData_path(PointerRNA *ptr, char *collection, int type)
+static char *rna_PolyCustomData_data_path(PointerRNA *ptr, char *collection, int type)
{
- Mesh *me= (Mesh*)ptr->id.data;
- CustomData *fdata= rna_mesh_fdata(me);
CustomDataLayer *cdl;
- int a, b;
+ Mesh *me = rna_mesh(ptr);
+ CustomData *pdata = rna_mesh_pdata(ptr);
+ int a, b, totpoly = (me->edit_btmesh) ? 0 : me->totpoly;
+
+ for(cdl=pdata->layers, a=0; a<pdata->totlayer; cdl++, a++) {
+ if(cdl->type == type) {
+ b= ((char*)ptr->data - ((char*)cdl->data))/CustomData_sizeof(type);
+ if(b >= 0 && b < totpoly)
+ return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, cdl->name, b);
+ }
+ }
+
+ return NULL;
+}
+
+static char *rna_LoopCustomData_data_path(PointerRNA *ptr, char *collection, int type)
+{
+ CustomDataLayer *cdl;
+ Mesh *me = rna_mesh(ptr);
+ CustomData *ldata = rna_mesh_ldata(ptr);
+ int a, b, totloop = (me->edit_btmesh) ? 0 : me->totloop;
+
+ for(cdl=ldata->layers, a=0; a<ldata->totlayer; cdl++, a++) {
+ if(cdl->type == type) {
+ b= ((char*)ptr->data - ((char*)cdl->data))/CustomData_sizeof(type);
+ if(b >= 0 && b < totloop)
+ return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, cdl->name, b);
+ }
+ }
+
+ return NULL;
+}
+
+static char *rna_FaceCustomData_data_path(PointerRNA *ptr, char *collection, int type)
+{
+ CustomDataLayer *cdl;
+ Mesh *me = rna_mesh(ptr);
+ CustomData *fdata = rna_mesh_fdata(ptr);
+ int a, b, totloop = (me->edit_btmesh) ? 0 : me->totloop;
for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) {
if(cdl->type == type) {
b= ((char*)ptr->data - ((char*)cdl->data))/CustomData_sizeof(type);
- if(b >= 0 && b < me->totface)
+ if(b >= 0 && b < totloop)
return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, cdl->name, b);
}
}
@@ -1066,24 +1049,39 @@ static char *rna_CustomDataData_path(PointerRNA *ptr, char *collection, int type
return NULL;
}
+static char *rna_MeshUVLoop_path(PointerRNA *ptr)
+{
+ return rna_LoopCustomData_data_path(ptr, "uv_loop_layers", CD_MLOOPUV);
+}
+
static char *rna_MeshTextureFace_path(PointerRNA *ptr)
{
- return rna_CustomDataData_path(ptr, "uv_textures", CD_MTFACE);
+ return rna_FaceCustomData_data_path(ptr, "tessface_uv_textures", CD_MTFACE);
+}
+
+static char *rna_MeshTexturePoly_path(PointerRNA *ptr)
+{
+ return rna_PolyCustomData_data_path(ptr, "uv_textures", CD_MTEXPOLY);
}
static char *rna_MeshColorLayer_path(PointerRNA *ptr)
{
+ return BLI_sprintfN("tessface_vertex_colors[\"%s\"]", ((CustomDataLayer*)ptr->data)->name);
+}
+
+static char *rna_MeshLoopColorLayer_path(PointerRNA *ptr)
+{
return BLI_sprintfN("vertex_colors[\"%s\"]", ((CustomDataLayer*)ptr->data)->name);
}
static char *rna_MeshColor_path(PointerRNA *ptr)
{
- return rna_CustomDataData_path(ptr, "vertex_colors", CD_MCOL);
+ return rna_LoopCustomData_data_path(ptr, "vertex_colors", CD_MLOOPCOL);
}
static char *rna_MeshSticky_path(PointerRNA *ptr)
{
- return BLI_sprintfN("sticky[%d]", (int)((MSticky*)ptr->data - ((Mesh*)ptr->id.data)->msticky));
+ return BLI_sprintfN("sticky[%d]", (int)((MSticky*)ptr->data - rna_mesh(ptr)->msticky));
}
static char *rna_MeshIntPropertyLayer_path(PointerRNA *ptr)
@@ -1093,7 +1091,7 @@ static char *rna_MeshIntPropertyLayer_path(PointerRNA *ptr)
static char *rna_MeshIntProperty_path(PointerRNA *ptr)
{
- return rna_CustomDataData_path(ptr, "layers_int", CD_MCOL);
+ return rna_PolyCustomData_data_path(ptr, "layers_int", CD_PROP_INT);
}
static char *rna_MeshFloatPropertyLayer_path(PointerRNA *ptr)
@@ -1103,7 +1101,7 @@ static char *rna_MeshFloatPropertyLayer_path(PointerRNA *ptr)
static char *rna_MeshFloatProperty_path(PointerRNA *ptr)
{
- return rna_CustomDataData_path(ptr, "layers_float", CD_MCOL);
+ return rna_PolyCustomData_data_path(ptr, "layers_float", CD_PROP_FLT);
}
static char *rna_MeshStringPropertyLayer_path(PointerRNA *ptr)
@@ -1113,35 +1111,34 @@ static char *rna_MeshStringPropertyLayer_path(PointerRNA *ptr)
static char *rna_MeshStringProperty_path(PointerRNA *ptr)
{
- return rna_CustomDataData_path(ptr, "layers_string", CD_MCOL);
+ return rna_PolyCustomData_data_path(ptr, "layers_string", CD_PROP_STR);
}
static int rna_Mesh_tot_vert_get(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
- return me->edit_mesh ? me->edit_mesh->totvertsel : 0;
+ Mesh *me = rna_mesh(ptr);
+ return me->edit_btmesh ? me->edit_btmesh->bm->totvertsel : 0;
}
static int rna_Mesh_tot_edge_get(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
- return me->edit_mesh ? me->edit_mesh->totedgesel: 0;
+ Mesh *me = rna_mesh(ptr);
+ return me->edit_btmesh ? me->edit_btmesh->bm->totedgesel: 0;
}
static int rna_Mesh_tot_face_get(PointerRNA *ptr)
{
- Mesh *me= (Mesh*)ptr->id.data;
- return me->edit_mesh ? me->edit_mesh->totfacesel : 0;
+ Mesh *me = rna_mesh(ptr);
+ return me->edit_btmesh ? me->edit_btmesh->bm->totfacesel : 0;
}
static CustomDataLayer *rna_Mesh_vertex_color_new(struct Mesh *me, struct bContext *C, const char *name)
{
- CustomData *fdata;
+ CustomData *ldata = rna_mesh_ldata_helper(me);
CustomDataLayer *cdl= NULL;
int index;
if(ED_mesh_color_add(C, NULL, NULL, me, name, FALSE)) {
- fdata= rna_mesh_fdata(me);
- index= CustomData_get_named_layer_index(fdata, CD_MCOL, name);
- cdl= (index == -1)? NULL: &fdata->layers[index];
+ index= CustomData_get_named_layer_index(ldata, CD_MLOOPCOL, name);
+ cdl= (index == -1)? NULL: &ldata->layers[index];
}
return cdl;
}
@@ -1187,14 +1184,13 @@ static CustomDataLayer *rna_Mesh_string_property_new(struct Mesh *me, struct bCo
static CustomDataLayer *rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext *C, const char *name)
{
- CustomData *fdata;
+ CustomData *pdata = rna_mesh_pdata_helper(me);
CustomDataLayer *cdl= NULL;
int index;
if(ED_mesh_uv_texture_add(C, me, name, FALSE)) {
- fdata= rna_mesh_fdata(me);
- index= CustomData_get_named_layer_index(fdata, CD_MTFACE, name);
- cdl= (index == -1)? NULL: &fdata->layers[index];
+ index= CustomData_get_named_layer_index(pdata, CD_MTEXPOLY, name);
+ cdl= (index == -1)? NULL: &pdata->layers[index];
}
return cdl;
}
@@ -1264,8 +1260,7 @@ static void rna_def_mvert(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_MeshVertex_groups_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_MeshVertex_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "VertexGroupElement");
RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this vertex is member of");
@@ -1387,12 +1382,12 @@ static void rna_def_mface(BlenderRNA *brna)
RNA_def_property_range(prop, -1.0f, 1.0f);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_float_funcs(prop, "rna_MeshFace_normal_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Face normal", "Local space unit length normal vector for this face");
+ RNA_def_property_ui_text(prop, "face normal", "local space unit length normal vector for this face");
prop= RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_float_funcs(prop, "rna_MeshFace_area_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Face area", "Read only area of the face");
+ RNA_def_property_ui_text(prop, "face area", "read only area of the face");
prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -1400,6 +1395,129 @@ static void rna_def_mface(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Index", "Index number of the vertex");
}
+
+static void rna_def_mloop(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "MeshLoop", NULL);
+ RNA_def_struct_sdna(srna, "MLoop");
+ RNA_def_struct_ui_text(srna, "Mesh Loop", "Loop in a Mesh datablock");
+ RNA_def_struct_path_func(srna, "rna_MeshLoop_path");
+ RNA_def_struct_ui_icon(srna, ICON_EDGESEL);
+
+ prop= RNA_def_property(srna, "vertex_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "v");
+ RNA_def_property_ui_text(prop, "Vertex", "Vertex index");
+
+ prop= RNA_def_property(srna, "edge_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "e");
+ RNA_def_property_ui_text(prop, "Edge", "Edge index");
+}
+
+static void rna_def_mpolygon(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "MeshPolygon", NULL);
+ RNA_def_struct_sdna(srna, "MPoly");
+ RNA_def_struct_ui_text(srna, "Mesh Polygon", "Polygon in a Mesh datablock");
+ RNA_def_struct_path_func(srna, "rna_MeshPolygon_path");
+ RNA_def_struct_ui_icon(srna, ICON_FACESEL);
+
+ /* faked, actually access to loop vertex values, dont this way because manually setting up vertex/edge per loop is very low level
+ * instead we setup poly sizes, assign indicies, then calc edges automatic when creating meshes from rna/py */
+ prop= RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_array(prop, 3); // eek, this is still used in some cases but infact we dont want to use it at all here.
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_dynamic_array_funcs(prop, "rna_MeshPoly_vertices_get_length");
+ RNA_def_property_int_funcs(prop, "rna_MeshPoly_vertices_get", "rna_MeshPoly_vertices_set", NULL);
+ RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
+
+ /* these are both very low level access */
+ prop= RNA_def_property(srna, "loop_start", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "loopstart");
+ RNA_def_property_ui_text(prop, "Loop Start", "");
+ /* also low level */
+ prop= RNA_def_property(srna, "loop_total", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "totloop");
+ RNA_def_property_ui_text(prop, "Loop Total", "");
+
+ prop= RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "mat_nr");
+ RNA_def_property_ui_text(prop, "Material Index", "");
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshFace_material_index_range");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_FACE_SEL);
+ RNA_def_property_ui_text(prop, "Select", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+ prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
+ RNA_def_property_ui_text(prop, "Hide", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+ prop= RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SMOOTH);
+ RNA_def_property_ui_text(prop, "Smooth", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_MeshPolygon_normal_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "face normal", "local space unit length normal vector for this polygon");
+
+ prop= RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_MeshPolygon_area_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "face area", "read only area of the face");
+
+ prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_MeshPolygon_index_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Index", "Index number of the vertex");
+}
+
+/* mesh.loop_uvs */
+static void rna_def_mloopuv(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "MeshUVLoopLayer", NULL);
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_path_func(srna, "rna_MeshUVLoopLayer_path");
+
+ prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MeshUVLoop");
+ RNA_def_property_collection_funcs(prop, "rna_MeshUVLoopLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshUVLoopLayer_data_length", NULL, NULL, NULL);
+
+ srna= RNA_def_struct(brna, "MeshUVLoop", NULL);
+ RNA_def_struct_sdna(srna, "MLoopUV");
+ RNA_def_struct_path_func(srna, "rna_MeshUVLoop_path");
+
+ prop= RNA_def_property(srna, "uv", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "pin_uv", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_PINNED);
+ RNA_def_property_ui_text(prop, "UV Pinned", "");
+
+ prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_VERTSEL);
+ RNA_def_property_ui_text(prop, "UV Select", "");
+
+ prop= RNA_def_property(srna, "select_edge", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_EDGESEL);
+ RNA_def_property_ui_text(prop, "UV Edge Select", "");
+}
+
static void rna_def_mtface(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1452,7 +1570,6 @@ static void rna_def_mtface(BlenderRNA *brna)
prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "tpage");
RNA_def_property_pointer_funcs(prop, NULL, "rna_TextureFace_image_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Image", "");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
@@ -1507,6 +1624,81 @@ static void rna_def_mtface(BlenderRNA *brna)
}
+static void rna_def_mtexpoly(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+#if 0 /* BMESH_TODO: needed later when do another todo */
+ int uv_dim[]= {4, 2};
+#endif
+
+ srna= RNA_def_struct(brna, "MeshTexturePolyLayer", NULL);
+ RNA_def_struct_ui_text(srna, "Mesh UV Map", "UV map with assigned image textures in a Mesh datablock");
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_path_func(srna, "rna_MeshTexturePolyLayer_path");
+ RNA_def_struct_ui_icon(srna, ICON_GROUP_UVS);
+
+ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshTexturePolyLayer_name_set");
+ RNA_def_property_ui_text(prop, "Name", "Name of UV map");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_MeshTexturePolyLayer_active_get", "rna_MeshTexturePolyLayer_active_set");
+ RNA_def_property_ui_text(prop, "Active", "Set the map as active for display and editing");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
+ RNA_def_property_boolean_funcs(prop, "rna_MeshTexturePolyLayer_active_render_get", "rna_MeshTexturePolyLayer_active_render_set");
+ RNA_def_property_ui_text(prop, "Active Render", "Set the map as active for rendering");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "active_clone", 0);
+ RNA_def_property_boolean_funcs(prop, "rna_MeshTexturePolyLayer_clone_get", "rna_MeshTexturePolyLayer_clone_set");
+ RNA_def_property_ui_text(prop, "Active Clone", "Set the map as active for cloning");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MeshTexturePoly");
+ RNA_def_property_ui_text(prop, "Data", "");
+ RNA_def_property_collection_funcs(prop, "rna_MeshTexturePolyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshTexturePolyLayer_data_length", NULL, NULL, NULL);
+
+ srna= RNA_def_struct(brna, "MeshTexturePoly", NULL);
+ RNA_def_struct_sdna(srna, "MTexPoly");
+ RNA_def_struct_ui_text(srna, "Mesh UV Map Face", "UV map and image texture for a face");
+ RNA_def_struct_path_func(srna, "rna_MeshTexturePoly_path");
+ RNA_def_struct_ui_icon(srna, ICON_FACESEL_HLT);
+
+ prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "tpage");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_TextureFace_image_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Image", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "select_uv", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TF_SEL1);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "UV Selected", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+#if 0 /* moved to MeshUVLoopLayer */
+ prop= RNA_def_property(srna, "pin_uv", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "unwrap", TF_PIN1);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "UV Pinned", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+ prop= RNA_def_property(srna, "uv_raw", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_multi_array(prop, 2, uv_dim);
+ RNA_def_property_float_sdna(prop, NULL, "uv");
+ RNA_def_property_ui_text(prop, "UV", "Fixed size UV coordinates array");
+#endif
+}
+
static void rna_def_msticky(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1535,7 +1727,7 @@ static void rna_def_mcol(BlenderRNA *brna)
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_struct_name_property(srna, prop);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshColorLayer_name_set");
+ RNA_def_property_string_funcs(prop, NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Name", "Name of Vertex color layer");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
@@ -1553,9 +1745,7 @@ static void rna_def_mcol(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshColor");
RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_MeshColorLayer_data_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- "rna_MeshColorLayer_data_length", NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_MeshColorLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshColorLayer_data_length", NULL, NULL, NULL);
srna= RNA_def_struct(brna, "MeshColor", NULL);
RNA_def_struct_sdna(srna, "MCol");
@@ -1591,6 +1781,53 @@ static void rna_def_mcol(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
}
+static void rna_def_mloopcol(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "MeshLoopColorLayer", NULL);
+ RNA_def_struct_ui_text(srna, "Mesh Vertex Color Layer", "Layer of vertex colors in a Mesh datablock");
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_path_func(srna, "rna_MeshLoopColorLayer_path");
+ RNA_def_struct_ui_icon(srna, ICON_GROUP_VCOL);
+
+ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshLoopColorLayer_name_set");
+ RNA_def_property_ui_text(prop, "Name", "Name of Vertex color layer");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_MeshLoopColorLayer_active_get", "rna_MeshLoopColorLayer_active_set");
+ RNA_def_property_ui_text(prop, "Active", "Sets the layer as active for display and editing");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
+ RNA_def_property_boolean_funcs(prop, "rna_MeshLoopColorLayer_active_render_get", "rna_MeshLoopColorLayer_active_render_set");
+ RNA_def_property_ui_text(prop, "Active Render", "Sets the layer as active for rendering");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MeshLoopColor");
+ RNA_def_property_ui_text(prop, "Data", "");
+ RNA_def_property_collection_funcs(prop, "rna_MeshLoopColorLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshLoopColorLayer_data_length", NULL, NULL, NULL);
+
+
+ srna= RNA_def_struct(brna, "MeshLoopColor", NULL);
+ RNA_def_struct_sdna(srna, "MLoopCol");
+ RNA_def_struct_ui_text(srna, "Mesh Vertex Color", "Vertex loop colors in a Mesh");
+ RNA_def_struct_path_func(srna, "rna_MeshColor_path");
+
+ prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_funcs(prop, "rna_MeshLoopColor_color_get", "rna_MeshLoopColor_color_set", NULL);
+ RNA_def_property_ui_text(prop, "Color", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+}
+
static void rna_def_mproperties(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1610,9 +1847,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshFloatProperty");
RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_MeshFloatPropertyLayer_data_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- "rna_MeshFloatPropertyLayer_data_length", NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_MeshFloatPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshFloatPropertyLayer_data_length", NULL, NULL, NULL);
srna= RNA_def_struct(brna, "MeshFloatProperty", NULL);
RNA_def_struct_sdna(srna, "MFloatProperty");
@@ -1638,9 +1873,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshIntProperty");
RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_MeshIntPropertyLayer_data_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- "rna_MeshIntPropertyLayer_data_length", NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_MeshIntPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshIntPropertyLayer_data_length", NULL, NULL, NULL);
srna= RNA_def_struct(brna, "MeshIntProperty", NULL);
RNA_def_struct_sdna(srna, "MIntProperty");
@@ -1666,9 +1899,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshStringProperty");
RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_MeshStringPropertyLayer_data_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- "rna_MeshStringPropertyLayer_data_length", NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop, "rna_MeshStringPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshStringPropertyLayer_data_length", NULL, NULL, NULL);
srna= RNA_def_struct(brna, "MeshStringProperty", NULL);
RNA_def_struct_sdna(srna, "MStringProperty");
@@ -1682,6 +1913,45 @@ static void rna_def_mproperties(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
}
+void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable)
+{
+ PropertyRNA *prop;
+
+ /* texture space */
+ prop= RNA_def_property(srna, "auto_texspace", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "texflag", AUTOSPACE);
+ RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjusts active object's texture space automatically when transforming object");
+
+ prop= RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "loc");
+ RNA_def_property_ui_text(prop, "Texure Space Location", "Texture space location");
+ RNA_def_property_editable_func(prop, texspace_editable);
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+
+ prop= RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "size");
+ RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
+ RNA_def_property_editable_func(prop, texspace_editable);
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+
+ /* not supported yet
+ prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_float(prop, NULL, "rot");
+ RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
+ RNA_def_property_editable_func(prop, texspace_editable);
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");*/
+
+ /* materials */
+ prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
+ RNA_def_property_struct_type(prop, "Material");
+ RNA_def_property_ui_text(prop, "Materials", "");
+ RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
+ RNA_def_property_collection_funcs(prop, 0, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
+}
+
+
+/* scene.objects */
/* mesh.vertices */
static void rna_def_mesh_vertices(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -1735,7 +2005,7 @@ static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop)
PropertyRNA *prop;
FunctionRNA *func;
- /*PropertyRNA *parm;*/
+ PropertyRNA *parm;
RNA_def_property_srna(cprop, "MeshFaces");
srna= RNA_def_struct(brna, "MeshFaces", NULL);
@@ -1746,12 +2016,6 @@ static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_int_sdna(prop, NULL, "act_face");
RNA_def_property_ui_text(prop, "Active Face", "The active face for this mesh");
- prop= RNA_def_property(srna, "active_tface", PROP_POINTER, PROP_UNSIGNED);
- RNA_def_property_struct_type(prop, "MeshTextureFace");
- RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_mtface_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Active UV Map Face", "Active UV Map Face");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
func= RNA_def_function(srna, "add", "ED_mesh_faces_add");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of faces to add", 0, INT_MAX);
@@ -1761,25 +2025,101 @@ static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of faces to remove", 0, INT_MAX);
}
-/* mesh.vertex_colors */
-static void rna_def_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop)
+/* mesh.loops */
+static void rna_def_mesh_loops(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+
+ /*PropertyRNA *prop;*/
+
+ FunctionRNA *func;
+ /*PropertyRNA *parm;*/
+
+ RNA_def_property_srna(cprop, "MeshLoops");
+ srna= RNA_def_struct(brna, "MeshLoops", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Mesh Loops", "Collection of mesh loops");
+
+#if 0 // BMESH_TODO
+ prop= RNA_def_property(srna, "active", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "act_face");
+ RNA_def_property_ui_text(prop, "Active Polygon", "The active polygon for this mesh");
+#endif
+
+ func= RNA_def_function(srna, "add", "ED_mesh_loops_add");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of loops to add", 0, INT_MAX);
+}
+
+/* mesh.polygons */
+static void rna_def_mesh_polygons(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
+
PropertyRNA *prop;
FunctionRNA *func;
PropertyRNA *parm;
+ RNA_def_property_srna(cprop, "MeshPolygons");
+ srna= RNA_def_struct(brna, "MeshPolygons", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Mesh Polygons", "Collection of mesh polygons");
+
+ prop= RNA_def_property(srna, "active", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "act_face");
+ RNA_def_property_ui_text(prop, "Active Polygon", "The active polygon for this mesh");
+
+ func= RNA_def_function(srna, "add", "ED_mesh_polys_add");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of polygons to add", 0, INT_MAX);
+}
+
+
+/* mesh.vertex_colors */
+static void rna_def_tessface_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ //FunctionRNA *func;
+ //PropertyRNA *parm;
+
RNA_def_property_srna(cprop, "VertexColors");
srna= RNA_def_struct(brna, "VertexColors", NULL);
RNA_def_struct_sdna(srna, "Mesh");
RNA_def_struct_ui_text(srna, "Vertex Colors", "Collection of vertex colors");
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+ RNA_def_property_struct_type(prop, "MeshColorLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Mesh_tessface_vertex_color_active_get", "rna_Mesh_tessface_vertex_color_active_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Mesh_tessface_vertex_color_active_index_get", "rna_Mesh_tessface_vertex_color_active_index_set", "rna_Mesh_vertex_color_index_range");
+ RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vertex color index");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+}
+
+static void rna_def_loop_colors(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "LoopColors");
+ srna= RNA_def_struct(brna, "LoopColors", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Loop Colors", "Collection of vertex colors");
+
func= RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh");
RNA_def_string(func, "name", "Col", 0, "", "Vertex color name");
- parm= RNA_def_pointer(func, "layer", "MeshColorLayer", "", "The newly created layer");
+ parm= RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The newly created layer");
RNA_def_function_return(func, parm);
/*
@@ -1790,18 +2130,44 @@ static void rna_def_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
*/
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
- RNA_def_property_struct_type(prop, "MeshColorLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_vertex_color_get", "rna_Mesh_active_vertex_color_set", NULL, NULL);
+ RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Mesh_vertex_color_active_get", "rna_Mesh_vertex_color_active_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_active_vertex_color_index_get", "rna_Mesh_active_vertex_color_index_set", "rna_Mesh_active_vertex_color_index_range");
+ RNA_def_property_int_funcs(prop, "rna_Mesh_vertex_color_active_index_get", "rna_Mesh_vertex_color_active_index_set", "rna_Mesh_vertex_color_index_range");
RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vertex color index");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
}
+static void rna_def_uv_loop_layers(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ //FunctionRNA *func;
+ //PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "UVLoopLayers");
+ srna= RNA_def_struct(brna, "UVLoopLayers", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "UV Loop Layers", "Collection of uv loop layers");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+ RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_loop_layer_active_get", "rna_Mesh_uv_loop_layer_active_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active UV loop layer", "Active UV loop layer");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Mesh_uv_loop_layer_active_index_get", "rna_Mesh_uv_loop_layer_active_index_set", "rna_Mesh_uv_loop_layer_index_range");
+ RNA_def_property_ui_text(prop, "Active UV loop layer Index", "Active UV loop layer index");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+}
+
/* mesh int layers */
static void rna_def_int_layers(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -1866,6 +2232,32 @@ static void rna_def_string_layers(BlenderRNA *brna, PropertyRNA *cprop)
}
/* mesh.uv_layers */
+static void rna_def_tessface_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ //FunctionRNA *func;
+ //PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "TessfaceUVTextures");
+ srna= RNA_def_struct(brna, "TessfaceUVTextures", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "UV Maps", "Collection of UV maps for tesselated faces");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+ RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Mesh_tessface_uv_texture_active_get", "rna_Mesh_tessface_uv_texture_active_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active UV Map", "Active UV Map");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Mesh_tessface_uv_texture_active_index_get", "rna_Mesh_tessface_uv_texture_active_index_set", "rna_Mesh_uv_texture_index_range");
+ RNA_def_property_ui_text(prop, "Active UV Map Index", "Active UV Map index");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+}
+
+
static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
@@ -1881,9 +2273,9 @@ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
func= RNA_def_function(srna, "new", "rna_Mesh_uv_texture_new");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Add a UV texture layer to Mesh");
+ RNA_def_function_ui_description(func, "Add a UV map layer to Mesh");
RNA_def_string(func, "name", "UVMap", 0, "", "UV map name");
- parm= RNA_def_pointer(func, "layer", "MeshTextureFaceLayer", "", "The newly created layer");
+ parm= RNA_def_pointer(func, "layer", "MeshTexturePolyLayer", "", "The newly created layer");
RNA_def_function_return(func, parm);
/*
@@ -1894,15 +2286,14 @@ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
*/
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
- RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_uv_texture_get", "rna_Mesh_active_uv_texture_set", NULL, NULL);
+ RNA_def_property_struct_type(prop, "MeshTexturePolyLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_active_get", "rna_Mesh_uv_texture_active_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active UV Map", "Active UV Map");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_active_uv_texture_index_get",
- "rna_Mesh_active_uv_texture_index_set", "rna_Mesh_active_uv_texture_index_range");
+ RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_active_index_get", "rna_Mesh_uv_texture_active_index_set", "rna_Mesh_uv_texture_index_range");
RNA_def_property_ui_text(prop, "Active UV Map Index", "Active UV Map index");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
}
@@ -1934,6 +2325,18 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Faces", "Faces of the mesh");
rna_def_mesh_faces(brna, prop);
+ prop= RNA_def_property(srna, "loops", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "mloop", "totloop");
+ RNA_def_property_struct_type(prop, "MeshLoop");
+ RNA_def_property_ui_text(prop, "Loops", "Loops of the mesh");
+ rna_def_mesh_loops(brna, prop);
+
+ prop= RNA_def_property(srna, "polygons", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "mpoly", "totpoly");
+ RNA_def_property_struct_type(prop, "MeshPolygon");
+ RNA_def_property_ui_text(prop, "Polygons", "Polygons of the mesh");
+ rna_def_mesh_polygons(brna, prop);
+
prop= RNA_def_property(srna, "sticky", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "msticky", "totvert");
RNA_def_property_struct_type(prop, "MeshSticky");
@@ -1943,50 +2346,97 @@ static void rna_def_mesh(BlenderRNA *brna)
prop= RNA_def_property(srna, "texture_mesh", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "texcomesh");
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
- RNA_def_property_ui_text(prop, "Texture Mesh", "Use another mesh for texture indices (vertex indices must be aligned)");
+ RNA_def_property_ui_text(prop, "Texture Mesh", "Use another mesh for texture indicies (vertex indicies must be aligned)");
+
+ /* UV loop layers */
+ prop= RNA_def_property(srna, "uv_loop_layers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer");
+ RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_loop_layers_begin", NULL, NULL, NULL,
+ "rna_Mesh_uv_loop_layers_length", NULL, NULL, NULL);
+ RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
+ RNA_def_property_ui_text(prop, "UV Loop Layers", "All UV loop layers");
+ rna_def_uv_loop_layers(brna, prop);
+
+ prop= RNA_def_property(srna, "uv_loop_layer_clone", PROP_POINTER, PROP_UNSIGNED);
+ RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_loop_layer_clone_get", "rna_Mesh_uv_loop_layer_clone_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Clone UV loop layer", "UV loop layer to be used as cloning source");
- /* UV textures */
- prop= RNA_def_property(srna, "uv_textures", PROP_COLLECTION, PROP_NONE);
+ prop= RNA_def_property(srna, "uv_loop_layer_clone_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Mesh_uv_loop_layer_clone_index_get", "rna_Mesh_uv_loop_layer_clone_index_set", "rna_Mesh_uv_loop_layer_index_range");
+ RNA_def_property_ui_text(prop, "Clone UV loop layer Index", "Clone UV loop layer index");
+
+ prop= RNA_def_property(srna, "uv_loop_layer_stencil", PROP_POINTER, PROP_UNSIGNED);
+ RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_loop_layer_stencil_get", "rna_Mesh_uv_loop_layer_stencil_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Mask UV loop layer", "UV loop layer to mask the painted area");
+
+ prop= RNA_def_property(srna, "uv_loop_layer_stencil_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Mesh_uv_loop_layer_stencil_index_get", "rna_Mesh_uv_loop_layer_stencil_index_set", "rna_Mesh_uv_loop_layer_index_range");
+ RNA_def_property_ui_text(prop, "Mask UV loop layer Index", "Mask UV loop layer index");
+
+ /* Tesselated face UV maps - used by renderers */
+ prop= RNA_def_property(srna, "tessface_uv_textures", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
+ RNA_def_property_collection_funcs(prop, "rna_Mesh_tessface_uv_textures_begin", NULL, NULL, NULL,
+ "rna_Mesh_tessface_uv_textures_length", NULL, NULL, NULL);
+ RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
+ RNA_def_property_ui_text(prop, "Tesselated Face UV Maps", "All UV maps for tesselated faces (read-only, for use by renderers)");
+ rna_def_tessface_uv_textures(brna, prop);
+
+ /* UV maps */
+ prop= RNA_def_property(srna, "uv_textures", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", NULL, NULL, NULL,
"rna_Mesh_uv_textures_length", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
- RNA_def_property_ui_text(prop, "UV Maps", "");
+ RNA_def_property_struct_type(prop, "MeshTexturePolyLayer");
+ RNA_def_property_ui_text(prop, "UV Maps", "All UV maps");
rna_def_uv_textures(brna, prop);
prop= RNA_def_property(srna, "uv_texture_clone", PROP_POINTER, PROP_UNSIGNED);
- RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
+ RNA_def_property_struct_type(prop, "MeshTexturePolyLayer");
RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_clone_get", "rna_Mesh_uv_texture_clone_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Clone UV Map", "UV map to be used as cloning source");
prop= RNA_def_property(srna, "uv_texture_clone_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_clone_index_get",
- "rna_Mesh_uv_texture_clone_index_set", "rna_Mesh_active_uv_texture_index_range");
- RNA_def_property_ui_text(prop, "Clone UV Map Index", "Clone UV texture index");
+ RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_clone_index_get", "rna_Mesh_uv_texture_clone_index_set", "rna_Mesh_uv_texture_index_range");
+ RNA_def_property_ui_text(prop, "Clone UV Map Index", "Clone UV map index");
prop= RNA_def_property(srna, "uv_texture_stencil", PROP_POINTER, PROP_UNSIGNED);
- RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
+ RNA_def_property_struct_type(prop, "MeshTexturePolyLayer");
RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_stencil_get", "rna_Mesh_uv_texture_stencil_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Mask UV Map", "UV map to mask the painted area");
prop= RNA_def_property(srna, "uv_texture_stencil_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_stencil_index_get", "rna_Mesh_uv_texture_stencil_index_set", "rna_Mesh_active_uv_texture_index_range");
+ RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_stencil_index_get", "rna_Mesh_uv_texture_stencil_index_set", "rna_Mesh_uv_texture_index_range");
RNA_def_property_ui_text(prop, "Mask UV Map Index", "Mask UV map index");
+ /* Tesselated face colors - used by renderers */
+
+ prop= RNA_def_property(srna, "tessface_vertex_colors", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
+ RNA_def_property_collection_funcs(prop, "rna_Mesh_tessface_vertex_colors_begin", NULL, NULL, NULL,
+ "rna_Mesh_tessface_vertex_colors_length", NULL, NULL, NULL);
+ RNA_def_property_struct_type(prop, "MeshColorLayer");
+ RNA_def_property_ui_text(prop, "Tesselated Face Colors", "All tesselated face colors (read-only, for use by renderers)");
+ rna_def_tessface_vertex_colors(brna, prop);
+
/* Vertex colors */
prop= RNA_def_property(srna, "vertex_colors", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
+ RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer");
RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", NULL, NULL, NULL,
"rna_Mesh_vertex_colors_length", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MeshColorLayer");
- RNA_def_property_ui_text(prop, "Vertex Colors", "");
- rna_def_vertex_colors(brna, prop);
+ RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
+ RNA_def_property_ui_text(prop, "Vertex Colors", "All vertex colors");
+ rna_def_loop_colors(brna, prop);
prop= RNA_def_property(srna, "layers_float", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
+ RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", NULL, NULL, NULL,
"rna_Mesh_float_layers_length", NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "MeshFloatPropertyLayer");
@@ -1994,7 +2444,7 @@ static void rna_def_mesh(BlenderRNA *brna)
rna_def_float_layers(brna, prop);
prop= RNA_def_property(srna, "layers_int", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
+ RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", NULL, NULL, NULL,
"rna_Mesh_int_layers_length", NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "MeshIntPropertyLayer");
@@ -2002,7 +2452,7 @@ static void rna_def_mesh(BlenderRNA *brna)
rna_def_int_layers(brna, prop);
prop= RNA_def_property(srna, "layers_string", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
+ RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", NULL, NULL, NULL,
"rna_Mesh_string_layers_length", NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "MeshStringPropertyLayer");
@@ -2011,9 +2461,7 @@ static void rna_def_mesh(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_auto_smooth", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_AUTOSMOOTH);
- RNA_def_property_ui_text(prop, "Auto Smooth",
- "Treat all set-smoothed faces with angles less than the "
- "specified angle as 'smooth' during render");
+ RNA_def_property_ui_text(prop, "Auto Smooth", "Treats all set-smoothed faces with angles less than the specified angle as 'smooth' during render");
#if 1 /* expose as radians */
prop= RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGLE);
@@ -2024,8 +2472,7 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "smoothresh");
RNA_def_property_range(prop, 1, 80);
#endif
- RNA_def_property_ui_text(prop, "Auto Smooth Angle",
- "Maximum angle between face normals that 'Auto Smooth' will operate on");
+ RNA_def_property_ui_text(prop, "Auto Smooth Angle", "Defines maximum angle between face normals that 'Auto Smooth' will operate on");
prop= RNA_def_property(srna, "show_double_sided", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_TWOSIDED);
@@ -2044,24 +2491,16 @@ static void rna_def_mesh(BlenderRNA *brna)
/* texture space */
prop= RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "texflag", AUTOSPACE);
- RNA_def_property_ui_text(prop, "Auto Texture Space",
- "Adjust active object's texture space automatically when transforming object");
- RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Mesh_texspace_set");
-
- prop= RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjusts active object's texture space automatically when transforming object");
+
+ /*prop= RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
RNA_def_property_editable_func(prop, "rna_Mesh_texspace_editable");
- RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", "rna_Mesh_texspace_loc_set", NULL);
- RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-
- prop= RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
- RNA_def_property_editable_func(prop, "rna_Mesh_texspace_editable");
- RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_size_get", "rna_Mesh_texspace_size_set", NULL);
+ RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", "rna_Mesh_texspace_loc_set", NULL);
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-
+ */
+
/* not supported yet
prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
RNA_def_property_float(prop, NULL, "rot");
@@ -2069,79 +2508,67 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_editable_func(prop, texspace_editable);
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
*/
-
- /* materials */
- prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
- RNA_def_property_struct_type(prop, "Material");
- RNA_def_property_ui_text(prop, "Materials", "");
- RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
- RNA_def_property_collection_funcs(prop, 0, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
/* Mesh Draw Options for Edit Mode*/
prop= RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEDGES);
- RNA_def_property_ui_text(prop, "Draw Edges", "Display selected edges using highlights in the 3D view and UV editor");
+ RNA_def_property_ui_text(prop, "Draw Edges", "Displays selected edges using hilights in the 3D view and UV editor");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_ALLEDGES);
- RNA_def_property_ui_text(prop, "All Edges", "Display all edges for wireframe in all view modes in the 3D view");
+ RNA_def_property_ui_text(prop, "All Edges", "Displays all edges for wireframe in all view modes in the 3D view");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
prop= RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWFACES);
- RNA_def_property_ui_text(prop, "Draw Faces", "Display all faces as shades in the 3D view and UV editor");
+ RNA_def_property_ui_text(prop, "Draw Faces", "Displays all faces as shades in the 3D view and UV editor");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_normal_face", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWNORMALS);
- RNA_def_property_ui_text(prop, "Draw Normals", "Display face normals as lines");
+ RNA_def_property_ui_text(prop, "Draw Normals", "Displays face normals as lines");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_normal_vertex", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_VNORMALS);
- RNA_def_property_ui_text(prop, "Draw Vertex Normals", "Display vertex normals as lines");
+ RNA_def_property_ui_text(prop, "Draw Vertex Normals", "Displays vertex normals as lines");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_edge_crease", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWCREASES);
- RNA_def_property_ui_text(prop, "Draw Creases", "Display creases created for subsurf weighting");
+ RNA_def_property_ui_text(prop, "Draw Creases", "Displays creases created for subsurf weighting");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_edge_bevel_weight", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWBWEIGHTS);
- RNA_def_property_ui_text(prop, "Draw Bevel Weights", "Display weights created for the Bevel modifier");
+ RNA_def_property_ui_text(prop, "Draw Bevel Weights", "Displays weights created for the Bevel modifier");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_edge_seams", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWSEAMS);
- RNA_def_property_ui_text(prop, "Draw Seams", "Display UV unwrapping seams");
+ RNA_def_property_ui_text(prop, "Draw Seams", "Displays UV unwrapping seams");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_edge_sharp", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWSHARP);
- RNA_def_property_ui_text(prop, "Draw Sharp", "Display sharp edges, used with the EdgeSplit modifier");
+ RNA_def_property_ui_text(prop, "Draw Sharp", "Displays sharp edges, used with the EdgeSplit modifier");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_extra_edge_length", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_EDGELEN);
- RNA_def_property_ui_text(prop, "Edge Length",
- "Display selected edge lengths, using global values when set in the transform panel");
+ RNA_def_property_ui_text(prop, "Edge Length", "Displays selected edge lengths, Using global values when set in the transform panel");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_extra_face_angle", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEANG);
- RNA_def_property_ui_text(prop, "Faces Angles",
- "Display the angles between the selected edges in degrees, using "
- "global values when set in the transform panel");
+ RNA_def_property_ui_text(prop, "Face Angles", "Displays the angles in the selected edges in degrees, Using global values when set in the transform panel");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_extra_face_area", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEAREA);
- RNA_def_property_ui_text(prop, "Face Area",
- "Display the area of selected faces, using global values when set in the transform panel");
+ RNA_def_property_ui_text(prop, "Face Area", "Displays the area of selected faces, Using global values when set in the transform panel");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_extra_indices", PROP_BOOLEAN, PROP_NONE);
@@ -2166,8 +2593,7 @@ static void rna_def_mesh(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_mirror_topology", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_TOPO);
- RNA_def_property_ui_text(prop, "Topology Mirror",
- "Use topology based mirroring (for when both sides of mesh have matching, unique topology)");
+ RNA_def_property_ui_text(prop, "Topology Mirror", "Use topology based mirroring. For when both sides of mesh have matching, unique topology");
prop= RNA_def_property(srna, "use_paint_mask", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_MASK);
@@ -2200,6 +2626,7 @@ static void rna_def_mesh(BlenderRNA *brna)
/* pointers */
rna_def_animdata_common(srna);
+ rna_def_texmat_common(srna, "rna_Mesh_texspace_editable");
RNA_api_mesh(srna);
}
@@ -2211,9 +2638,14 @@ void RNA_def_mesh(BlenderRNA *brna)
rna_def_mvert_group(brna);
rna_def_medge(brna);
rna_def_mface(brna);
+ rna_def_mloop(brna);
+ rna_def_mpolygon(brna);
+ rna_def_mloopuv(brna);
rna_def_mtface(brna);
+ rna_def_mtexpoly(brna);
rna_def_msticky(brna);
rna_def_mcol(brna);
+ rna_def_mloopcol(brna);
rna_def_mproperties(brna);
}
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index 0a93c9b05c5..9bee359bbf5 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -40,7 +40,15 @@
#include "ED_mesh.h"
#ifdef RNA_RUNTIME
-
+const char *rna_Mesh_unit_test_compare(struct Mesh *mesh, bContext *C, struct Mesh *mesh2)
+{
+ const char *ret = mesh_cmp(mesh, mesh2, FLT_EPSILON*60);
+
+ if (!ret)
+ ret = "Same";
+
+ return ret;
+}
#else
@@ -61,6 +69,13 @@ void RNA_api_mesh(StructRNA *srna)
RNA_def_boolean(func, "calc_edges", 0, "Calculate Edges", "Force recalculation of edges");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ func= RNA_def_function(srna, "unit_test_compare", "rna_Mesh_unit_test_compare");
+ parm= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to compare to");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ /* return value */
+ parm= RNA_def_string(func, "result", "nothing", 64, "Return value", "String description of result of comparison");
+ RNA_def_function_return(func, parm);
+
func= RNA_def_function(srna, "validate", "BKE_mesh_validate");
RNA_def_function_ui_description(func, "validate geometry, return True when the mesh has had "
"invalid geometry corrected/removed");
diff --git a/source/blender/makesrna/intern/rna_mesh_utils.h b/source/blender/makesrna/intern/rna_mesh_utils.h
new file mode 100644
index 00000000000..02afaa5b51d
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_mesh_utils.h
@@ -0,0 +1,105 @@
+/*
+ * ***** 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) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * This is a new part of Blender.
+ *
+ * Contributor(s): Andrew Wiggin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/source/blender/makesrna/intern/rna_mesh_utils.h
+ * \ingroup RNA
+ */
+
+/* Macros to help reduce code clutter in rna_mesh.c */
+
+/* Define the accessors for a basic CustomDataLayer collection */
+#define DEFINE_CUSTOMDATA_LAYER_COLLECTION(collection_name, customdata_type, layer_type) \
+ \
+ static int rna_##collection_name##_check(CollectionPropertyIterator *iter, void *data) \
+ { \
+ CustomDataLayer *layer= (CustomDataLayer*)data; \
+ return (layer->type != layer_type); \
+ } \
+ \
+ static void rna_Mesh_##collection_name##s_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) \
+ { \
+ CustomData *data = rna_mesh_##customdata_type(ptr); \
+ rna_iterator_array_begin(iter, (void*)data->layers, sizeof(CustomDataLayer), data->totlayer, 0, rna_##collection_name##_check); \
+ } \
+ \
+ static int rna_Mesh_##collection_name##s_length(PointerRNA *ptr) \
+ { \
+ return CustomData_number_of_layers(rna_mesh_##customdata_type(ptr), layer_type); \
+ } \
+ \
+ static void rna_Mesh_##collection_name##_index_range(PointerRNA *ptr, int *min, int *max) \
+ { \
+ CustomData *data= rna_mesh_##customdata_type(ptr); \
+ \
+ *min= 0; \
+ *max= CustomData_number_of_layers(data, layer_type)-1; \
+ *max= MAX2(0, *max); \
+ }
+
+/* Define the accessors for special CustomDataLayers in the collection
+ (active, render, clone, stencil, etc) */
+#define DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(collection_name, customdata_type, layer_type, active_type, layer_rna_type) \
+ \
+ static PointerRNA rna_Mesh_##collection_name##_##active_type##_get(PointerRNA *ptr) \
+ { \
+ CustomData *data = rna_mesh_##customdata_type(ptr); \
+ int index= CustomData_get_##active_type##_layer_index(data, layer_type); \
+ CustomDataLayer *cdl= (index == -1)? NULL: &data->layers[index]; \
+ \
+ return rna_pointer_inherit_refine(ptr, &RNA_##layer_rna_type, cdl); \
+ } \
+ \
+ static void rna_Mesh_##collection_name##_##active_type##_set(PointerRNA *ptr, PointerRNA value) \
+ { \
+ Mesh *me = rna_mesh(ptr); \
+ CustomData *data = rna_mesh_##customdata_type(ptr); \
+ CustomDataLayer *cdl; \
+ int a; \
+ \
+ for(cdl=data->layers, a=0; a<data->totlayer; cdl++, a++) { \
+ if(value.data == cdl) { \
+ CustomData_set_layer_##active_type##_index(data, layer_type, a); \
+ mesh_update_customdata_pointers(me, TRUE); \
+ return; \
+ } \
+ } \
+ } \
+ \
+ static int rna_Mesh_##collection_name##_##active_type##_index_get(PointerRNA *ptr) \
+ { \
+ CustomData *data = rna_mesh_##customdata_type(ptr); \
+ return CustomData_get_##active_type##_layer(data, layer_type); \
+ } \
+ \
+ static void rna_Mesh_##collection_name##_##active_type##_index_set(PointerRNA *ptr, int value) \
+ { \
+ Mesh *me = rna_mesh(ptr); \
+ CustomData *data = rna_mesh_##customdata_type(ptr); \
+ \
+ CustomData_set_layer_##active_type(data, layer_type, value); \
+ mesh_update_customdata_pointers(me, TRUE); \
+ }
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 3f3ac6ce906..d38d2270fc5 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -98,6 +98,7 @@ EnumPropertyItem modifier_type_items[] ={
{eModifierType_Smoke, "SMOKE", ICON_MOD_SMOKE, "Smoke", ""},
{eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""},
{eModifierType_Surface, "SURFACE", ICON_MOD_PHYSICS, "Surface", ""},
+ {eModifierType_NgonInterp, "NGONINTERP", ICON_MOD_LATTICE, "Precision UV Interpolation", ""},
{0, NULL, 0, NULL, NULL}};
#ifdef RNA_RUNTIME
@@ -182,6 +183,8 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr)
return &RNA_MultiresModifier;
case eModifierType_Surface:
return &RNA_SurfaceModifier;
+ case eModifierType_NgonInterp:
+ return &RNA_NgonInterpModifier;
case eModifierType_Smoke:
return &RNA_SmokeModifier;
case eModifierType_Solidify:
@@ -483,7 +486,7 @@ static int rna_MultiresModifier_external_get(PointerRNA *ptr)
Object *ob= (Object*)ptr->id.data;
Mesh *me= ob->data;
- return CustomData_external_test(&me->fdata, CD_MDISPS);
+ return CustomData_external_test(&me->ldata, CD_MDISPS);
}
static void rna_MultiresModifier_filepath_get(PointerRNA *ptr, char *value)
@@ -2136,6 +2139,19 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
#endif
RNA_def_property_ui_text(prop, "Angle", "Angle above which to bevel edges");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* BMESH_BRANCH ONLY */
+ prop= RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE); /* name matches solidify */
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_EVEN);
+ RNA_def_property_ui_text(prop, "Even", "Use even bevel distance correction");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ /* BMESH_BRANCH ONLY */
+ prop= RNA_def_property(srna, "use_distance_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_DIST);
+ RNA_def_property_ui_text(prop, "Distance", "Use the width as a distance in rather then a factor of the face size");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ /* END BMESH_BRANCH ONLY */
+
}
static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
@@ -3066,6 +3082,27 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
}
+
+static void rna_def_modifier_ngoninterp(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "NgonInterpModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Precision UV Modifier", "Precision UV interpolation");
+ RNA_def_struct_sdna(srna, "NgonInterpModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SCREW);
+
+ prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_range(prop, 1, 10000);
+ RNA_def_property_ui_range(prop, 1, 100, 1, 0);
+ RNA_def_property_ui_text(prop, "Resolution", "Size of interpolation grids");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+}
+
+
+
void RNA_def_modifier(BlenderRNA *brna)
{
StructRNA *srna;
@@ -3169,6 +3206,9 @@ void RNA_def_modifier(BlenderRNA *brna)
rna_def_modifier_dynamic_paint(brna);
rna_def_modifier_ocean(brna);
rna_def_modifier_remesh(brna);
+
+ /* BMESH_ONLY */
+ rna_def_modifier_ngoninterp(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 3ec01e56ab3..a5eb610dd29 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -46,6 +46,7 @@
#include "DNA_scene_types.h"
#include "DNA_meta_types.h"
+#include "BKE_tessmesh.h"
#include "BKE_group.h" /* needed for object_in_group() */
#include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
@@ -227,8 +228,8 @@ void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
/* exit/enter editmode to get new shape */
switch(ob->type) {
case OB_MESH:
- load_editMesh(scene, ob);
- make_editMesh(scene, ob);
+ EDBM_LoadEditBMesh(scene, ob);
+ EDBM_MakeEditBMesh(scene->toolsettings, scene, ob);
break;
case OB_CURVE:
case OB_SURF:
@@ -608,8 +609,8 @@ static void rna_Object_active_material_index_set(PointerRNA *ptr, int value)
if(ob->type==OB_MESH) {
Mesh *me= ob->data;
- if(me->edit_mesh)
- me->edit_mesh->mat_nr= value;
+ if(me->edit_btmesh)
+ me->edit_btmesh->mat_nr= value;
}
}
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 0246e22d928..fc313d3b1de 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -171,7 +171,7 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
dm = mesh_create_derived_view( sce, ob, mask );
tmpmesh = add_mesh( "Mesh" );
- DM_to_mesh( dm, tmpmesh );
+ DM_to_mesh( dm, tmpmesh, ob );
dm->release( dm );
}
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 7f01a9387b5..a54a61b8d09 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -39,6 +39,8 @@
#include "DNA_userdef_types.h"
#include "BLI_math.h"
+#include "BKE_tessmesh.h"
+
/* Include for Bake Options */
#include "RE_engine.h"
#include "RE_pipeline.h"
@@ -1126,9 +1128,9 @@ static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value
if(scene->basact) {
Mesh *me= get_mesh(scene->basact->object);
- if(me && me->edit_mesh && me->edit_mesh->selectmode != flag) {
- me->edit_mesh->selectmode= flag;
- EM_selectmode_set(me->edit_mesh);
+ if(me && me->edit_btmesh && me->edit_btmesh->selectmode != flag) {
+ me->edit_btmesh->selectmode= flag;
+ EDBM_selectmode_set(me->edit_btmesh);
}
}
}
@@ -1140,7 +1142,7 @@ static void rna_Scene_editmesh_select_mode_update(Main *UNUSED(bmain), Scene *sc
if(scene->basact) {
me= get_mesh(scene->basact->object);
- if(me && me->edit_mesh==NULL)
+ if(me && me->edit_btmesh==NULL)
me= NULL;
}
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 96667c95042..52ffdec7174 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -334,7 +334,7 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_function_return(func, parm);
func= RNA_def_function(srna, "template_preview", "uiTemplatePreview");
- RNA_def_function_ui_description(func, "Item. A preview window for materials, textures, lamps, etc.");
+ RNA_def_function_ui_description(func, "Item. A preview window for materials, textures, lamps, etc");
parm= RNA_def_pointer(func, "id", "ID", "", "ID datablock");
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_boolean(func, "show_buttons", 1, "", "Show preview buttons?");