2012-04-22 11:54:53 +00:00
|
|
|
/*
|
2008-11-07 02:58:25 +00:00
|
|
|
* 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
|
2009-08-26 10:27:04 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2008-11-07 02:58:25 +00:00
|
|
|
* 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-11-07 02:58:25 +00:00
|
|
|
*/
|
|
|
|
|
2012-04-22 11:54:53 +00:00
|
|
|
/* 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.*/
|
2009-07-16 09:17:27 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup RNA
|
2011-02-27 20:20:01 +00:00
|
|
|
*/
|
|
|
|
|
2008-11-07 02:58:25 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2011-11-17 05:03:07 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2008-11-24 12:12:24 +00:00
|
|
|
#include "DNA_material_types.h"
|
2008-11-07 02:58:25 +00:00
|
|
|
#include "DNA_mesh_types.h"
|
|
|
|
#include "DNA_meshdata_types.h"
|
2008-11-24 12:12:24 +00:00
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
2011-06-09 08:58:27 +00:00
|
|
|
#include "BLI_math_base.h"
|
|
|
|
#include "BLI_math_rotation.h"
|
2013-04-27 12:51:23 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2011-06-09 08:58:27 +00:00
|
|
|
|
2013-06-03 05:07:16 +00:00
|
|
|
#include "BKE_editmesh.h"
|
|
|
|
|
2013-03-07 02:44:55 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
#include "RNA_define.h"
|
|
|
|
#include "RNA_types.h"
|
2017-08-01 09:06:34 +10:00
|
|
|
#include "RNA_enum_types.h"
|
2013-03-07 02:44:55 +00:00
|
|
|
|
|
|
|
#include "rna_internal.h"
|
|
|
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
const EnumPropertyItem rna_enum_mesh_delimit_mode_items[] = {
|
2019-02-12 21:28:04 +01:00
|
|
|
{BMO_DELIM_NORMAL, "NORMAL", 0, "Regular", "Delimit by face directions"},
|
2013-06-03 05:07:16 +00:00
|
|
|
{BMO_DELIM_MATERIAL, "MATERIAL", 0, "Material", "Delimit by face material"},
|
|
|
|
{BMO_DELIM_SEAM, "SEAM", 0, "Seam", "Delimit by edge seams"},
|
2015-05-16 10:18:38 +10:00
|
|
|
{BMO_DELIM_SHARP, "SHARP", 0, "Sharp", "Delimit by sharp edges"},
|
2015-05-16 12:21:31 +10:00
|
|
|
{BMO_DELIM_UV, "UV", 0, "UVs", "Delimit by UV coordinates"},
|
2013-06-03 05:07:16 +00:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
};
|
|
|
|
|
2008-11-07 02:58:25 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
2009-07-01 22:25:49 +00:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.h"
|
2009-07-01 22:25:49 +00:00
|
|
|
|
|
|
|
#include "BKE_customdata.h"
|
|
|
|
#include "BKE_main.h"
|
|
|
|
#include "BKE_mesh.h"
|
2018-09-06 14:28:14 +02:00
|
|
|
#include "BKE_mesh_runtime.h"
|
2012-03-07 21:58:58 +00:00
|
|
|
#include "BKE_report.h"
|
2009-07-01 22:25:49 +00:00
|
|
|
|
2017-06-08 10:14:53 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
|
2010-04-12 03:06:49 +00:00
|
|
|
#include "ED_mesh.h" /* XXX Bad level call */
|
|
|
|
|
2009-07-01 22:25:49 +00:00
|
|
|
#include "WM_api.h"
|
|
|
|
|
2011-11-24 06:55:53 +00:00
|
|
|
#include "rna_mesh_utils.h"
|
|
|
|
|
2013-04-30 17:30:40 +00:00
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* Generic helpers */
|
|
|
|
|
2011-11-17 05:03:07 +00:00
|
|
|
static Mesh *rna_mesh(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = (Mesh *)ptr->id.data;
|
|
|
|
return me;
|
|
|
|
}
|
|
|
|
|
2012-05-22 15:18:43 +00:00
|
|
|
static CustomData *rna_mesh_vdata_helper(Mesh *me)
|
|
|
|
{
|
2019-02-17 18:05:18 +11:00
|
|
|
return (me->edit_mesh) ? &me->edit_mesh->bm->vdata : &me->vdata;
|
2012-05-22 15:18:43 +00:00
|
|
|
}
|
|
|
|
|
2013-04-30 17:30:40 +00:00
|
|
|
static CustomData *rna_mesh_edata_helper(Mesh *me)
|
|
|
|
{
|
2019-02-17 18:05:18 +11:00
|
|
|
return (me->edit_mesh) ? &me->edit_mesh->bm->edata : &me->edata;
|
2013-04-30 17:30:40 +00:00
|
|
|
}
|
|
|
|
|
2011-11-17 05:03:07 +00:00
|
|
|
static CustomData *rna_mesh_pdata_helper(Mesh *me)
|
|
|
|
{
|
2019-02-17 18:05:18 +11:00
|
|
|
return (me->edit_mesh) ? &me->edit_mesh->bm->pdata : &me->pdata;
|
2011-11-17 05:03:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static CustomData *rna_mesh_ldata_helper(Mesh *me)
|
|
|
|
{
|
2019-02-17 18:05:18 +11:00
|
|
|
return (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata;
|
2011-11-17 05:03:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-25 13:28:04 +00:00
|
|
|
static CustomData *rna_mesh_fdata_helper(Mesh *me)
|
|
|
|
{
|
2019-02-17 18:05:18 +11:00
|
|
|
return (me->edit_mesh) ? NULL : &me->fdata;
|
2011-11-25 13:28:04 +00:00
|
|
|
}
|
|
|
|
|
2012-05-22 15:18:43 +00:00
|
|
|
static CustomData *rna_mesh_vdata(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
return rna_mesh_vdata_helper(me);
|
|
|
|
}
|
2013-04-30 17:30:40 +00:00
|
|
|
#if 0
|
|
|
|
static CustomData *rna_mesh_edata(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
return rna_mesh_edata_helper(me);
|
|
|
|
}
|
|
|
|
#endif
|
2011-11-17 05:03:07 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2013-04-30 17:30:40 +00:00
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* Generic CustomData Layer Functions */
|
|
|
|
|
|
|
|
static void rna_cd_layer_name_set(CustomData *cdata, CustomDataLayer *cdl, const char *value)
|
|
|
|
{
|
|
|
|
BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name));
|
|
|
|
CustomData_set_layer_unique_name(cdata, cdl - cdata->layers);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* avoid using where possible!, ideally the type is known */
|
|
|
|
static CustomData *rna_cd_from_layer(PointerRNA *ptr, CustomDataLayer *cdl)
|
|
|
|
{
|
|
|
|
/* find out where we come from by */
|
|
|
|
Mesh *me = ptr->id.data;
|
|
|
|
CustomData *cd;
|
|
|
|
|
|
|
|
/* rely on negative values wrapping */
|
2013-05-01 22:39:34 +00:00
|
|
|
#define TEST_CDL(cmd) if ((void)(cd = cmd(me)), ARRAY_HAS_ITEM(cdl, cd->layers, cd->totlayer)) return cd
|
2013-04-30 17:30:40 +00:00
|
|
|
|
|
|
|
TEST_CDL(rna_mesh_vdata_helper);
|
|
|
|
TEST_CDL(rna_mesh_edata_helper);
|
|
|
|
TEST_CDL(rna_mesh_pdata_helper);
|
|
|
|
TEST_CDL(rna_mesh_ldata_helper);
|
|
|
|
TEST_CDL(rna_mesh_fdata_helper);
|
|
|
|
|
|
|
|
#undef TEST_CDL
|
|
|
|
|
|
|
|
/* should _never_ happen */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_MeshVertexLayer_name_set(PointerRNA *ptr, const char *value)
|
|
|
|
{
|
|
|
|
rna_cd_layer_name_set(rna_mesh_vdata(ptr), (CustomDataLayer *)ptr->data, value);
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
static void rna_MeshEdgeLayer_name_set(PointerRNA *ptr, const char *value)
|
|
|
|
{
|
|
|
|
rna_cd_layer_name_set(rna_mesh_edata(ptr), (CustomDataLayer *)ptr->data, value);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
static void rna_MeshPolyLayer_name_set(PointerRNA *ptr, const char *value)
|
|
|
|
{
|
|
|
|
rna_cd_layer_name_set(rna_mesh_pdata(ptr), (CustomDataLayer *)ptr->data, value);
|
|
|
|
}
|
|
|
|
static void rna_MeshLoopLayer_name_set(PointerRNA *ptr, const char *value)
|
|
|
|
{
|
|
|
|
rna_cd_layer_name_set(rna_mesh_ldata(ptr), (CustomDataLayer *)ptr->data, value);
|
|
|
|
}
|
|
|
|
/* only for layers shared between types */
|
|
|
|
static void rna_MeshAnyLayer_name_set(PointerRNA *ptr, const char *value)
|
|
|
|
{
|
|
|
|
CustomData *cd = rna_cd_from_layer(ptr, (CustomDataLayer *)ptr->data);
|
|
|
|
rna_cd_layer_name_set(cd, (CustomDataLayer *)ptr->data, value);
|
|
|
|
}
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_Mesh_has_custom_normals_get(PointerRNA *ptr)
|
Add Custom Loop Normals.
This is the core code for it, tools (datatransfer and modifier) will come in next commits).
RNA api is already there, though.
See the code for details, but basically, we define, for each 'smooth fan'
(which is a set of adjacent loops around a same vertex that are smooth, i.e. have a single same normal),
a 'loop normal space' (or lnor space), using auto-computed normal and relevant edges, and store
custom normal as two angular factors inside that space. This allows to have custom normals
'following' deformations of the geometry, and to only save two shorts per loop in new clnor CDLayer.
Normal manipulation (editing, mixing, interpolating, etc.) shall always happen with plain 3D vectors normals,
and be converted back into storage format at the end.
Clnor computation has also been threaded (at least for Mesh case, not for BMesh), since the process can
be rather heavy with high poly meshes.
Also, bumping subversion, and fix mess in 2.70 versioning code.
2015-02-05 14:24:48 +01:00
|
|
|
{
|
|
|
|
Mesh *me = ptr->data;
|
2018-07-05 22:25:34 +02:00
|
|
|
return BKE_mesh_has_custom_loop_normals(me);
|
Add Custom Loop Normals.
This is the core code for it, tools (datatransfer and modifier) will come in next commits).
RNA api is already there, though.
See the code for details, but basically, we define, for each 'smooth fan'
(which is a set of adjacent loops around a same vertex that are smooth, i.e. have a single same normal),
a 'loop normal space' (or lnor space), using auto-computed normal and relevant edges, and store
custom normal as two angular factors inside that space. This allows to have custom normals
'following' deformations of the geometry, and to only save two shorts per loop in new clnor CDLayer.
Normal manipulation (editing, mixing, interpolating, etc.) shall always happen with plain 3D vectors normals,
and be converted back into storage format at the end.
Clnor computation has also been threaded (at least for Mesh case, not for BMesh), since the process can
be rather heavy with high poly meshes.
Also, bumping subversion, and fix mess in 2.70 versioning code.
2015-02-05 14:24:48 +01:00
|
|
|
}
|
2013-04-30 17:30:40 +00:00
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* Update Callbacks */
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static void rna_Mesh_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
2009-07-01 22:25:49 +00:00
|
|
|
{
|
2012-03-05 16:19:16 +00:00
|
|
|
ID *id = ptr->id.data;
|
2009-07-01 22:25:49 +00:00
|
|
|
|
2010-08-13 14:42:45 +00:00
|
|
|
/* cheating way for importers to avoid slow updates */
|
2012-03-05 16:19:16 +00:00
|
|
|
if (id->us > 0) {
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_id_tag_update(id, 0);
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
|
2010-08-13 14:42:45 +00:00
|
|
|
}
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
}
|
|
|
|
|
2017-05-03 18:55:40 +02:00
|
|
|
static void rna_Mesh_update_data_edit_weight(Main *bmain, Scene *scene, PointerRNA *ptr)
|
|
|
|
{
|
2018-08-23 10:14:29 -03:00
|
|
|
BKE_mesh_batch_cache_dirty_tag(rna_mesh(ptr), BKE_MESH_BATCH_DIRTY_ALL);
|
2017-05-03 18:55:40 +02:00
|
|
|
|
|
|
|
rna_Mesh_update_data(bmain, scene, ptr);
|
|
|
|
}
|
|
|
|
|
2017-05-04 19:59:27 +02:00
|
|
|
|
|
|
|
static void rna_Mesh_update_data_edit_active_color(Main *bmain, Scene *scene, PointerRNA *ptr)
|
|
|
|
{
|
2018-08-23 10:14:29 -03:00
|
|
|
BKE_mesh_batch_cache_dirty_tag(rna_mesh(ptr), BKE_MESH_BATCH_DIRTY_ALL);
|
2017-05-04 19:59:27 +02:00
|
|
|
|
|
|
|
rna_Mesh_update_data(bmain, scene, ptr);
|
|
|
|
}
|
2013-09-20 06:35:28 +00:00
|
|
|
static void rna_Mesh_update_select(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
{
|
2012-03-05 16:19:16 +00:00
|
|
|
ID *id = ptr->id.data;
|
2010-08-13 14:42:45 +00:00
|
|
|
/* cheating way for importers to avoid slow updates */
|
2012-03-05 16:19:16 +00:00
|
|
|
if (id->us > 0) {
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_GEOM | ND_SELECT, id);
|
2010-08-13 14:42:45 +00:00
|
|
|
}
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
}
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
void rna_Mesh_update_draw(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
{
|
2012-03-05 16:19:16 +00:00
|
|
|
ID *id = ptr->id.data;
|
2010-08-13 14:42:45 +00:00
|
|
|
/* cheating way for importers to avoid slow updates */
|
2012-03-05 16:19:16 +00:00
|
|
|
if (id->us > 0) {
|
2012-05-12 11:01:29 +00:00
|
|
|
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
|
2010-08-13 14:42:45 +00:00
|
|
|
}
|
2009-07-01 22:25:49 +00:00
|
|
|
}
|
|
|
|
|
2011-09-18 17:10:28 +00:00
|
|
|
|
2012-09-23 18:50:56 +00:00
|
|
|
static void rna_Mesh_update_vertmask(Main *bmain, Scene *scene, PointerRNA *ptr)
|
2011-07-20 15:56:35 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Mesh *me = ptr->data;
|
2012-12-22 14:25:34 +00:00
|
|
|
if ((me->editflag & ME_EDIT_PAINT_VERT_SEL) && (me->editflag & ME_EDIT_PAINT_FACE_SEL)) {
|
|
|
|
me->editflag &= ~ME_EDIT_PAINT_FACE_SEL;
|
2011-07-20 15:56:35 +00:00
|
|
|
}
|
2017-05-03 18:55:40 +02:00
|
|
|
|
2018-08-23 10:14:29 -03:00
|
|
|
BKE_mesh_batch_cache_dirty_tag(me, BKE_MESH_BATCH_DIRTY_ALL);
|
2017-05-03 18:55:40 +02:00
|
|
|
|
2011-07-20 15:56:35 +00:00
|
|
|
rna_Mesh_update_draw(bmain, scene, ptr);
|
|
|
|
}
|
2011-09-18 17:10:28 +00:00
|
|
|
|
2012-09-23 18:50:56 +00:00
|
|
|
static void rna_Mesh_update_facemask(Main *bmain, Scene *scene, PointerRNA *ptr)
|
2011-07-20 15:56:35 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Mesh *me = ptr->data;
|
2012-12-22 14:25:34 +00:00
|
|
|
if ((me->editflag & ME_EDIT_PAINT_VERT_SEL) && (me->editflag & ME_EDIT_PAINT_FACE_SEL)) {
|
|
|
|
me->editflag &= ~ME_EDIT_PAINT_VERT_SEL;
|
2011-07-20 15:56:35 +00:00
|
|
|
}
|
2017-05-03 18:55:40 +02:00
|
|
|
|
2018-08-23 10:14:29 -03:00
|
|
|
BKE_mesh_batch_cache_dirty_tag(me, BKE_MESH_BATCH_DIRTY_ALL);
|
2017-05-03 18:55:40 +02:00
|
|
|
|
2011-07-20 15:56:35 +00:00
|
|
|
rna_Mesh_update_draw(bmain, scene, ptr);
|
|
|
|
}
|
2013-04-30 17:30:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* Property get/set Callbacks */
|
|
|
|
|
2009-06-20 15:06:18 +00:00
|
|
|
static void rna_MeshVertex_normal_get(PointerRNA *ptr, float *value)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
MVert *mvert = (MVert *)ptr->data;
|
2010-01-04 15:37:22 +00:00
|
|
|
normal_short_to_float_v3(value, mvert->no);
|
2009-06-20 15:06:18 +00:00
|
|
|
}
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2010-01-04 15:37:22 +00:00
|
|
|
static void rna_MeshVertex_normal_set(PointerRNA *ptr, const float *value)
|
2010-01-04 15:25:21 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
MVert *mvert = (MVert *)ptr->data;
|
2010-01-04 15:37:22 +00:00
|
|
|
float no[3];
|
2010-01-04 15:25:21 +00:00
|
|
|
|
2010-01-04 15:37:22 +00:00
|
|
|
copy_v3_v3(no, value);
|
|
|
|
normalize_v3(no);
|
|
|
|
normal_float_to_short_v3(mvert->no, no);
|
2010-01-04 15:25:21 +00:00
|
|
|
}
|
|
|
|
|
2009-01-02 14:48:03 +00:00
|
|
|
static float rna_MeshVertex_bevel_weight_get(PointerRNA *ptr)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
MVert *mvert = (MVert *)ptr->data;
|
|
|
|
return mvert->bweight / 255.0f;
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2009-01-02 14:48:03 +00:00
|
|
|
static void rna_MeshVertex_bevel_weight_set(PointerRNA *ptr, float value)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
MVert *mvert = (MVert *)ptr->data;
|
2017-09-18 21:11:41 +10:00
|
|
|
mvert->bweight = round_fl_to_uchar_clamp(value * 255.0f);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static float rna_MEdge_bevel_weight_get(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
MEdge *medge = (MEdge *)ptr->data;
|
|
|
|
return medge->bweight / 255.0f;
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_MEdge_bevel_weight_set(PointerRNA *ptr, float value)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
MEdge *medge = (MEdge *)ptr->data;
|
2017-09-18 21:11:41 +10:00
|
|
|
medge->bweight = round_fl_to_uchar_clamp(value * 255.0f);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static float rna_MEdge_crease_get(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
MEdge *medge = (MEdge *)ptr->data;
|
|
|
|
return medge->crease / 255.0f;
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_MEdge_crease_set(PointerRNA *ptr, float value)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
MEdge *medge = (MEdge *)ptr->data;
|
2017-09-18 21:11:41 +10:00
|
|
|
medge->crease = round_fl_to_uchar_clamp(value * 255.0f);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2013-09-10 15:26:12 +00:00
|
|
|
static void rna_MeshLoop_normal_get(PointerRNA *ptr, float *values)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
MLoop *ml = (MLoop *)ptr->data;
|
|
|
|
const float (*vec)[3] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_NORMAL);
|
|
|
|
|
|
|
|
if (!vec) {
|
|
|
|
zero_v3(values);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
copy_v3_v3(values, (const float *)vec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add Custom Loop Normals.
This is the core code for it, tools (datatransfer and modifier) will come in next commits).
RNA api is already there, though.
See the code for details, but basically, we define, for each 'smooth fan'
(which is a set of adjacent loops around a same vertex that are smooth, i.e. have a single same normal),
a 'loop normal space' (or lnor space), using auto-computed normal and relevant edges, and store
custom normal as two angular factors inside that space. This allows to have custom normals
'following' deformations of the geometry, and to only save two shorts per loop in new clnor CDLayer.
Normal manipulation (editing, mixing, interpolating, etc.) shall always happen with plain 3D vectors normals,
and be converted back into storage format at the end.
Clnor computation has also been threaded (at least for Mesh case, not for BMesh), since the process can
be rather heavy with high poly meshes.
Also, bumping subversion, and fix mess in 2.70 versioning code.
2015-02-05 14:24:48 +01:00
|
|
|
static void rna_MeshLoop_normal_set(PointerRNA *ptr, const float *values)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
MLoop *ml = (MLoop *)ptr->data;
|
|
|
|
float (*vec)[3] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_NORMAL);
|
|
|
|
|
|
|
|
if (vec) {
|
|
|
|
normalize_v3_v3(*vec, values);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-11 11:31:44 +01:00
|
|
|
static void rna_MeshLoop_tangent_get(PointerRNA *ptr, float *values)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
MLoop *ml = (MLoop *)ptr->data;
|
|
|
|
const float (*vec)[4] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_MLOOPTANGENT);
|
|
|
|
|
|
|
|
if (!vec) {
|
|
|
|
zero_v3(values);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
copy_v3_v3(values, (const float *)vec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static float rna_MeshLoop_bitangent_sign_get(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
MLoop *ml = (MLoop *)ptr->data;
|
|
|
|
const float (*vec)[4] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_MLOOPTANGENT);
|
|
|
|
|
|
|
|
return (vec) ? (*vec)[3] : 0.0f;
|
|
|
|
}
|
|
|
|
|
2014-01-24 17:49:29 +01:00
|
|
|
static void rna_MeshLoop_bitangent_get(PointerRNA *ptr, float *values)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
MLoop *ml = (MLoop *)ptr->data;
|
|
|
|
const float (*nor)[3] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_NORMAL);
|
|
|
|
const float (*vec)[4] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_MLOOPTANGENT);
|
|
|
|
|
|
|
|
if (nor && vec) {
|
|
|
|
cross_v3_v3v3(values, (const float *)nor, (const float *)vec);
|
|
|
|
mul_v3_fl(values, (*vec)[3]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
zero_v3(values);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-31 05:13:21 +00:00
|
|
|
static void rna_MeshPolygon_normal_get(PointerRNA *ptr, float *values)
|
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2012-05-12 11:01:29 +00:00
|
|
|
MPoly *mp = (MPoly *)ptr->data;
|
2011-08-31 05:13:21 +00:00
|
|
|
|
2012-09-25 00:20:42 +00:00
|
|
|
BKE_mesh_calc_poly_normal(mp, me->mloop + mp->loopstart, me->mvert, values);
|
2011-08-31 05:13:21 +00:00
|
|
|
}
|
|
|
|
|
2013-06-05 03:10:29 +00:00
|
|
|
static void rna_MeshPolygon_center_get(PointerRNA *ptr, float *values)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
MPoly *mp = (MPoly *)ptr->data;
|
|
|
|
|
|
|
|
BKE_mesh_calc_poly_center(mp, me->mloop + mp->loopstart, me->mvert, values);
|
|
|
|
}
|
|
|
|
|
2011-11-17 05:03:07 +00:00
|
|
|
static float rna_MeshPolygon_area_get(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Mesh *me = (Mesh *)ptr->id.data;
|
|
|
|
MPoly *mp = (MPoly *)ptr->data;
|
2011-11-17 05:03:07 +00:00
|
|
|
|
2014-04-16 00:27:35 +10:00
|
|
|
return BKE_mesh_calc_poly_area(mp, me->mloop + mp->loopstart, me->mvert);
|
2011-11-17 05:03:07 +00:00
|
|
|
}
|
|
|
|
|
2016-02-28 15:29:56 +01:00
|
|
|
static void rna_MeshPolygon_flip(ID *id, MPoly *mp)
|
|
|
|
{
|
|
|
|
Mesh *me = (Mesh *)id;
|
|
|
|
|
|
|
|
BKE_mesh_polygon_flip(mp, me->mloop, &me->ldata);
|
|
|
|
BKE_mesh_tessface_clear(me);
|
2018-09-06 14:28:14 +02:00
|
|
|
BKE_mesh_runtime_clear_geometry(me);
|
2016-02-28 15:29:56 +01:00
|
|
|
}
|
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
static void rna_MeshLoopTriangle_verts_get(PointerRNA *ptr, int *values)
|
2009-07-27 18:17:21 +00:00
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2018-09-06 14:28:14 +02:00
|
|
|
MLoopTri *lt = (MLoopTri *)ptr->data;
|
|
|
|
values[0] = me->mloop[lt->tri[0]].v;
|
|
|
|
values[1] = me->mloop[lt->tri[1]].v;
|
|
|
|
values[2] = me->mloop[lt->tri[2]].v;
|
2009-07-27 18:17:21 +00:00
|
|
|
}
|
|
|
|
|
2014-04-13 12:18:51 +02:00
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
static void rna_MeshLoopTriangle_normal_get(PointerRNA *ptr, float *values)
|
2009-11-03 17:51:22 +00:00
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2018-09-06 14:28:14 +02:00
|
|
|
MLoopTri *lt = (MLoopTri *)ptr->data;
|
|
|
|
unsigned int v1 = me->mloop[lt->tri[0]].v;
|
|
|
|
unsigned int v2 = me->mloop[lt->tri[1]].v;
|
|
|
|
unsigned int v3 = me->mloop[lt->tri[2]].v;
|
2011-11-25 13:28:04 +00:00
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
normal_tri_v3(values, me->mvert[v1].co, me->mvert[v2].co, me->mvert[v3].co);
|
2011-11-25 13:28:04 +00:00
|
|
|
}
|
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
static void rna_MeshLoopTriangle_split_normals_get(PointerRNA *ptr, float *values)
|
2011-11-25 13:28:04 +00:00
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
2018-09-06 14:28:14 +02:00
|
|
|
const float (*lnors)[3] = CustomData_get_layer(&me->ldata, CD_NORMAL);
|
2011-11-25 13:28:04 +00:00
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
if (!lnors) {
|
|
|
|
zero_v3(values + 0);
|
|
|
|
zero_v3(values + 3);
|
|
|
|
zero_v3(values + 6);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
MLoopTri *lt = (MLoopTri *)ptr->data;
|
|
|
|
copy_v3_v3(values + 0, lnors[lt->tri[0]]);
|
|
|
|
copy_v3_v3(values + 3, lnors[lt->tri[1]]);
|
|
|
|
copy_v3_v3(values + 6, lnors[lt->tri[2]]);
|
2011-11-25 13:28:04 +00:00
|
|
|
}
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
static float rna_MeshLoopTriangle_area_get(PointerRNA *ptr)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2018-09-06 14:28:14 +02:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
MLoopTri *lt = (MLoopTri *)ptr->data;
|
|
|
|
unsigned int v1 = me->mloop[lt->tri[0]].v;
|
|
|
|
unsigned int v2 = me->mloop[lt->tri[1]].v;
|
|
|
|
unsigned int v3 = me->mloop[lt->tri[2]].v;
|
2009-02-02 19:57:57 +00:00
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
return area_tri_v3(me->mvert[v1].co, me->mvert[v2].co, me->mvert[v3].co);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2012-01-17 05:15:33 +00:00
|
|
|
static void rna_MeshLoopColor_color_get(PointerRNA *ptr, float *values)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2017-11-20 10:12:21 +01:00
|
|
|
MLoopCol *mlcol = (MLoopCol *)ptr->data;
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2017-11-20 10:12:21 +01:00
|
|
|
values[0] = mlcol->r / 255.0f;
|
|
|
|
values[1] = mlcol->g / 255.0f;
|
|
|
|
values[2] = mlcol->b / 255.0f;
|
|
|
|
values[3] = mlcol->a / 255.0f;
|
2010-04-12 05:04:49 +00:00
|
|
|
}
|
|
|
|
|
2012-01-17 05:15:33 +00:00
|
|
|
static void rna_MeshLoopColor_color_set(PointerRNA *ptr, const float *values)
|
2010-04-12 05:04:49 +00:00
|
|
|
{
|
2017-11-20 10:12:21 +01:00
|
|
|
MLoopCol *mlcol = (MLoopCol *)ptr->data;
|
2010-04-12 05:04:49 +00:00
|
|
|
|
2017-11-20 10:12:21 +01:00
|
|
|
mlcol->r = round_fl_to_uchar_clamp(values[0] * 255.0f);
|
|
|
|
mlcol->g = round_fl_to_uchar_clamp(values[1] * 255.0f);
|
|
|
|
mlcol->b = round_fl_to_uchar_clamp(values[2] * 255.0f);
|
|
|
|
mlcol->a = round_fl_to_uchar_clamp(values[3] * 255.0f);
|
2010-04-12 05:04:49 +00:00
|
|
|
}
|
|
|
|
|
2016-09-22 00:10:53 +02:00
|
|
|
static int rna_Mesh_texspace_editable(PointerRNA *ptr, const char **UNUSED(r_info))
|
2010-04-12 05:04:49 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Mesh *me = (Mesh *)ptr->data;
|
|
|
|
return (me->texflag & ME_AUTOSPACE) ? 0 : PROP_EDITABLE;
|
2010-04-12 05:04:49 +00:00
|
|
|
}
|
|
|
|
|
2012-05-08 23:39:31 +00:00
|
|
|
static void rna_Mesh_texspace_size_get(PointerRNA *ptr, float values[3])
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Mesh *me = (Mesh *)ptr->data;
|
2012-05-08 23:39:31 +00:00
|
|
|
|
2013-08-19 09:58:28 +00:00
|
|
|
if (me->bb == NULL || (me->bb->flag & BOUNDBOX_DIRTY)) {
|
2012-05-08 23:39:31 +00:00
|
|
|
BKE_mesh_texspace_calc(me);
|
2013-08-19 09:58:28 +00:00
|
|
|
}
|
2012-05-08 23:39:31 +00:00
|
|
|
|
|
|
|
copy_v3_v3(values, me->size);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Mesh_texspace_loc_get(PointerRNA *ptr, float values[3])
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Mesh *me = (Mesh *)ptr->data;
|
2012-05-08 23:39:31 +00:00
|
|
|
|
2013-08-19 09:58:28 +00:00
|
|
|
if (me->bb == NULL || (me->bb->flag & BOUNDBOX_DIRTY)) {
|
2012-05-08 23:39:31 +00:00
|
|
|
BKE_mesh_texspace_calc(me);
|
2013-08-19 09:58:28 +00:00
|
|
|
}
|
2012-05-08 23:39:31 +00:00
|
|
|
|
|
|
|
copy_v3_v3(values, me->loc);
|
|
|
|
}
|
|
|
|
|
2009-01-02 14:48:03 +00:00
|
|
|
static void rna_MeshVertex_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
if (me->dvert) {
|
2012-05-12 11:01:29 +00:00
|
|
|
MVert *mvert = (MVert *)ptr->data;
|
|
|
|
MDeformVert *dvert = me->dvert + (mvert - me->mvert);
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
rna_iterator_array_begin(iter, (void *)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
else
|
2009-07-13 19:33:59 +00:00
|
|
|
rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2013-05-05 05:56:41 +00:00
|
|
|
static void rna_MeshVertex_undeformed_co_get(PointerRNA *ptr, float values[3])
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
MVert *mvert = (MVert *)ptr->data;
|
|
|
|
float (*orco)[3] = CustomData_get_layer(&me->vdata, CD_ORCO);
|
|
|
|
|
|
|
|
if (orco) {
|
|
|
|
/* orco is normalized to 0..1, we do inverse to match mvert->co */
|
|
|
|
float loc[3], size[3];
|
|
|
|
|
|
|
|
BKE_mesh_texspace_get(me->texcomesh ? me->texcomesh : me, loc, NULL, size);
|
|
|
|
madd_v3_v3v3v3(values, loc, orco[(mvert - me->mvert)], size);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
copy_v3_v3(values, mvert->co);
|
|
|
|
}
|
|
|
|
|
2015-02-20 19:54:28 +11:00
|
|
|
static int rna_CustomDataLayer_active_get(PointerRNA *ptr, CustomData *data, int type, bool render)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
int n = ((CustomDataLayer *)ptr->data) - data->layers;
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
if (render) return (n == CustomData_get_render_layer_index(data, type));
|
2011-11-17 05:03:07 +00:00
|
|
|
else return (n == CustomData_get_active_layer_index(data, type));
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static int rna_CustomDataLayer_clone_get(PointerRNA *ptr, CustomData *data, int type)
|
2009-11-24 00:56:52 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
int n = ((CustomDataLayer *)ptr->data) - data->layers;
|
2009-11-24 00:56:52 +00:00
|
|
|
|
2011-11-17 05:03:07 +00:00
|
|
|
return (n == CustomData_get_clone_layer_index(data, type));
|
2009-11-24 00:56:52 +00:00
|
|
|
}
|
|
|
|
|
2011-11-17 05:03:07 +00:00
|
|
|
static void rna_CustomDataLayer_active_set(PointerRNA *ptr, CustomData *data, int value, int type, int render)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2012-05-18 15:06:26 +00:00
|
|
|
Mesh *me = ptr->id.data;
|
2012-05-12 11:01:29 +00:00
|
|
|
int n = (((CustomDataLayer *)ptr->data) - data->layers) - CustomData_get_layer_index(data, type);
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
if (value == 0)
|
2008-11-24 12:12:24 +00:00
|
|
|
return;
|
|
|
|
|
2012-03-26 04:23:18 +00:00
|
|
|
if (render) CustomData_set_layer_render(data, type, n);
|
2012-05-12 11:01:29 +00:00
|
|
|
else CustomData_set_layer_active(data, type, n);
|
2012-03-26 04:23:18 +00:00
|
|
|
|
2013-03-17 19:55:10 +00:00
|
|
|
BKE_mesh_update_customdata_pointers(me, true);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int value, int type)
|
2009-11-24 00:56:52 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
int n = ((CustomDataLayer *)ptr->data) - data->layers;
|
2009-11-24 00:56:52 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
if (value == 0)
|
2009-11-24 00:56:52 +00:00
|
|
|
return;
|
|
|
|
|
2011-11-17 05:03:07 +00:00
|
|
|
CustomData_set_layer_clone_index(data, type, n);
|
2009-11-24 00:56:52 +00:00
|
|
|
}
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_MEdge_freestyle_edge_mark_get(PointerRNA *ptr)
|
2014-04-15 13:29:03 +09:00
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
MEdge *medge = (MEdge *)ptr->data;
|
|
|
|
FreestyleEdge *fed = CustomData_get(&me->edata, (int)(medge - me->medge), CD_FREESTYLE_EDGE);
|
|
|
|
|
|
|
|
return fed && (fed->flag & FREESTYLE_EDGE_MARK) != 0;
|
|
|
|
}
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static void rna_MEdge_freestyle_edge_mark_set(PointerRNA *ptr, bool value)
|
2014-04-15 13:29:03 +09:00
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
MEdge *medge = (MEdge *)ptr->data;
|
|
|
|
FreestyleEdge *fed = CustomData_get(&me->edata, (int)(medge - me->medge), CD_FREESTYLE_EDGE);
|
|
|
|
|
|
|
|
if (!fed) {
|
|
|
|
fed = CustomData_add_layer(&me->edata, CD_FREESTYLE_EDGE, CD_CALLOC, NULL, me->totedge);
|
|
|
|
}
|
|
|
|
if (value) {
|
|
|
|
fed->flag |= FREESTYLE_EDGE_MARK;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fed->flag &= ~FREESTYLE_EDGE_MARK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_MPoly_freestyle_face_mark_get(PointerRNA *ptr)
|
2014-04-15 13:29:03 +09:00
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
MPoly *mpoly = (MPoly *)ptr->data;
|
|
|
|
FreestyleFace *ffa = CustomData_get(&me->pdata, (int)(mpoly - me->mpoly), CD_FREESTYLE_FACE);
|
|
|
|
|
|
|
|
return ffa && (ffa->flag & FREESTYLE_FACE_MARK) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_MPoly_freestyle_face_mark_set(PointerRNA *ptr, int value)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
MPoly *mpoly = (MPoly *)ptr->data;
|
|
|
|
FreestyleFace *ffa = CustomData_get(&me->pdata, (int)(mpoly - me->mpoly), CD_FREESTYLE_FACE);
|
|
|
|
|
|
|
|
if (!ffa) {
|
|
|
|
ffa = CustomData_add_layer(&me->pdata, CD_FREESTYLE_FACE, CD_CALLOC, NULL, me->totpoly);
|
|
|
|
}
|
|
|
|
if (value) {
|
|
|
|
ffa->flag |= FREESTYLE_FACE_MARK;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ffa->flag &= ~FREESTYLE_FACE_MARK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-20 11:14:08 +00:00
|
|
|
/* Generic UV rename! */
|
|
|
|
static void rna_MeshUVLayer_name_set(PointerRNA *ptr, const char *name)
|
|
|
|
{
|
|
|
|
char buf[MAX_CUSTOMDATA_LAYER_NAME];
|
|
|
|
BLI_strncpy_utf8(buf, name, MAX_CUSTOMDATA_LAYER_NAME);
|
|
|
|
BKE_mesh_uv_cdlayer_rename(rna_mesh(ptr), ((CustomDataLayer *)ptr->data)->name, buf, true);
|
|
|
|
}
|
|
|
|
|
2012-04-22 23:51:50 +00:00
|
|
|
/* uv_layers */
|
2009-12-22 10:48:13 +00:00
|
|
|
|
2012-04-22 23:51:50 +00:00
|
|
|
DEFINE_CUSTOMDATA_LAYER_COLLECTION(uv_layer, ldata, CD_MLOOPUV)
|
|
|
|
DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, active, MeshUVLoopLayer)
|
|
|
|
DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, clone, MeshUVLoopLayer)
|
|
|
|
DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, stencil, MeshUVLoopLayer)
|
|
|
|
DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, render, MeshUVLoopLayer)
|
2009-06-27 01:10:39 +00:00
|
|
|
|
2011-11-24 06:55:53 +00:00
|
|
|
/* MeshUVLoopLayer */
|
2009-06-27 01:10:39 +00:00
|
|
|
|
2013-03-08 04:00:06 +00:00
|
|
|
static char *rna_MeshUVLoopLayer_path(PointerRNA *ptr)
|
2009-11-24 00:56:52 +00:00
|
|
|
{
|
2013-04-23 20:10:22 +00:00
|
|
|
CustomDataLayer *cdl = ptr->data;
|
|
|
|
char name_esc[sizeof(cdl->name) * 2];
|
|
|
|
BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
|
|
|
|
return BLI_sprintfN("uv_layers[\"%s\"]", name_esc);
|
2009-12-22 10:48:13 +00:00
|
|
|
}
|
|
|
|
|
2011-11-24 06:55:53 +00:00
|
|
|
static void rna_MeshUVLoopLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
2009-12-22 10:48:13 +00:00
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2011-11-24 06:55:53 +00:00
|
|
|
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
|
2019-02-17 18:05:18 +11:00
|
|
|
rna_iterator_array_begin(iter, layer->data, sizeof(MLoopUV), (me->edit_mesh) ? 0 : me->totloop, 0, NULL);
|
2009-11-24 00:56:52 +00:00
|
|
|
}
|
|
|
|
|
2011-11-24 06:55:53 +00:00
|
|
|
static int rna_MeshUVLoopLayer_data_length(PointerRNA *ptr)
|
2009-07-01 22:25:49 +00:00
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2019-02-17 18:05:18 +11:00
|
|
|
return (me->edit_mesh) ? 0 : me->totloop;
|
2009-12-22 10:48:13 +00:00
|
|
|
}
|
|
|
|
|
2018-07-05 22:46:04 +02:00
|
|
|
static bool rna_MeshUVLoopLayer_active_render_get(PointerRNA *ptr)
|
2017-05-25 15:11:00 +10:00
|
|
|
{
|
|
|
|
return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPUV, 1);
|
|
|
|
}
|
|
|
|
|
2018-07-05 22:46:04 +02:00
|
|
|
static bool rna_MeshUVLoopLayer_active_get(PointerRNA *ptr)
|
2017-05-25 15:11:00 +10:00
|
|
|
{
|
|
|
|
return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPUV, 0);
|
|
|
|
}
|
|
|
|
|
2018-07-05 22:46:04 +02:00
|
|
|
static bool rna_MeshUVLoopLayer_clone_get(PointerRNA *ptr)
|
2017-05-25 15:11:00 +10:00
|
|
|
{
|
|
|
|
return rna_CustomDataLayer_clone_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPUV);
|
|
|
|
}
|
|
|
|
|
2018-07-05 22:46:04 +02:00
|
|
|
static void rna_MeshUVLoopLayer_active_render_set(PointerRNA *ptr, bool value)
|
2017-05-25 15:11:00 +10:00
|
|
|
{
|
|
|
|
rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPUV, 1);
|
|
|
|
}
|
|
|
|
|
2018-07-05 22:46:04 +02:00
|
|
|
static void rna_MeshUVLoopLayer_active_set(PointerRNA *ptr, bool value)
|
2017-05-25 15:11:00 +10:00
|
|
|
{
|
|
|
|
rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPUV, 0);
|
|
|
|
}
|
|
|
|
|
2018-07-05 22:46:04 +02:00
|
|
|
static void rna_MeshUVLoopLayer_clone_set(PointerRNA *ptr, bool value)
|
2017-05-25 15:11:00 +10:00
|
|
|
{
|
|
|
|
rna_CustomDataLayer_clone_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPUV);
|
|
|
|
}
|
|
|
|
|
2011-11-24 06:55:53 +00:00
|
|
|
/* vertex_color_layers */
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2011-11-25 13:28:04 +00:00
|
|
|
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)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2011-11-25 13:28:04 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2012-05-12 11:01:29 +00:00
|
|
|
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
|
2019-02-17 18:05:18 +11:00
|
|
|
rna_iterator_array_begin(iter, layer->data, sizeof(MLoopCol), (me->edit_mesh) ? 0 : me->totloop, 0, NULL);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2011-11-25 13:28:04 +00:00
|
|
|
static int rna_MeshLoopColorLayer_data_length(PointerRNA *ptr)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2011-11-25 13:28:04 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2019-02-17 18:05:18 +11:00
|
|
|
return (me->edit_mesh) ? 0 : me->totloop;
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_MeshLoopColorLayer_active_render_get(PointerRNA *ptr)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2011-11-25 13:28:04 +00:00
|
|
|
return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPCOL, 1);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_MeshLoopColorLayer_active_get(PointerRNA *ptr)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2011-11-25 13:28:04 +00:00
|
|
|
return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPCOL, 0);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static void rna_MeshLoopColorLayer_active_render_set(PointerRNA *ptr, bool value)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2011-11-25 13:28:04 +00:00
|
|
|
rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPCOL, 1);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static void rna_MeshLoopColorLayer_active_set(PointerRNA *ptr, bool value)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPCOL, 0);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static int rna_float_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
CustomDataLayer *layer = (CustomDataLayer *)data;
|
2008-11-24 12:12:24 +00:00
|
|
|
return (layer->type != CD_PROP_FLT);
|
|
|
|
}
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
static void rna_Mesh_vertex_float_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
CustomData *vdata = rna_mesh_vdata(ptr);
|
|
|
|
rna_iterator_array_begin(iter, (void *)vdata->layers, sizeof(CustomDataLayer), vdata->totlayer, 0,
|
|
|
|
rna_float_layer_check);
|
|
|
|
}
|
2012-04-03 11:10:26 +00:00
|
|
|
static void rna_Mesh_polygon_float_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
CustomData *pdata = rna_mesh_pdata(ptr);
|
2012-05-12 11:01:29 +00:00
|
|
|
rna_iterator_array_begin(iter, (void *)pdata->layers, sizeof(CustomDataLayer), pdata->totlayer, 0,
|
2012-03-05 16:19:16 +00:00
|
|
|
rna_float_layer_check);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
static int rna_Mesh_vertex_float_layers_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return CustomData_number_of_layers(rna_mesh_vdata(ptr), CD_PROP_FLT);
|
|
|
|
}
|
2012-04-03 11:10:26 +00:00
|
|
|
static int rna_Mesh_polygon_float_layers_length(PointerRNA *ptr)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2011-11-20 16:21:13 +00:00
|
|
|
return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_FLT);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static int rna_int_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
CustomDataLayer *layer = (CustomDataLayer *)data;
|
2008-11-24 12:12:24 +00:00
|
|
|
return (layer->type != CD_PROP_INT);
|
|
|
|
}
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
static void rna_Mesh_vertex_int_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
CustomData *vdata = rna_mesh_vdata(ptr);
|
|
|
|
rna_iterator_array_begin(iter, (void *)vdata->layers, sizeof(CustomDataLayer), vdata->totlayer, 0,
|
|
|
|
rna_int_layer_check);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
2012-04-03 11:10:26 +00:00
|
|
|
static void rna_Mesh_polygon_int_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
CustomData *pdata = rna_mesh_pdata(ptr);
|
2012-05-12 11:01:29 +00:00
|
|
|
rna_iterator_array_begin(iter, (void *)pdata->layers, sizeof(CustomDataLayer), pdata->totlayer, 0,
|
2012-03-05 16:19:16 +00:00
|
|
|
rna_int_layer_check);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
static int rna_Mesh_vertex_int_layers_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return CustomData_number_of_layers(rna_mesh_vdata(ptr), CD_PROP_INT);
|
|
|
|
}
|
2012-04-03 11:10:26 +00:00
|
|
|
static int rna_Mesh_polygon_int_layers_length(PointerRNA *ptr)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2011-11-20 16:21:13 +00:00
|
|
|
return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_INT);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static int rna_string_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
CustomDataLayer *layer = (CustomDataLayer *)data;
|
2008-11-24 12:12:24 +00:00
|
|
|
return (layer->type != CD_PROP_STR);
|
|
|
|
}
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
static void rna_Mesh_vertex_string_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
CustomData *vdata = rna_mesh_vdata(ptr);
|
|
|
|
rna_iterator_array_begin(iter, (void *)vdata->layers, sizeof(CustomDataLayer), vdata->totlayer, 0,
|
|
|
|
rna_string_layer_check);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
2012-04-03 11:10:26 +00:00
|
|
|
static void rna_Mesh_polygon_string_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
CustomData *pdata = rna_mesh_pdata(ptr);
|
2012-05-12 11:01:29 +00:00
|
|
|
rna_iterator_array_begin(iter, (void *)pdata->layers, sizeof(CustomDataLayer), pdata->totlayer, 0,
|
2012-03-05 16:19:16 +00:00
|
|
|
rna_string_layer_check);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
static int rna_Mesh_vertex_string_layers_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return CustomData_number_of_layers(rna_mesh_vdata(ptr), CD_PROP_STR);
|
|
|
|
}
|
2012-04-03 11:10:26 +00:00
|
|
|
static int rna_Mesh_polygon_string_layers_length(PointerRNA *ptr)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
2011-11-20 16:21:13 +00:00
|
|
|
return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_STR);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2012-05-22 15:18:43 +00:00
|
|
|
/* Skin vertices */
|
2013-07-20 15:07:57 +00:00
|
|
|
DEFINE_CUSTOMDATA_LAYER_COLLECTION(skin_vertice, vdata, CD_MVERT_SKIN)
|
2012-05-22 15:18:43 +00:00
|
|
|
|
|
|
|
static char *rna_MeshSkinVertexLayer_path(PointerRNA *ptr)
|
|
|
|
{
|
2013-04-23 20:10:22 +00:00
|
|
|
CustomDataLayer *cdl = ptr->data;
|
|
|
|
char name_esc[sizeof(cdl->name) * 2];
|
|
|
|
BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
|
|
|
|
return BLI_sprintfN("skin_vertices[\"%s\"]", name_esc);
|
2012-05-22 15:18:43 +00:00
|
|
|
}
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static char *rna_VertCustomData_data_path(PointerRNA *ptr, const char *collection, int type);
|
2012-05-22 15:18:43 +00:00
|
|
|
static char *rna_MeshSkinVertex_path(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return rna_VertCustomData_data_path(ptr, "skin_vertices", CD_MVERT_SKIN);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_MeshSkinVertexLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
|
|
|
|
rna_iterator_array_begin(iter, layer->data, sizeof(MVertSkin), me->totvert, 0, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_MeshSkinVertexLayer_data_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
return me->totvert;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* End skin vertices */
|
|
|
|
|
2014-11-03 23:31:55 +01:00
|
|
|
/* Paint mask */
|
|
|
|
DEFINE_CUSTOMDATA_LAYER_COLLECTION(vertex_paint_mask, vdata, CD_PAINT_MASK)
|
|
|
|
|
|
|
|
static char *rna_MeshPaintMaskLayer_path(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
CustomDataLayer *cdl = ptr->data;
|
|
|
|
char name_esc[sizeof(cdl->name) * 2];
|
|
|
|
BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
|
|
|
|
return BLI_sprintfN("vertex_paint_masks[\"%s\"]", name_esc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *rna_MeshPaintMask_path(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return rna_VertCustomData_data_path(ptr, "vertex_paint_masks", CD_PAINT_MASK);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_MeshPaintMaskLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
|
|
|
|
rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), me->totvert, 0, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_MeshPaintMaskLayer_data_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
return me->totvert;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* End paint mask */
|
|
|
|
|
2017-07-20 18:37:30 +10:00
|
|
|
/* Face maps */
|
|
|
|
|
|
|
|
DEFINE_CUSTOMDATA_LAYER_COLLECTION(face_map, pdata, CD_FACEMAP)
|
|
|
|
DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(face_map, pdata, CD_FACEMAP, active, MeshFaceMapLayer)
|
|
|
|
|
|
|
|
static char *rna_MeshFaceMapLayer_path(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
CustomDataLayer *cdl = ptr->data;
|
|
|
|
char name_esc[sizeof(cdl->name) * 2];
|
|
|
|
BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
|
|
|
|
return BLI_sprintfN("face_maps[\"%s\"]", name_esc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_MeshFaceMapLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
|
|
|
|
rna_iterator_array_begin(iter, layer->data, sizeof(int), me->totpoly, 0, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_MeshFaceMapLayer_data_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
return me->totpoly;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PointerRNA rna_Mesh_face_map_new(struct Mesh *me, ReportList *reports, const char *name)
|
|
|
|
{
|
|
|
|
if (BKE_mesh_ensure_facemap_customdata(me) == false) {
|
|
|
|
BKE_report(reports, RPT_ERROR, "Currently only single face-map layers are supported");
|
|
|
|
return PointerRNA_NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
CustomData *pdata = rna_mesh_pdata_helper(me);
|
|
|
|
|
|
|
|
int index = CustomData_get_layer_index(pdata, CD_FACEMAP);
|
|
|
|
BLI_assert(index != -1);
|
|
|
|
CustomDataLayer *cdl = &pdata->layers[index];
|
|
|
|
rna_cd_layer_name_set(pdata, cdl, name);
|
|
|
|
|
|
|
|
PointerRNA ptr;
|
|
|
|
RNA_pointer_create(&me->id, &RNA_MeshFaceMapLayer, cdl, &ptr);
|
|
|
|
return ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Mesh_face_map_remove(struct Mesh *me, ReportList *reports, struct CustomDataLayer *layer)
|
|
|
|
{
|
|
|
|
/* just for sanity check */
|
|
|
|
{
|
|
|
|
CustomData *pdata = rna_mesh_pdata_helper(me);
|
|
|
|
int index = CustomData_get_layer_index(pdata, CD_FACEMAP);
|
|
|
|
if (index != -1) {
|
|
|
|
CustomDataLayer *layer_test = &pdata->layers[index];
|
|
|
|
if (layer != layer_test) {
|
|
|
|
/* don't show name, its likely freed memory */
|
|
|
|
BKE_report(reports, RPT_ERROR, "FaceMap not in mesh");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (BKE_mesh_clear_facemap_customdata(me) == false) {
|
2019-03-24 16:09:46 +11:00
|
|
|
BKE_report(reports, RPT_ERROR, "Error removing face-map");
|
2017-07-20 18:37:30 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* End face maps */
|
|
|
|
|
|
|
|
|
2011-08-31 11:21:54 +00:00
|
|
|
/* poly.vertices - this is faked loop access for convenience */
|
|
|
|
static int rna_MeshPoly_vertices_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
MPoly *mp = (MPoly *)ptr->data;
|
2011-08-31 11:21:54 +00:00
|
|
|
/* note, raw access uses dummy item, this _could_ crash, watch out for this, mface uses it but it cant work here */
|
2012-03-05 16:19:16 +00:00
|
|
|
return (length[0] = mp->totloop);
|
2011-08-31 11:21:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_MeshPoly_vertices_get(PointerRNA *ptr, int *values)
|
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2012-05-12 11:01:29 +00:00
|
|
|
MPoly *mp = (MPoly *)ptr->data;
|
2012-03-05 16:19:16 +00:00
|
|
|
MLoop *ml = &me->mloop[mp->loopstart];
|
2011-08-31 11:21:54 +00:00
|
|
|
unsigned int i;
|
2012-03-05 16:19:16 +00:00
|
|
|
for (i = mp->totloop; i > 0; i--, values++, ml++) {
|
2011-08-31 11:21:54 +00:00
|
|
|
*values = ml->v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_MeshPoly_vertices_set(PointerRNA *ptr, const int *values)
|
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2012-05-12 11:01:29 +00:00
|
|
|
MPoly *mp = (MPoly *)ptr->data;
|
2012-03-05 16:19:16 +00:00
|
|
|
MLoop *ml = &me->mloop[mp->loopstart];
|
2011-08-31 11:21:54 +00:00
|
|
|
unsigned int i;
|
2012-03-05 16:19:16 +00:00
|
|
|
for (i = mp->totloop; i > 0; i--, values++, ml++) {
|
2011-08-31 11:21:54 +00:00
|
|
|
ml->v = *values;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-20 12:48:44 +00:00
|
|
|
/* disabling, some importers don't know the total material count when assigning materials */
|
|
|
|
#if 0
|
2012-03-30 16:09:05 +00:00
|
|
|
static void rna_MeshPoly_material_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
|
2012-03-23 00:28:29 +00:00
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
*min = 0;
|
2012-11-07 12:31:05 +00:00
|
|
|
*max = max_ii(0, me->totcol - 1);
|
2012-03-23 00:28:29 +00:00
|
|
|
}
|
2013-08-20 12:48:44 +00:00
|
|
|
#endif
|
2011-08-31 11:21:54 +00:00
|
|
|
|
2009-10-12 19:34:58 +00:00
|
|
|
static int rna_MeshVertex_index_get(PointerRNA *ptr)
|
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2012-05-12 11:01:29 +00:00
|
|
|
MVert *vert = (MVert *)ptr->data;
|
2009-10-12 19:34:58 +00:00
|
|
|
return (int)(vert - me->mvert);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_MeshEdge_index_get(PointerRNA *ptr)
|
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2012-05-12 11:01:29 +00:00
|
|
|
MEdge *edge = (MEdge *)ptr->data;
|
2009-10-12 19:34:58 +00:00
|
|
|
return (int)(edge - me->medge);
|
|
|
|
}
|
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
static int rna_MeshLoopTriangle_index_get(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
MLoopTri *ltri = (MLoopTri *)ptr->data;
|
|
|
|
return (int)(ltri - me->runtime.looptris.array);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_MeshLoopTriangle_material_index_get(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
MLoopTri *ltri = (MLoopTri *)ptr->data;
|
|
|
|
return me->mpoly[ltri->poly].mat_nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool rna_MeshLoopTriangle_use_smooth_get(PointerRNA *ptr)
|
2009-10-12 19:34:58 +00:00
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2018-09-06 14:28:14 +02:00
|
|
|
MLoopTri *ltri = (MLoopTri *)ptr->data;
|
|
|
|
return me->mpoly[ltri->poly].flag & ME_SMOOTH;
|
2009-10-12 19:34:58 +00:00
|
|
|
}
|
|
|
|
|
2011-08-31 05:13:21 +00:00
|
|
|
static int rna_MeshPolygon_index_get(PointerRNA *ptr)
|
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2012-05-12 11:01:29 +00:00
|
|
|
MPoly *mpoly = (MPoly *)ptr->data;
|
2011-08-31 05:13:21 +00:00
|
|
|
return (int)(mpoly - me->mpoly);
|
|
|
|
}
|
|
|
|
|
2012-02-24 15:53:26 +00:00
|
|
|
static int rna_MeshLoop_index_get(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
2012-05-12 11:01:29 +00:00
|
|
|
MLoop *mloop = (MLoop *)ptr->data;
|
2012-02-24 15:53:26 +00:00
|
|
|
return (int)(mloop - me->mloop);
|
|
|
|
}
|
|
|
|
|
2009-03-25 20:29:01 +00:00
|
|
|
/* path construction */
|
|
|
|
|
|
|
|
static char *rna_VertexGroupElement_path(PointerRNA *ptr)
|
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr); /* XXX not always! */
|
2012-05-12 11:01:29 +00:00
|
|
|
MDeformWeight *dw = (MDeformWeight *)ptr->data;
|
2009-03-25 20:29:01 +00:00
|
|
|
MDeformVert *dvert;
|
|
|
|
int a, b;
|
2012-03-05 16:19:16 +00:00
|
|
|
|
|
|
|
for (a = 0, dvert = me->dvert; a < me->totvert; a++, dvert++)
|
|
|
|
for (b = 0; b < dvert->totweight; b++)
|
|
|
|
if (dw == &dvert->dw[b])
|
2012-05-29 11:00:12 +00:00
|
|
|
return BLI_sprintfN("vertices[%d].groups[%d]", a, b);
|
2009-03-25 20:29:01 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-08-31 05:13:21 +00:00
|
|
|
static char *rna_MeshPolygon_path(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
return BLI_sprintfN("polygons[%d]", (int)((MPoly *)ptr->data - rna_mesh(ptr)->mpoly));
|
2011-08-31 05:13:21 +00:00
|
|
|
}
|
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
static char *rna_MeshLoopTriangle_path(PointerRNA *ptr)
|
2009-03-25 20:29:01 +00:00
|
|
|
{
|
2018-09-06 14:28:14 +02:00
|
|
|
return BLI_sprintfN("loop_triangles[%d]", (int)((MLoopTri *)ptr->data - rna_mesh(ptr)->runtime.looptris.array));
|
2009-03-25 20:29:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static char *rna_MeshEdge_path(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
return BLI_sprintfN("edges[%d]", (int)((MEdge *)ptr->data - rna_mesh(ptr)->medge));
|
2009-03-25 20:29:01 +00:00
|
|
|
}
|
|
|
|
|
2011-08-31 11:21:54 +00:00
|
|
|
static char *rna_MeshLoop_path(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
return BLI_sprintfN("loops[%d]", (int)((MLoop *)ptr->data - rna_mesh(ptr)->mloop));
|
2009-03-25 20:29:01 +00:00
|
|
|
}
|
|
|
|
|
2011-08-31 11:21:54 +00:00
|
|
|
|
2009-03-25 20:29:01 +00:00
|
|
|
static char *rna_MeshVertex_path(PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
return BLI_sprintfN("vertices[%d]", (int)((MVert *)ptr->data - rna_mesh(ptr)->mvert));
|
2009-03-25 20:29:01 +00:00
|
|
|
}
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static char *rna_VertCustomData_data_path(PointerRNA *ptr, const char *collection, int type)
|
2012-05-22 15:18:43 +00:00
|
|
|
{
|
|
|
|
CustomDataLayer *cdl;
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
CustomData *vdata = rna_mesh_vdata(ptr);
|
2019-02-17 18:05:18 +11:00
|
|
|
int a, b, totvert = (me->edit_mesh) ? 0 : me->totvert;
|
2012-05-22 15:18:43 +00:00
|
|
|
|
|
|
|
for (cdl = vdata->layers, a = 0; a < vdata->totlayer; cdl++, a++) {
|
|
|
|
if (cdl->type == type) {
|
|
|
|
b = ((char *)ptr->data - ((char *)cdl->data)) / CustomData_sizeof(type);
|
2013-04-23 20:10:22 +00:00
|
|
|
if (b >= 0 && b < totvert) {
|
|
|
|
char name_esc[sizeof(cdl->name) * 2];
|
|
|
|
BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
|
|
|
|
return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, name_esc, b);
|
|
|
|
}
|
2012-05-22 15:18:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static char *rna_PolyCustomData_data_path(PointerRNA *ptr, const char *collection, int type)
|
2009-03-25 20:29:01 +00:00
|
|
|
{
|
|
|
|
CustomDataLayer *cdl;
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
CustomData *pdata = rna_mesh_pdata(ptr);
|
2019-02-17 18:05:18 +11:00
|
|
|
int a, b, totpoly = (me->edit_mesh) ? 0 : me->totpoly;
|
2009-03-25 20:29:01 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
for (cdl = pdata->layers, a = 0; a < pdata->totlayer; cdl++, a++) {
|
|
|
|
if (cdl->type == type) {
|
2012-05-12 11:01:29 +00:00
|
|
|
b = ((char *)ptr->data - ((char *)cdl->data)) / CustomData_sizeof(type);
|
2013-04-23 20:10:22 +00:00
|
|
|
if (b >= 0 && b < totpoly) {
|
|
|
|
char name_esc[sizeof(cdl->name) * 2];
|
|
|
|
BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
|
|
|
|
return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, name_esc, b);
|
|
|
|
}
|
2009-03-25 20:29:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static char *rna_LoopCustomData_data_path(PointerRNA *ptr, const char *collection, int type)
|
2011-11-17 05:03:07 +00:00
|
|
|
{
|
|
|
|
CustomDataLayer *cdl;
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
CustomData *ldata = rna_mesh_ldata(ptr);
|
2019-02-17 18:05:18 +11:00
|
|
|
int a, b, totloop = (me->edit_mesh) ? 0 : me->totloop;
|
2011-11-17 05:03:07 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
for (cdl = ldata->layers, a = 0; a < ldata->totlayer; cdl++, a++) {
|
|
|
|
if (cdl->type == type) {
|
2012-05-12 11:01:29 +00:00
|
|
|
b = ((char *)ptr->data - ((char *)cdl->data)) / CustomData_sizeof(type);
|
2013-04-23 20:10:22 +00:00
|
|
|
if (b >= 0 && b < totloop) {
|
|
|
|
char name_esc[sizeof(cdl->name) * 2];
|
|
|
|
BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
|
|
|
|
return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, name_esc, b);
|
|
|
|
}
|
2011-11-17 05:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *rna_MeshUVLoop_path(PointerRNA *ptr)
|
|
|
|
{
|
2012-04-22 23:51:50 +00:00
|
|
|
return rna_LoopCustomData_data_path(ptr, "uv_layers", CD_MLOOPUV);
|
2011-11-17 05:03:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-25 13:28:04 +00:00
|
|
|
static char *rna_MeshLoopColorLayer_path(PointerRNA *ptr)
|
2009-03-25 20:29:01 +00:00
|
|
|
{
|
2013-04-23 20:10:22 +00:00
|
|
|
CustomDataLayer *cdl = ptr->data;
|
|
|
|
char name_esc[sizeof(cdl->name) * 2];
|
|
|
|
BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
|
|
|
|
return BLI_sprintfN("vertex_colors[\"%s\"]", name_esc);
|
2009-03-25 20:29:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static char *rna_MeshColor_path(PointerRNA *ptr)
|
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
return rna_LoopCustomData_data_path(ptr, "vertex_colors", CD_MLOOPCOL);
|
2009-03-25 20:29:01 +00:00
|
|
|
}
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
/**** Float Property Layer API ****/
|
|
|
|
static char *rna_MeshVertexFloatPropertyLayer_path(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
CustomDataLayer *cdl = ptr->data;
|
|
|
|
char name_esc[sizeof(cdl->name) * 2];
|
|
|
|
BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
|
|
|
|
return BLI_sprintfN("vertex_float_layers[\"%s\"]", name_esc);
|
|
|
|
}
|
|
|
|
static char *rna_MeshPolygonFloatPropertyLayer_path(PointerRNA *ptr)
|
2009-03-25 20:29:01 +00:00
|
|
|
{
|
2013-04-23 20:10:22 +00:00
|
|
|
CustomDataLayer *cdl = ptr->data;
|
|
|
|
char name_esc[sizeof(cdl->name) * 2];
|
|
|
|
BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
return BLI_sprintfN("polygon_float_layers[\"%s\"]", name_esc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *rna_MeshVertexFloatProperty_path(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return rna_VertCustomData_data_path(ptr, "vertex_layers_float", CD_PROP_FLT);
|
|
|
|
}
|
|
|
|
static char *rna_MeshPolygonFloatProperty_path(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return rna_PolyCustomData_data_path(ptr, "polygon_layers_float", CD_PROP_FLT);
|
2009-03-25 20:29:01 +00:00
|
|
|
}
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
static void rna_MeshVertexFloatPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
2009-03-25 20:29:01 +00:00
|
|
|
{
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
|
|
|
|
rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), me->totvert, 0, NULL);
|
|
|
|
}
|
|
|
|
static void rna_MeshPolygonFloatPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
|
|
|
|
rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), me->totpoly, 0, NULL);
|
2009-03-25 20:29:01 +00:00
|
|
|
}
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
static int rna_MeshVertexFloatPropertyLayer_data_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
return me->totvert;
|
|
|
|
}
|
|
|
|
static int rna_MeshPolygonFloatPropertyLayer_data_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
return me->totpoly;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**** Int Property Layer API ****/
|
|
|
|
static char *rna_MeshVertexIntPropertyLayer_path(PointerRNA *ptr)
|
2009-03-25 20:29:01 +00:00
|
|
|
{
|
2013-04-23 20:10:22 +00:00
|
|
|
CustomDataLayer *cdl = ptr->data;
|
|
|
|
char name_esc[sizeof(cdl->name) * 2];
|
|
|
|
BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
return BLI_sprintfN("vertex_int_layers[\"%s\"]", name_esc);
|
|
|
|
}
|
|
|
|
static char *rna_MeshPolygonIntPropertyLayer_path(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
CustomDataLayer *cdl = ptr->data;
|
|
|
|
char name_esc[sizeof(cdl->name) * 2];
|
|
|
|
BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
|
|
|
|
return BLI_sprintfN("polygon_int_layers[\"%s\"]", name_esc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *rna_MeshVertexIntProperty_path(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return rna_VertCustomData_data_path(ptr, "vertex_layers_int", CD_PROP_INT);
|
|
|
|
}
|
|
|
|
static char *rna_MeshPolygonIntProperty_path(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return rna_PolyCustomData_data_path(ptr, "polygon_layers_int", CD_PROP_INT);
|
2009-03-25 20:29:01 +00:00
|
|
|
}
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
static void rna_MeshVertexIntPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
2009-03-25 20:29:01 +00:00
|
|
|
{
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
|
|
|
|
rna_iterator_array_begin(iter, layer->data, sizeof(MIntProperty), me->totvert, 0, NULL);
|
|
|
|
}
|
|
|
|
static void rna_MeshPolygonIntPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
|
|
|
|
rna_iterator_array_begin(iter, layer->data, sizeof(MIntProperty), me->totpoly, 0, NULL);
|
2009-03-25 20:29:01 +00:00
|
|
|
}
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
static int rna_MeshVertexIntPropertyLayer_data_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
return me->totvert;
|
|
|
|
}
|
|
|
|
static int rna_MeshPolygonIntPropertyLayer_data_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
return me->totpoly;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**** String Property Layer API ****/
|
|
|
|
static char *rna_MeshVertexStringPropertyLayer_path(PointerRNA *ptr)
|
2009-03-25 20:29:01 +00:00
|
|
|
{
|
2013-04-23 20:10:22 +00:00
|
|
|
CustomDataLayer *cdl = ptr->data;
|
|
|
|
char name_esc[sizeof(cdl->name) * 2];
|
|
|
|
BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
return BLI_sprintfN("vertex_string_layers[\"%s\"]", name_esc);
|
|
|
|
}
|
|
|
|
static char *rna_MeshPolygonStringPropertyLayer_path(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
CustomDataLayer *cdl = ptr->data;
|
|
|
|
char name_esc[sizeof(cdl->name) * 2];
|
|
|
|
BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
|
|
|
|
return BLI_sprintfN("polygon_string_layers[\"%s\"]", name_esc);
|
2009-03-25 20:29:01 +00:00
|
|
|
}
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
static char *rna_MeshVertexStringProperty_path(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return rna_VertCustomData_data_path(ptr, "vertex_layers_string", CD_PROP_STR);
|
|
|
|
}
|
|
|
|
static char *rna_MeshPolygonStringProperty_path(PointerRNA *ptr)
|
2009-03-25 20:29:01 +00:00
|
|
|
{
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
return rna_PolyCustomData_data_path(ptr, "polygon_layers_string", CD_PROP_STR);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_MeshVertexStringPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
|
|
|
|
rna_iterator_array_begin(iter, layer->data, sizeof(MStringProperty), me->totvert, 0, NULL);
|
|
|
|
}
|
|
|
|
static void rna_MeshPolygonStringPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
|
|
|
|
rna_iterator_array_begin(iter, layer->data, sizeof(MStringProperty), me->totpoly, 0, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_MeshVertexStringPropertyLayer_data_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
return me->totvert;
|
|
|
|
}
|
|
|
|
static int rna_MeshPolygonStringPropertyLayer_data_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
|
|
|
return me->totpoly;
|
2009-03-25 20:29:01 +00:00
|
|
|
}
|
|
|
|
|
2018-01-28 17:00:39 +11:00
|
|
|
/* XXX, we dont have proper byte string support yet, so for now use the (bytes + 1)
|
2013-01-09 13:25:46 +00:00
|
|
|
* bmesh API exposes correct python/bytestring access */
|
|
|
|
void rna_MeshStringProperty_s_get(PointerRNA *ptr, char *value)
|
|
|
|
{
|
|
|
|
MStringProperty *ms = (MStringProperty *)ptr->data;
|
|
|
|
BLI_strncpy(value, ms->s, (int)ms->s_len + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
int rna_MeshStringProperty_s_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
MStringProperty *ms = (MStringProperty *)ptr->data;
|
|
|
|
return (int)ms->s_len + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void rna_MeshStringProperty_s_set(PointerRNA *ptr, const char *value)
|
|
|
|
{
|
|
|
|
MStringProperty *ms = (MStringProperty *)ptr->data;
|
|
|
|
BLI_strncpy(ms->s, value, sizeof(ms->s));
|
|
|
|
}
|
2017-07-20 18:37:30 +10:00
|
|
|
|
|
|
|
static char *rna_MeshFaceMap_path(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return rna_PolyCustomData_data_path(ptr, "face_maps", CD_FACEMAP);
|
|
|
|
}
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
/***************************************/
|
2013-01-09 13:25:46 +00:00
|
|
|
|
2010-02-12 22:03:23 +00:00
|
|
|
static int rna_Mesh_tot_vert_get(PointerRNA *ptr)
|
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2019-02-17 18:05:18 +11:00
|
|
|
return me->edit_mesh ? me->edit_mesh->bm->totvertsel : 0;
|
2010-02-12 22:03:23 +00:00
|
|
|
}
|
|
|
|
static int rna_Mesh_tot_edge_get(PointerRNA *ptr)
|
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2019-02-17 18:05:18 +11:00
|
|
|
return me->edit_mesh ? me->edit_mesh->bm->totedgesel : 0;
|
2010-02-12 22:03:23 +00:00
|
|
|
}
|
|
|
|
static int rna_Mesh_tot_face_get(PointerRNA *ptr)
|
|
|
|
{
|
2011-11-17 05:03:07 +00:00
|
|
|
Mesh *me = rna_mesh(ptr);
|
2019-02-17 18:05:18 +11:00
|
|
|
return me->edit_mesh ? me->edit_mesh->bm->totfacesel : 0;
|
2010-02-12 22:03:23 +00:00
|
|
|
}
|
|
|
|
|
2019-03-05 21:34:48 +01:00
|
|
|
static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, const char *name, const bool do_init)
|
2010-08-23 22:16:45 +00:00
|
|
|
{
|
2012-02-01 18:25:13 +00:00
|
|
|
PointerRNA ptr;
|
2012-02-02 00:04:47 +00:00
|
|
|
CustomData *ldata;
|
2012-03-05 16:19:16 +00:00
|
|
|
CustomDataLayer *cdl = NULL;
|
2019-03-05 21:34:48 +01:00
|
|
|
int index = ED_mesh_color_add(me, name, false, do_init);
|
2010-08-23 22:16:45 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
if (index != -1) {
|
|
|
|
ldata = rna_mesh_ldata_helper(me);
|
|
|
|
cdl = &ldata->layers[CustomData_get_layer_index_n(ldata, CD_MLOOPCOL, index)];
|
2010-08-27 00:35:59 +00:00
|
|
|
}
|
2012-02-01 18:25:13 +00:00
|
|
|
|
2012-02-02 00:04:47 +00:00
|
|
|
RNA_pointer_create(&me->id, &RNA_MeshLoopColorLayer, cdl, &ptr);
|
2012-02-01 18:25:13 +00:00
|
|
|
return ptr;
|
2010-08-23 22:16:45 +00:00
|
|
|
}
|
|
|
|
|
2013-03-24 12:13:13 +00:00
|
|
|
static void rna_Mesh_vertex_color_remove(struct Mesh *me, ReportList *reports, CustomDataLayer *layer)
|
|
|
|
{
|
|
|
|
if (ED_mesh_color_remove_named(me, layer->name) == false) {
|
2013-03-25 08:29:06 +00:00
|
|
|
BKE_reportf(reports, RPT_ERROR, "Vertex color '%s' not found", layer->name);
|
2013-03-24 12:13:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-09 12:23:58 +11:00
|
|
|
#define DEFINE_CUSTOMDATA_PROPERTY_API(elemname, datatype, cd_prop_type, cdata, countvar, layertype) \
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
static PointerRNA rna_Mesh_##elemname##_##datatype##_property_new(struct Mesh *me, const char *name) \
|
|
|
|
{ \
|
|
|
|
PointerRNA ptr; \
|
|
|
|
CustomDataLayer *cdl = NULL; \
|
|
|
|
int index; \
|
|
|
|
\
|
2015-03-09 12:23:58 +11:00
|
|
|
CustomData_add_layer_named(&me->cdata, cd_prop_type, CD_DEFAULT, NULL, me->countvar, name); \
|
|
|
|
index = CustomData_get_named_layer_index(&me->cdata, cd_prop_type, name); \
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
\
|
|
|
|
cdl = (index == -1) ? NULL : &(me->cdata.layers[index]); \
|
|
|
|
\
|
|
|
|
RNA_pointer_create(&me->id, &RNA_##layertype, cdl, &ptr); \
|
|
|
|
return ptr; \
|
|
|
|
}
|
|
|
|
|
2015-03-09 12:23:58 +11:00
|
|
|
DEFINE_CUSTOMDATA_PROPERTY_API(vertex, float, CD_PROP_FLT, vdata, totvert, MeshVertexFloatPropertyLayer)
|
|
|
|
DEFINE_CUSTOMDATA_PROPERTY_API(vertex, int, CD_PROP_INT, vdata, totvert, MeshVertexIntPropertyLayer)
|
|
|
|
DEFINE_CUSTOMDATA_PROPERTY_API(vertex, string, CD_PROP_STR, vdata, totvert, MeshVertexStringPropertyLayer)
|
|
|
|
DEFINE_CUSTOMDATA_PROPERTY_API(polygon, float, CD_PROP_FLT, pdata, totpoly, MeshPolygonFloatPropertyLayer)
|
|
|
|
DEFINE_CUSTOMDATA_PROPERTY_API(polygon, int, CD_PROP_INT, pdata, totpoly, MeshPolygonIntPropertyLayer)
|
|
|
|
DEFINE_CUSTOMDATA_PROPERTY_API(polygon, string, CD_PROP_STR, pdata, totpoly, MeshPolygonStringPropertyLayer)
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
#undef DEFINE_CUSTOMDATA_PROPERTY_API
|
2011-11-15 12:28:13 +00:00
|
|
|
|
2019-03-05 21:34:48 +01:00
|
|
|
static PointerRNA rna_Mesh_uv_layers_new(struct Mesh *me, const char *name, const bool do_init)
|
2010-08-23 22:16:45 +00:00
|
|
|
{
|
2012-02-01 18:25:13 +00:00
|
|
|
PointerRNA ptr;
|
2017-05-25 15:11:00 +10:00
|
|
|
CustomData *ldata;
|
2012-03-05 16:19:16 +00:00
|
|
|
CustomDataLayer *cdl = NULL;
|
2019-03-05 21:34:48 +01:00
|
|
|
int index = ED_mesh_uv_texture_add(me, name, false, do_init);
|
2010-08-23 22:16:45 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
if (index != -1) {
|
2017-05-25 15:11:00 +10:00
|
|
|
ldata = rna_mesh_ldata_helper(me);
|
|
|
|
cdl = &ldata->layers[CustomData_get_layer_index_n(ldata, CD_MLOOPUV, index)];
|
2010-08-27 00:35:59 +00:00
|
|
|
}
|
2012-02-01 18:25:13 +00:00
|
|
|
|
2017-05-25 15:11:00 +10:00
|
|
|
RNA_pointer_create(&me->id, &RNA_MeshUVLoopLayer, cdl, &ptr);
|
2012-02-01 18:25:13 +00:00
|
|
|
return ptr;
|
2010-08-23 22:16:45 +00:00
|
|
|
}
|
|
|
|
|
2017-05-25 15:11:00 +10:00
|
|
|
static void rna_Mesh_uv_layers_remove(struct Mesh *me, ReportList *reports, CustomDataLayer *layer)
|
2013-03-24 12:13:13 +00:00
|
|
|
{
|
|
|
|
if (ED_mesh_uv_texture_remove_named(me, layer->name) == false) {
|
2013-03-25 08:29:06 +00:00
|
|
|
BKE_reportf(reports, RPT_ERROR, "Texture layer '%s' not found", layer->name);
|
2013-03-24 12:13:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-05 22:25:34 +02:00
|
|
|
static bool rna_Mesh_is_editmode_get(PointerRNA *ptr)
|
2013-07-03 22:57:00 +00:00
|
|
|
{
|
|
|
|
Mesh *me = rna_mesh(ptr);
|
2019-02-17 18:05:18 +11:00
|
|
|
return (me->edit_mesh != NULL);
|
2013-07-03 22:57:00 +00:00
|
|
|
}
|
|
|
|
|
2012-08-20 07:29:11 +00:00
|
|
|
/* only to quiet warnings */
|
|
|
|
static void UNUSED_FUNCTION(rna_mesh_unused)(void)
|
|
|
|
{
|
|
|
|
/* unused functions made by macros */
|
|
|
|
(void)rna_Mesh_skin_vertice_index_range;
|
2014-11-03 23:31:55 +01:00
|
|
|
(void)rna_Mesh_vertex_paint_mask_index_range;
|
2012-08-20 07:29:11 +00:00
|
|
|
(void)rna_Mesh_uv_layer_render_get;
|
|
|
|
(void)rna_Mesh_uv_layer_render_index_get;
|
|
|
|
(void)rna_Mesh_uv_layer_render_index_set;
|
|
|
|
(void)rna_Mesh_uv_layer_render_set;
|
|
|
|
(void)rna_Mesh_vertex_color_render_get;
|
|
|
|
(void)rna_Mesh_vertex_color_render_index_get;
|
|
|
|
(void)rna_Mesh_vertex_color_render_index_set;
|
|
|
|
(void)rna_Mesh_vertex_color_render_set;
|
2017-07-20 18:37:30 +10:00
|
|
|
(void)rna_Mesh_face_map_index_range;
|
|
|
|
(void)rna_Mesh_face_map_active_index_set;
|
|
|
|
(void)rna_Mesh_face_map_active_index_get;
|
|
|
|
(void)rna_Mesh_face_map_active_set;
|
2012-08-20 07:29:11 +00:00
|
|
|
/* end unused function block */
|
|
|
|
}
|
|
|
|
|
2008-11-07 02:58:25 +00:00
|
|
|
#else
|
|
|
|
|
2008-11-24 12:12:24 +00:00
|
|
|
static void rna_def_mvert_group(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "VertexGroupElement", NULL);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_struct_sdna(srna, "MDeformWeight");
|
2009-03-25 20:29:01 +00:00
|
|
|
RNA_def_struct_path_func(srna, "rna_VertexGroupElement_path");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Vertex Group Element", "Weight value of a vertex in a vertex group");
|
2009-06-03 23:16:51 +00:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2008-11-29 14:35:50 +00:00
|
|
|
/* we can't point to actual group, it is in the object and so
|
|
|
|
* there is no unique group to point to, hence the index */
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "group", PROP_INT, PROP_UNSIGNED);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "def_nr");
|
2009-03-23 13:24:48 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Group Index", "");
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
|
|
|
RNA_def_property_ui_text(prop, "Weight", "Vertex Weight");
|
2017-05-03 18:55:40 +02:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_weight");
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_def_mvert(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "MeshVertex", NULL);
|
2009-01-02 14:48:03 +00:00
|
|
|
RNA_def_struct_sdna(srna, "MVert");
|
2015-10-24 02:44:43 +11:00
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Vertex", "Vertex in a Mesh data-block");
|
2009-03-25 20:29:01 +00:00
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshVertex_path");
|
2009-06-03 23:16:51 +00:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL);
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
|
2008-11-29 14:35:50 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Location", "");
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
|
|
|
|
/* RNA_def_property_float_sdna(prop, NULL, "no"); */
|
2010-12-31 04:12:20 +00:00
|
|
|
RNA_def_property_array(prop, 3);
|
|
|
|
RNA_def_property_range(prop, -1.0f, 1.0f);
|
2010-01-04 15:25:21 +00:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_MeshVertex_normal_get", "rna_MeshVertex_normal_set", NULL);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Normal", "Vertex Normal");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
|
2010-07-15 16:56:04 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Select", "");
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
|
2010-07-15 16:56:04 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Hide", "");
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
|
2009-01-02 14:48:03 +00:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_MeshVertex_bevel_weight_get", "rna_MeshVertex_bevel_weight_set", NULL);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Bevel Weight", "Weight used by the Bevel modifier 'Only Vertices' option");
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
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);
|
2009-01-10 22:57:33 +00:00
|
|
|
RNA_def_property_struct_type(prop, "VertexGroupElement");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this vertex is member of");
|
2009-10-12 19:34:58 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
|
2009-10-12 19:34:58 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_int_funcs(prop, "rna_MeshVertex_index_get", NULL, NULL);
|
2013-09-08 14:01:14 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Index", "Index of this vertex");
|
2013-05-05 05:56:41 +00:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "undeformed_co", PROP_FLOAT, PROP_TRANSLATION);
|
|
|
|
RNA_def_property_array(prop, 3);
|
2013-05-13 07:32:48 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Undeformed Location",
|
|
|
|
"For meshes with modifiers applied, the coordinate of the vertex with no deforming "
|
|
|
|
"modifiers applied, as used for generated texture coordinates");
|
2013-05-05 05:56:41 +00:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_MeshVertex_undeformed_co_get", NULL, NULL);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_def_medge(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "MeshEdge", NULL);
|
2009-01-02 14:48:03 +00:00
|
|
|
RNA_def_struct_sdna(srna, "MEdge");
|
2015-10-24 02:44:43 +11:00
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Edge", "Edge in a Mesh data-block");
|
2009-03-25 20:29:01 +00:00
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshEdge_path");
|
2009-06-03 23:16:51 +00:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_EDGESEL);
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "v1");
|
|
|
|
RNA_def_property_array(prop, 2);
|
|
|
|
RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
|
2012-03-05 16:19:16 +00:00
|
|
|
/* XXX allows creating invalid meshes */
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "crease", PROP_FLOAT, PROP_NONE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_MEdge_crease_get", "rna_MEdge_crease_set", NULL);
|
2016-12-28 14:37:08 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Crease", "Weight used by the Subdivision Surface modifier for creasing");
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_MEdge_bevel_weight_get", "rna_MEdge_bevel_weight_set", NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Bevel Weight", "Weight used by the Bevel modifier");
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
|
2010-07-15 16:56:04 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Select", "");
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
|
2010-07-15 16:56:04 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Hide", "");
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "use_seam", PROP_BOOLEAN, PROP_NONE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SEAM);
|
|
|
|
RNA_def_property_ui_text(prop, "Seam", "Seam edge for UV unwrapping");
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "use_edge_sharp", PROP_BOOLEAN, PROP_NONE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SHARP);
|
2016-12-28 14:37:08 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Sharp", "Sharp edge for the Edge Split modifier");
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2009-06-26 12:33:07 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "is_loose", PROP_BOOLEAN, PROP_NONE);
|
2009-06-26 12:33:07 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_LOOSEEDGE);
|
|
|
|
RNA_def_property_ui_text(prop, "Loose", "Loose edge");
|
2009-08-06 12:22:50 +00:00
|
|
|
|
2014-04-15 14:44:08 +09:00
|
|
|
prop = RNA_def_property(srna, "use_freestyle_mark", PROP_BOOLEAN, PROP_NONE);
|
2014-04-15 13:29:03 +09:00
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_MEdge_freestyle_edge_mark_get", "rna_MEdge_freestyle_edge_mark_set");
|
|
|
|
RNA_def_property_ui_text(prop, "Freestyle Edge Mark", "Edge mark for Freestyle line rendering");
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
|
2009-10-12 19:34:58 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_int_funcs(prop, "rna_MeshEdge_index_get", NULL, NULL);
|
2013-09-08 14:01:14 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Index", "Index of this edge");
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
static void rna_def_mlooptri(BlenderRNA *brna)
|
2008-11-24 12:12:24 +00:00
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
2018-09-06 14:28:14 +02:00
|
|
|
const int splitnor_dim[] = {3, 3};
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
srna = RNA_def_struct(brna, "MeshLoopTriangle", NULL);
|
|
|
|
RNA_def_struct_sdna(srna, "MLoopTri");
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Loop Triangle", "Tessellated triangle in a Mesh data-block");
|
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshLoopTriangle_path");
|
2009-06-03 23:16:51 +00:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_FACESEL);
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
|
2018-09-06 14:28:14 +02:00
|
|
|
RNA_def_property_array(prop, 3);
|
|
|
|
RNA_def_property_int_funcs(prop, "rna_MeshLoopTriangle_verts_get", NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Vertices", "Indices of triangle vertices");
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
prop = RNA_def_property(srna, "loops", PROP_INT, PROP_UNSIGNED);
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "tri");
|
|
|
|
RNA_def_property_ui_text(prop, "Loops", "Indices of mesh loops that make up the triangle");
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
prop = RNA_def_property(srna, "polygon_index", PROP_INT, PROP_UNSIGNED);
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "poly");
|
|
|
|
RNA_def_property_ui_text(prop, "Polygon", "Index of mesh polygon that the triangle is a part of");
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2011-10-06 02:04:43 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
|
2009-07-27 18:17:21 +00:00
|
|
|
RNA_def_property_array(prop, 3);
|
|
|
|
RNA_def_property_range(prop, -1.0f, 1.0f);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2018-09-06 14:28:14 +02:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_MeshLoopTriangle_normal_get", NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Triangle Normal", "Local space unit length normal vector for this triangle");
|
2009-10-12 19:34:58 +00:00
|
|
|
|
2014-04-13 12:18:51 +02:00
|
|
|
prop = RNA_def_property(srna, "split_normals", PROP_FLOAT, PROP_DIRECTION);
|
|
|
|
RNA_def_property_multi_array(prop, 2, splitnor_dim);
|
|
|
|
RNA_def_property_range(prop, -1.0f, 1.0f);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2018-09-06 14:28:14 +02:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_MeshLoopTriangle_split_normals_get", NULL, NULL);
|
2014-04-13 12:18:51 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Split Normals",
|
2018-09-06 14:28:14 +02:00
|
|
|
"Local space unit length split normals vectors of the vertices of this triangle "
|
|
|
|
"(must be computed beforehand using calc_normals_split or calc_tangents)");
|
2014-04-13 12:18:51 +02:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
|
2009-11-03 17:51:22 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2018-09-06 14:28:14 +02:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_MeshLoopTriangle_area_get", NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Triangle Area", "Area of this triangle");
|
2009-11-03 17:51:22 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
|
2009-10-22 23:22:05 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2018-09-06 14:28:14 +02:00
|
|
|
RNA_def_property_int_funcs(prop, "rna_MeshLoopTriangle_index_get", NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Index", "Index of this loop triangle");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_int_funcs(prop, "rna_MeshLoopTriangle_material_index_get", NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Material Index", "");
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_MeshLoopTriangle_use_smooth_get", NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Smooth", "");
|
|
|
|
}
|
2011-08-31 05:13:21 +00:00
|
|
|
|
2011-08-31 11:21:54 +00:00
|
|
|
static void rna_def_mloop(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "MeshLoop", NULL);
|
2011-08-31 11:21:54 +00:00
|
|
|
RNA_def_struct_sdna(srna, "MLoop");
|
2015-10-24 02:44:43 +11:00
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Loop", "Loop in a Mesh data-block");
|
2011-08-31 11:21:54 +00:00
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshLoop_path");
|
|
|
|
RNA_def_struct_ui_icon(srna, ICON_EDGESEL);
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "vertex_index", PROP_INT, PROP_UNSIGNED);
|
2011-08-31 11:21:54 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "v");
|
|
|
|
RNA_def_property_ui_text(prop, "Vertex", "Vertex index");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "edge_index", PROP_INT, PROP_UNSIGNED);
|
2011-08-31 11:21:54 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "e");
|
|
|
|
RNA_def_property_ui_text(prop, "Edge", "Edge index");
|
2012-02-24 15:53:26 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
|
2012-02-24 15:53:26 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_int_funcs(prop, "rna_MeshLoop_index_get", NULL, NULL);
|
2013-09-08 14:01:14 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Index", "Index of this loop");
|
2013-09-10 15:26:12 +00:00
|
|
|
|
|
|
|
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);
|
Add Custom Loop Normals.
This is the core code for it, tools (datatransfer and modifier) will come in next commits).
RNA api is already there, though.
See the code for details, but basically, we define, for each 'smooth fan'
(which is a set of adjacent loops around a same vertex that are smooth, i.e. have a single same normal),
a 'loop normal space' (or lnor space), using auto-computed normal and relevant edges, and store
custom normal as two angular factors inside that space. This allows to have custom normals
'following' deformations of the geometry, and to only save two shorts per loop in new clnor CDLayer.
Normal manipulation (editing, mixing, interpolating, etc.) shall always happen with plain 3D vectors normals,
and be converted back into storage format at the end.
Clnor computation has also been threaded (at least for Mesh case, not for BMesh), since the process can
be rather heavy with high poly meshes.
Also, bumping subversion, and fix mess in 2.70 versioning code.
2015-02-05 14:24:48 +01:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_MeshLoop_normal_get", "rna_MeshLoop_normal_set", NULL);
|
2014-01-11 11:31:44 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Normal",
|
2013-09-10 15:26:12 +00:00
|
|
|
"Local space unit length split normal vector of this vertex for this polygon "
|
2014-01-11 11:31:44 +01:00
|
|
|
"(must be computed beforehand using calc_normals_split or calc_tangents)");
|
2013-09-10 15:26:12 +00:00
|
|
|
|
2014-01-11 11:31:44 +01:00
|
|
|
prop = RNA_def_property(srna, "tangent", 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_MeshLoop_tangent_get", NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Tangent",
|
|
|
|
"Local space unit length tangent vector of this vertex for this polygon "
|
|
|
|
"(must be computed beforehand using calc_tangents)");
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "bitangent_sign", PROP_FLOAT, PROP_NONE);
|
|
|
|
RNA_def_property_range(prop, -1.0f, 1.0f);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_float_funcs(prop, "rna_MeshLoop_bitangent_sign_get", NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Bitangent Sign",
|
|
|
|
"Sign of the bitangent vector of this vertex for this polygon (must be computed "
|
|
|
|
"beforehand using calc_tangents, bitangent = bitangent_sign * cross(normal, tangent))");
|
2014-01-24 17:49:29 +01:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "bitangent", 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_MeshLoop_bitangent_get", NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Bitangent",
|
|
|
|
"Bitangent vector of this vertex for this polygon (must be computed beforehand using "
|
|
|
|
"calc_tangents, *use it only if really needed*, slower access than bitangent_sign)");
|
2011-08-31 11:21:54 +00:00
|
|
|
}
|
|
|
|
|
2011-08-31 05:13:21 +00:00
|
|
|
static void rna_def_mpolygon(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
2016-02-28 15:29:56 +01:00
|
|
|
FunctionRNA *func;
|
2011-08-31 05:13:21 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "MeshPolygon", NULL);
|
2011-08-31 05:13:21 +00:00
|
|
|
RNA_def_struct_sdna(srna, "MPoly");
|
2015-10-24 02:44:43 +11:00
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Polygon", "Polygon in a Mesh data-block");
|
2011-08-31 05:13:21 +00:00
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshPolygon_path");
|
|
|
|
RNA_def_struct_ui_icon(srna, ICON_FACESEL);
|
|
|
|
|
2012-03-18 07:38:51 +00:00
|
|
|
/* Faked, actually access to loop vertex values, don't this way because manually setting up
|
2012-03-05 16:19:16 +00:00
|
|
|
* vertex/edge per loop is very low level.
|
|
|
|
* Instead we setup poly sizes, assign indices, then calc edges automatic when creating
|
|
|
|
* meshes from rna/py. */
|
|
|
|
prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
|
|
|
|
/* Eek, this is still used in some cases but in fact we don't want to use it at all here. */
|
|
|
|
RNA_def_property_array(prop, 3);
|
2011-08-31 05:13:21 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_DYNAMIC);
|
2011-08-31 11:21:54 +00:00
|
|
|
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);
|
2011-08-31 05:13:21 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
|
|
|
|
|
2011-09-01 09:11:00 +00:00
|
|
|
/* these are both very low level access */
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "loop_start", PROP_INT, PROP_UNSIGNED);
|
2011-09-01 09:11:00 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "loopstart");
|
2013-09-08 14:01:14 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Loop Start", "Index of the first loop of this polygon");
|
2011-09-01 09:11:00 +00:00
|
|
|
/* also low level */
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "loop_total", PROP_INT, PROP_UNSIGNED);
|
2011-09-01 09:11:00 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "totloop");
|
2013-09-08 14:01:14 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Loop Total", "Number of loops used by this polygon");
|
2011-09-01 09:11:00 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
|
2011-08-31 05:13:21 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "mat_nr");
|
|
|
|
RNA_def_property_ui_text(prop, "Material Index", "");
|
2013-08-20 12:48:44 +00:00
|
|
|
#if 0
|
2012-03-23 00:28:29 +00:00
|
|
|
RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshPoly_material_index_range");
|
2013-08-20 12:48:44 +00:00
|
|
|
#endif
|
2011-08-31 05:13:21 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
|
2011-08-31 05:13:21 +00:00
|
|
|
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");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
|
2011-08-31 05:13:21 +00:00
|
|
|
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");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
|
2011-08-31 05:13:21 +00:00
|
|
|
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");
|
|
|
|
|
2014-04-15 14:44:08 +09:00
|
|
|
prop = RNA_def_property(srna, "use_freestyle_mark", PROP_BOOLEAN, PROP_NONE);
|
2014-04-15 13:29:03 +09:00
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_MPoly_freestyle_face_mark_get", "rna_MPoly_freestyle_face_mark_set");
|
|
|
|
RNA_def_property_ui_text(prop, "Freestyle Face Mark", "Face mark for Freestyle line rendering");
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
|
2011-08-31 05:13:21 +00:00
|
|
|
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);
|
2013-09-08 14:01:14 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Polygon Normal", "Local space unit length normal vector for this polygon");
|
2011-08-31 05:13:21 +00:00
|
|
|
|
2014-02-19 13:19:56 +11:00
|
|
|
prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_XYZ);
|
2013-06-05 03:10:29 +00:00
|
|
|
RNA_def_property_array(prop, 3);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_float_funcs(prop, "rna_MeshPolygon_center_get", NULL, NULL);
|
2013-09-08 14:01:14 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Polygon Center", "Center of this polygon");
|
2013-06-05 03:10:29 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
|
2011-08-31 05:13:21 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_float_funcs(prop, "rna_MeshPolygon_area_get", NULL, NULL);
|
2013-09-08 14:01:14 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Polygon Area", "Read only area of this polygon");
|
2011-08-31 05:13:21 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
|
2011-08-31 05:13:21 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_int_funcs(prop, "rna_MeshPolygon_index_get", NULL, NULL);
|
2013-09-08 14:01:14 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Index", "Index of this polygon");
|
2016-02-28 15:29:56 +01:00
|
|
|
|
|
|
|
func = RNA_def_function(srna, "flip", "rna_MeshPolygon_flip");
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
|
|
|
RNA_def_function_ui_description(func, "Invert winding of this polygon (flip its normal)");
|
2011-08-31 05:13:21 +00:00
|
|
|
}
|
|
|
|
|
2011-11-17 05:03:07 +00:00
|
|
|
/* mesh.loop_uvs */
|
|
|
|
static void rna_def_mloopuv(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "MeshUVLoopLayer", NULL);
|
2011-11-17 05:03:07 +00:00
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshUVLoopLayer_path");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
2011-11-17 05:03:07 +00:00
|
|
|
RNA_def_property_struct_type(prop, "MeshUVLoop");
|
2012-03-05 16:19:16 +00:00
|
|
|
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);
|
2011-11-17 05:03:07 +00:00
|
|
|
|
2012-05-29 11:19:46 +00:00
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
|
|
|
RNA_def_struct_name_property(srna, prop);
|
2013-09-20 11:14:08 +00:00
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshUVLayer_name_set");
|
2012-05-29 11:19:46 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Name", "Name of UV map");
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
|
|
|
|
2017-05-25 15:11:00 +10:00
|
|
|
prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_MeshUVLoopLayer_active_get", "rna_MeshUVLoopLayer_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_MeshUVLoopLayer_active_render_get",
|
|
|
|
"rna_MeshUVLoopLayer_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_MeshUVLoopLayer_clone_get", "rna_MeshUVLoopLayer_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");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "MeshUVLoop", NULL);
|
2011-11-17 05:03:07 +00:00
|
|
|
RNA_def_struct_sdna(srna, "MLoopUV");
|
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshUVLoop_path");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_XYZ);
|
2011-11-17 05:03:07 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "pin_uv", PROP_BOOLEAN, PROP_NONE);
|
2011-12-08 00:18:57 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_PINNED);
|
|
|
|
RNA_def_property_ui_text(prop, "UV Pinned", "");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
|
2011-12-08 00:18:57 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_VERTSEL);
|
2011-12-08 00:28:42 +00:00
|
|
|
RNA_def_property_ui_text(prop, "UV Select", "");
|
2011-12-08 00:18:57 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "select_edge", PROP_BOOLEAN, PROP_NONE);
|
2011-12-08 00:18:57 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_EDGESEL);
|
2011-12-08 00:28:42 +00:00
|
|
|
RNA_def_property_ui_text(prop, "UV Edge Select", "");
|
2011-11-17 05:03:07 +00:00
|
|
|
}
|
|
|
|
|
2011-11-25 13:28:04 +00:00
|
|
|
static void rna_def_mloopcol(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "MeshLoopColorLayer", NULL);
|
2015-10-24 02:44:43 +11:00
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Vertex Color Layer", "Layer of vertex colors in a Mesh data-block");
|
2011-11-25 13:28:04 +00:00
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshLoopColorLayer_path");
|
|
|
|
RNA_def_struct_ui_icon(srna, ICON_GROUP_VCOL);
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
2011-11-25 13:28:04 +00:00
|
|
|
RNA_def_struct_name_property(srna, prop);
|
2013-04-30 17:30:40 +00:00
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshLoopLayer_name_set");
|
2011-11-25 13:28:04 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Name", "Name of Vertex color layer");
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
|
2011-11-25 13:28:04 +00:00
|
|
|
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");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
|
2011-11-25 13:28:04 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
|
2012-03-05 16:19:16 +00:00
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_MeshLoopColorLayer_active_render_get",
|
|
|
|
"rna_MeshLoopColorLayer_active_render_set");
|
2011-11-25 13:28:04 +00:00
|
|
|
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");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
2012-01-17 05:15:33 +00:00
|
|
|
RNA_def_property_struct_type(prop, "MeshLoopColor");
|
2011-11-25 13:28:04 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Data", "");
|
2012-03-05 16:19:16 +00:00
|
|
|
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);
|
2011-11-25 13:28:04 +00:00
|
|
|
|
2012-01-17 05:15:33 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "MeshLoopColor", NULL);
|
2012-01-17 05:15:33 +00:00
|
|
|
RNA_def_struct_sdna(srna, "MLoopCol");
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Vertex Color", "Vertex loop colors in a Mesh");
|
2011-11-25 13:28:04 +00:00
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshColor_path");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
|
2017-09-29 18:10:25 +10:00
|
|
|
RNA_def_property_array(prop, 4);
|
2012-01-17 05:15:33 +00:00
|
|
|
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", "");
|
2011-11-25 13:28:04 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2009-01-10 22:57:33 +00:00
|
|
|
}
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2009-01-10 22:57:33 +00:00
|
|
|
static void rna_def_mproperties(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
/* Float */
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
#define MESH_FLOAT_PROPERTY_LAYER(elemname) \
|
|
|
|
srna = RNA_def_struct(brna, "Mesh" elemname "FloatPropertyLayer", NULL); \
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer"); \
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh " elemname " Float Property Layer", "User defined layer of floating point number values"); \
|
|
|
|
RNA_def_struct_path_func(srna, "rna_Mesh" elemname "FloatPropertyLayer_path"); \
|
|
|
|
\
|
|
|
|
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_MeshAnyLayer_name_set"); \
|
|
|
|
RNA_def_property_ui_text(prop, "Name", ""); \
|
|
|
|
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, "Mesh" elemname "FloatProperty"); \
|
|
|
|
RNA_def_property_ui_text(prop, "Data", ""); \
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Mesh" elemname "FloatPropertyLayer_data_begin", "rna_iterator_array_next", \
|
|
|
|
"rna_iterator_array_end", "rna_iterator_array_get", \
|
|
|
|
"rna_Mesh" elemname "FloatPropertyLayer_data_length", NULL, NULL, NULL); \
|
|
|
|
\
|
|
|
|
srna = RNA_def_struct(brna, "Mesh" elemname "FloatProperty", NULL); \
|
|
|
|
RNA_def_struct_sdna(srna, "MFloatProperty"); \
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh " elemname " Float Property", \
|
|
|
|
"User defined floating point number value in a float properties layer"); \
|
|
|
|
RNA_def_struct_path_func(srna, "rna_Mesh" elemname "FloatProperty_path"); \
|
|
|
|
\
|
|
|
|
prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); \
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "f"); \
|
|
|
|
RNA_def_property_ui_text(prop, "Value", ""); \
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2009-01-10 22:57:33 +00:00
|
|
|
/* Int */
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
#define MESH_INT_PROPERTY_LAYER(elemname) \
|
|
|
|
srna = RNA_def_struct(brna, "Mesh" elemname "IntPropertyLayer", NULL); \
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer"); \
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh " elemname " Int Property Layer", "User defined layer of integer number values"); \
|
|
|
|
RNA_def_struct_path_func(srna, "rna_Mesh" elemname "IntPropertyLayer_path"); \
|
|
|
|
\
|
|
|
|
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_MeshAnyLayer_name_set"); \
|
|
|
|
RNA_def_property_ui_text(prop, "Name", ""); \
|
|
|
|
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, "Mesh" elemname "IntProperty"); \
|
|
|
|
RNA_def_property_ui_text(prop, "Data", ""); \
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Mesh" elemname "IntPropertyLayer_data_begin", "rna_iterator_array_next", \
|
|
|
|
"rna_iterator_array_end", "rna_iterator_array_get", \
|
|
|
|
"rna_Mesh" elemname "IntPropertyLayer_data_length", NULL, NULL, NULL); \
|
|
|
|
\
|
|
|
|
srna = RNA_def_struct(brna, "Mesh" elemname "IntProperty", NULL); \
|
|
|
|
RNA_def_struct_sdna(srna, "MIntProperty"); \
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh " elemname " Int Property", \
|
|
|
|
"User defined integer number value in an integer properties layer"); \
|
|
|
|
RNA_def_struct_path_func(srna, "rna_Mesh" elemname "IntProperty_path"); \
|
|
|
|
\
|
|
|
|
prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE); \
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "i"); \
|
|
|
|
RNA_def_property_ui_text(prop, "Value", ""); \
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); \
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2009-01-10 22:57:33 +00:00
|
|
|
/* String */
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
#define MESH_STRING_PROPERTY_LAYER(elemname) \
|
|
|
|
srna = RNA_def_struct(brna, "Mesh" elemname "StringPropertyLayer", NULL); \
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer"); \
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh " elemname " String Property Layer", "User defined layer of string text values"); \
|
|
|
|
RNA_def_struct_path_func(srna, "rna_Mesh" elemname "StringPropertyLayer_path"); \
|
|
|
|
\
|
|
|
|
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_MeshAnyLayer_name_set"); \
|
|
|
|
RNA_def_property_ui_text(prop, "Name", ""); \
|
|
|
|
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, "Mesh" elemname "StringProperty"); \
|
|
|
|
RNA_def_property_ui_text(prop, "Data", ""); \
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Mesh" elemname "StringPropertyLayer_data_begin", "rna_iterator_array_next", \
|
|
|
|
"rna_iterator_array_end", "rna_iterator_array_get", \
|
|
|
|
"rna_Mesh" elemname "StringPropertyLayer_data_length", NULL, NULL, NULL); \
|
|
|
|
\
|
|
|
|
srna = RNA_def_struct(brna, "Mesh" elemname "StringProperty", NULL); \
|
|
|
|
RNA_def_struct_sdna(srna, "MStringProperty"); \
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh " elemname " String Property", \
|
|
|
|
"User defined string text value in a string properties layer"); \
|
|
|
|
RNA_def_struct_path_func(srna, "rna_Mesh" elemname "StringProperty_path"); \
|
|
|
|
\
|
|
|
|
/* low level mesh data access, treat as bytes */ \
|
|
|
|
prop = RNA_def_property(srna, "value", PROP_STRING, PROP_BYTESTRING); \
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "s"); \
|
|
|
|
RNA_def_property_string_funcs(prop, "rna_MeshStringProperty_s_get", "rna_MeshStringProperty_s_length", "rna_MeshStringProperty_s_set"); \
|
|
|
|
RNA_def_property_ui_text(prop, "Value", ""); \
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); \
|
|
|
|
|
|
|
|
MESH_FLOAT_PROPERTY_LAYER("Vertex")
|
|
|
|
MESH_FLOAT_PROPERTY_LAYER("Polygon")
|
|
|
|
MESH_INT_PROPERTY_LAYER("Vertex")
|
|
|
|
MESH_INT_PROPERTY_LAYER("Polygon")
|
|
|
|
MESH_STRING_PROPERTY_LAYER("Vertex")
|
|
|
|
MESH_STRING_PROPERTY_LAYER("Polygon")
|
|
|
|
#undef MESH_PROPERTY_LAYER
|
2008-11-24 12:12:24 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-12-02 23:45:11 +00:00
|
|
|
void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable)
|
|
|
|
{
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
/* texture space */
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "auto_texspace", PROP_BOOLEAN, PROP_NONE);
|
2012-02-19 22:17:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE);
|
2012-03-05 16:19:16 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Auto Texture Space",
|
|
|
|
"Adjust active object's texture space automatically when transforming object");
|
2008-12-02 23:45:11 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "loc");
|
2012-05-29 05:46:54 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
|
2012-05-08 23:39:31 +00:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", NULL, NULL);
|
2009-01-01 15:52:51 +00:00
|
|
|
RNA_def_property_editable_func(prop, texspace_editable);
|
2013-07-09 22:27:18 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2008-12-02 23:45:11 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "size");
|
2014-02-09 08:42:45 +11:00
|
|
|
RNA_def_property_flag(prop, PROP_PROPORTIONAL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
|
2012-05-08 23:39:31 +00:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_size_get", NULL, NULL);
|
2009-01-01 15:52:51 +00:00
|
|
|
RNA_def_property_editable_func(prop, texspace_editable);
|
2013-07-09 22:27:18 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2008-12-02 23:45:11 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
/* not supported yet */
|
|
|
|
#if 0
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_property_float(prop, NULL, "rot");
|
|
|
|
RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
|
2009-09-16 17:43:09 +00:00
|
|
|
RNA_def_property_editable_func(prop, texspace_editable);
|
2013-07-09 22:27:18 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2012-05-12 11:01:29 +00:00
|
|
|
#endif
|
2008-12-02 23:45:11 +00:00
|
|
|
|
|
|
|
/* materials */
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
|
|
|
|
RNA_def_property_struct_type(prop, "Material");
|
|
|
|
RNA_def_property_ui_text(prop, "Materials", "");
|
2011-08-26 14:36:30 +00:00
|
|
|
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
|
2013-09-11 21:27:14 +00:00
|
|
|
RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
|
2008-12-02 23:45:11 +00:00
|
|
|
}
|
|
|
|
|
2009-12-13 14:13:25 +00:00
|
|
|
|
|
|
|
/* scene.objects */
|
2010-08-26 22:44:05 +00:00
|
|
|
/* mesh.vertices */
|
|
|
|
static void rna_def_mesh_vertices(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
2012-03-05 16:19:16 +00:00
|
|
|
/* PropertyRNA *prop; */
|
2010-08-26 22:44:05 +00:00
|
|
|
|
|
|
|
FunctionRNA *func;
|
2018-08-28 22:35:09 +10:00
|
|
|
PropertyRNA *parm;
|
2010-08-26 22:44:05 +00:00
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "MeshVertices");
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "MeshVertices", NULL);
|
2010-08-26 22:44:05 +00:00
|
|
|
RNA_def_struct_sdna(srna, "Mesh");
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Vertices", "Collection of mesh vertices");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
func = RNA_def_function(srna, "add", "ED_mesh_vertices_add");
|
2010-08-26 22:44:05 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
2018-08-28 22:35:09 +10:00
|
|
|
parm = RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add", 0, INT_MAX);
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-03-05 16:19:16 +00:00
|
|
|
#if 0 /* BMESH_TODO Remove until BMesh merge */
|
|
|
|
func = RNA_def_function(srna, "remove", "ED_mesh_vertices_remove");
|
2012-01-20 02:10:09 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
|
|
|
RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to remove", 0, INT_MAX);
|
2012-01-23 13:29:29 +00:00
|
|
|
#endif
|
2010-08-26 22:44:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mesh.edges */
|
|
|
|
static void rna_def_mesh_edges(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
2012-03-05 16:19:16 +00:00
|
|
|
/* PropertyRNA *prop; */
|
2010-08-26 22:44:05 +00:00
|
|
|
|
|
|
|
FunctionRNA *func;
|
2018-08-28 22:35:09 +10:00
|
|
|
PropertyRNA *parm;
|
2010-08-26 22:44:05 +00:00
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "MeshEdges");
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "MeshEdges", NULL);
|
2010-08-26 22:44:05 +00:00
|
|
|
RNA_def_struct_sdna(srna, "Mesh");
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Edges", "Collection of mesh edges");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
func = RNA_def_function(srna, "add", "ED_mesh_edges_add");
|
2010-08-26 22:44:05 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
2018-08-28 22:35:09 +10:00
|
|
|
parm = RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to add", 0, INT_MAX);
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-03-05 16:19:16 +00:00
|
|
|
#if 0 /* BMESH_TODO Remove until BMesh merge */
|
|
|
|
func = RNA_def_function(srna, "remove", "ED_mesh_edges_remove");
|
2012-01-20 02:10:09 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
|
|
|
RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to remove", 0, INT_MAX);
|
2012-01-23 13:29:29 +00:00
|
|
|
#endif
|
2010-08-26 22:44:05 +00:00
|
|
|
}
|
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
/* mesh.loop_triangles */
|
|
|
|
static void rna_def_mesh_looptris(BlenderRNA *brna, PropertyRNA *cprop)
|
2009-12-13 14:13:25 +00:00
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
RNA_def_property_srna(cprop, "MeshLoopTriangle");
|
|
|
|
srna = RNA_def_struct(brna, "MeshLoopTriangles", NULL);
|
2009-12-13 14:13:25 +00:00
|
|
|
RNA_def_struct_sdna(srna, "Mesh");
|
2018-09-06 14:28:14 +02:00
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Loop Triangles", "Tessellation of mesh polygons into triangles");
|
2010-08-26 22:44:05 +00:00
|
|
|
}
|
2009-12-13 14:13:25 +00:00
|
|
|
|
2011-08-31 11:21:54 +00:00
|
|
|
/* mesh.loops */
|
|
|
|
static void rna_def_mesh_loops(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
|
2011-09-26 05:35:57 +00:00
|
|
|
/*PropertyRNA *prop;*/
|
2011-08-31 11:21:54 +00:00
|
|
|
|
|
|
|
FunctionRNA *func;
|
2018-08-28 22:35:09 +10:00
|
|
|
PropertyRNA *parm;
|
2011-08-31 11:21:54 +00:00
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "MeshLoops");
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "MeshLoops", NULL);
|
2011-08-31 11:21:54 +00:00
|
|
|
RNA_def_struct_sdna(srna, "Mesh");
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Loops", "Collection of mesh loops");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
func = RNA_def_function(srna, "add", "ED_mesh_loops_add");
|
2011-08-31 11:21:54 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
2018-08-28 22:35:09 +10:00
|
|
|
parm = RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of loops to add", 0, INT_MAX);
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2011-08-31 11:21:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mesh.polygons */
|
2011-08-31 05:13:21 +00:00
|
|
|
static void rna_def_mesh_polygons(BlenderRNA *brna, PropertyRNA *cprop)
|
2010-08-23 22:16:45 +00:00
|
|
|
{
|
|
|
|
StructRNA *srna;
|
2011-08-31 05:13:21 +00:00
|
|
|
|
2010-08-23 22:16:45 +00:00
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
FunctionRNA *func;
|
2018-08-28 22:35:09 +10:00
|
|
|
PropertyRNA *parm;
|
2010-08-23 22:16:45 +00:00
|
|
|
|
2011-08-31 05:13:21 +00:00
|
|
|
RNA_def_property_srna(cprop, "MeshPolygons");
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "MeshPolygons", NULL);
|
2011-08-31 05:13:21 +00:00
|
|
|
RNA_def_struct_sdna(srna, "Mesh");
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Polygons", "Collection of mesh polygons");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "active", PROP_INT, PROP_NONE);
|
2011-08-31 05:13:21 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "act_face");
|
|
|
|
RNA_def_property_ui_text(prop, "Active Polygon", "The active polygon for this mesh");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
func = RNA_def_function(srna, "add", "ED_mesh_polys_add");
|
2011-08-31 05:13:21 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
2018-08-28 22:35:09 +10:00
|
|
|
parm = RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of polygons to add", 0, INT_MAX);
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2011-08-31 05:13:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-25 13:28:04 +00:00
|
|
|
static void rna_def_loop_colors(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "LoopColors");
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "LoopColors", NULL);
|
2011-11-25 13:28:04 +00:00
|
|
|
RNA_def_struct_sdna(srna, "Mesh");
|
|
|
|
RNA_def_struct_ui_text(srna, "Loop Colors", "Collection of vertex colors");
|
2012-03-05 16:19:16 +00:00
|
|
|
|
|
|
|
func = RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh");
|
|
|
|
RNA_def_string(func, "name", "Col", 0, "", "Vertex color name");
|
2019-03-05 21:34:48 +01:00
|
|
|
RNA_def_boolean(func, "do_init", true, "",
|
|
|
|
"Whether new layer's data should be initialized by copying current active one");
|
2012-03-05 16:19:16 +00:00
|
|
|
parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The newly created layer");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
|
2010-08-23 22:16:45 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
2012-03-05 16:19:16 +00:00
|
|
|
|
|
|
|
func = RNA_def_function(srna, "remove", "rna_Mesh_vertex_color_remove");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Remove a vertex color layer");
|
2010-08-23 22:16:45 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
2013-03-24 12:13:13 +00:00
|
|
|
parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The layer to remove");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
2012-11-02 09:41:26 +00:00
|
|
|
RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
|
2012-05-12 11:01:29 +00:00
|
|
|
|
2012-12-11 14:11:46 +00:00
|
|
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
2011-11-25 13:28:04 +00:00
|
|
|
RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
|
2012-03-05 16:19:16 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Mesh_vertex_color_active_get",
|
|
|
|
"rna_Mesh_vertex_color_active_set", NULL, NULL);
|
2013-01-31 13:44:13 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
|
2010-08-23 22:16:45 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
|
2017-05-04 19:59:27 +02:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_active_color");
|
2012-03-05 16:19:16 +00:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
|
|
|
|
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");
|
2010-08-24 04:02:50 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vertex color index");
|
2017-05-04 19:59:27 +02:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_active_color");
|
2010-08-23 22:16:45 +00:00
|
|
|
}
|
|
|
|
|
2012-04-22 23:51:50 +00:00
|
|
|
static void rna_def_uv_layers(BlenderRNA *brna, PropertyRNA *cprop)
|
2011-11-17 05:03:07 +00:00
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2017-05-25 15:11:00 +10:00
|
|
|
FunctionRNA *func;
|
|
|
|
PropertyRNA *parm;
|
2011-11-17 05:03:07 +00:00
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "UVLoopLayers");
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "UVLoopLayers", NULL);
|
2011-11-17 05:03:07 +00:00
|
|
|
RNA_def_struct_sdna(srna, "Mesh");
|
|
|
|
RNA_def_struct_ui_text(srna, "UV Loop Layers", "Collection of uv loop layers");
|
2012-03-05 16:19:16 +00:00
|
|
|
|
2017-05-25 15:11:00 +10:00
|
|
|
func = RNA_def_function(srna, "new", "rna_Mesh_uv_layers_new");
|
|
|
|
RNA_def_function_ui_description(func, "Add a UV map layer to Mesh");
|
|
|
|
RNA_def_string(func, "name", "UVMap", 0, "", "UV map name");
|
2019-03-05 21:34:48 +01:00
|
|
|
RNA_def_boolean(func, "do_init", true, "",
|
|
|
|
"Whether new layer's data should be initialized by copying current active one, "
|
|
|
|
"or if none is active, with a default UVmap");
|
2017-05-25 15:11:00 +10:00
|
|
|
parm = RNA_def_pointer(func, "layer", "MeshUVLoopLayer", "", "The newly created layer");
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "remove", "rna_Mesh_uv_layers_remove");
|
|
|
|
RNA_def_function_ui_description(func, "Remove a vertex color layer");
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
|
|
|
parm = RNA_def_pointer(func, "layer", "MeshUVLoopLayer", "", "The layer to remove");
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
2012-12-11 14:11:46 +00:00
|
|
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
2011-11-17 05:03:07 +00:00
|
|
|
RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
|
2012-04-22 23:51:50 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_active_get",
|
|
|
|
"rna_Mesh_uv_layer_active_set", NULL, NULL);
|
2013-01-31 13:44:13 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
|
2011-11-17 05:03:07 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Active UV loop layer", "Active UV loop layer");
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
|
2012-04-22 23:51:50 +00:00
|
|
|
RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_active_index_get",
|
|
|
|
"rna_Mesh_uv_layer_active_index_set", "rna_Mesh_uv_layer_index_range");
|
2011-11-17 05:03:07 +00:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
/* mesh float layers */
|
|
|
|
static void rna_def_vertex_float_layers(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "VertexFloatProperties");
|
|
|
|
srna = RNA_def_struct(brna, "VertexFloatProperties", NULL);
|
|
|
|
RNA_def_struct_sdna(srna, "Mesh");
|
|
|
|
RNA_def_struct_ui_text(srna, "Vertex Float Properties", "Collection of float properties");
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "new", "rna_Mesh_vertex_float_property_new");
|
|
|
|
RNA_def_function_ui_description(func, "Add a float property layer to Mesh");
|
|
|
|
RNA_def_string(func, "name", "Float Prop", 0, "", "Float property name");
|
|
|
|
parm = RNA_def_pointer(func, "layer", "MeshVertexFloatPropertyLayer", "", "The newly created layer");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
}
|
|
|
|
|
2011-11-15 12:28:13 +00:00
|
|
|
/* mesh int layers */
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
static void rna_def_vertex_int_layers(BlenderRNA *brna, PropertyRNA *cprop)
|
2011-11-15 12:28:13 +00:00
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
RNA_def_property_srna(cprop, "VertexIntProperties");
|
|
|
|
srna = RNA_def_struct(brna, "VertexIntProperties", NULL);
|
2011-11-15 12:28:13 +00:00
|
|
|
RNA_def_struct_sdna(srna, "Mesh");
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
RNA_def_struct_ui_text(srna, "Vertex Int Properties", "Collection of int properties");
|
2011-11-15 12:28:13 +00:00
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
func = RNA_def_function(srna, "new", "rna_Mesh_vertex_int_property_new");
|
2011-11-15 12:28:13 +00:00
|
|
|
RNA_def_function_ui_description(func, "Add a integer property layer to Mesh");
|
|
|
|
RNA_def_string(func, "name", "Int Prop", 0, "", "Int property name");
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
parm = RNA_def_pointer(func, "layer", "MeshVertexIntPropertyLayer", "", "The newly created layer");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mesh string layers */
|
|
|
|
static void rna_def_vertex_string_layers(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "VertexStringProperties");
|
|
|
|
srna = RNA_def_struct(brna, "VertexStringProperties", NULL);
|
|
|
|
RNA_def_struct_sdna(srna, "Mesh");
|
|
|
|
RNA_def_struct_ui_text(srna, "Vertex String Properties", "Collection of string properties");
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "new", "rna_Mesh_vertex_string_property_new");
|
|
|
|
RNA_def_function_ui_description(func, "Add a string property layer to Mesh");
|
|
|
|
RNA_def_string(func, "name", "String Prop", 0, "", "String property name");
|
|
|
|
parm = RNA_def_pointer(func, "layer", "MeshVertexStringPropertyLayer", "", "The newly created layer");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
|
2011-11-15 12:28:13 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mesh float layers */
|
2012-04-03 11:10:26 +00:00
|
|
|
static void rna_def_polygon_float_layers(BlenderRNA *brna, PropertyRNA *cprop)
|
2011-11-15 12:28:13 +00:00
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
RNA_def_property_srna(cprop, "PolygonFloatProperties");
|
|
|
|
srna = RNA_def_struct(brna, "PolygonFloatProperties", NULL);
|
2011-11-15 12:28:13 +00:00
|
|
|
RNA_def_struct_sdna(srna, "Mesh");
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
RNA_def_struct_ui_text(srna, "Polygon Float Properties", "Collection of float properties");
|
2011-11-15 12:28:13 +00:00
|
|
|
|
2012-04-03 11:10:26 +00:00
|
|
|
func = RNA_def_function(srna, "new", "rna_Mesh_polygon_float_property_new");
|
2011-11-15 12:28:13 +00:00
|
|
|
RNA_def_function_ui_description(func, "Add a float property layer to Mesh");
|
|
|
|
RNA_def_string(func, "name", "Float Prop", 0, "", "Float property name");
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
parm = RNA_def_pointer(func, "layer", "MeshPolygonFloatPropertyLayer", "", "The newly created layer");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mesh int layers */
|
|
|
|
static void rna_def_polygon_int_layers(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "PolygonIntProperties");
|
|
|
|
srna = RNA_def_struct(brna, "PolygonIntProperties", NULL);
|
|
|
|
RNA_def_struct_sdna(srna, "Mesh");
|
|
|
|
RNA_def_struct_ui_text(srna, "Polygon Int Properties", "Collection of int properties");
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "new", "rna_Mesh_polygon_int_property_new");
|
|
|
|
RNA_def_function_ui_description(func, "Add a integer property layer to Mesh");
|
|
|
|
RNA_def_string(func, "name", "Int Prop", 0, "", "Int property name");
|
|
|
|
parm = RNA_def_pointer(func, "layer", "MeshPolygonIntPropertyLayer", "", "The newly created layer");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
|
2011-11-15 12:28:13 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mesh string layers */
|
2012-04-03 11:10:26 +00:00
|
|
|
static void rna_def_polygon_string_layers(BlenderRNA *brna, PropertyRNA *cprop)
|
2011-11-15 12:28:13 +00:00
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
RNA_def_property_srna(cprop, "PolygonStringProperties");
|
|
|
|
srna = RNA_def_struct(brna, "PolygonStringProperties", NULL);
|
2011-11-15 12:28:13 +00:00
|
|
|
RNA_def_struct_sdna(srna, "Mesh");
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
RNA_def_struct_ui_text(srna, "Polygon String Properties", "Collection of string properties");
|
2011-11-15 12:28:13 +00:00
|
|
|
|
2012-04-03 11:10:26 +00:00
|
|
|
func = RNA_def_function(srna, "new", "rna_Mesh_polygon_string_property_new");
|
2011-11-15 12:28:13 +00:00
|
|
|
RNA_def_function_ui_description(func, "Add a string property layer to Mesh");
|
|
|
|
RNA_def_string(func, "name", "String Prop", 0, "", "String property name");
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
parm = RNA_def_pointer(func, "layer", "MeshPolygonStringPropertyLayer", "", "The newly created layer");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
|
2011-11-15 12:28:13 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
}
|
|
|
|
|
2012-09-23 18:50:56 +00:00
|
|
|
static void rna_def_skin_vertices(BlenderRNA *brna, PropertyRNA *UNUSED(cprop))
|
2012-05-22 15:18:43 +00:00
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "MeshSkinVertexLayer", NULL);
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Skin Vertex Layer", "Per-vertex skin data for use with the Skin modifier");
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshSkinVertexLayer_path");
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
|
|
|
RNA_def_struct_name_property(srna, prop);
|
2013-04-30 17:30:40 +00:00
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshVertexLayer_name_set");
|
2012-05-22 15:18:43 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Name", "Name of skin layer");
|
|
|
|
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, "MeshSkinVertex");
|
|
|
|
RNA_def_property_ui_text(prop, "Data", "");
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_MeshSkinVertexLayer_data_begin", "rna_iterator_array_next",
|
|
|
|
"rna_iterator_array_end", "rna_iterator_array_get",
|
|
|
|
"rna_MeshSkinVertexLayer_data_length", NULL, NULL, NULL);
|
|
|
|
|
|
|
|
/* SkinVertex struct */
|
|
|
|
srna = RNA_def_struct(brna, "MeshSkinVertex", NULL);
|
|
|
|
RNA_def_struct_sdna(srna, "MVertSkin");
|
|
|
|
RNA_def_struct_ui_text(srna, "Skin Vertex", "Per-vertex skin data for use with the Skin modifier");
|
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshSkinVertex_path");
|
|
|
|
|
2016-10-07 10:19:22 +02:00
|
|
|
prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_UNSIGNED);
|
2012-05-22 15:18:43 +00:00
|
|
|
RNA_def_property_array(prop, 2);
|
2016-10-07 10:19:22 +02:00
|
|
|
RNA_def_property_ui_range(prop, 0.001, 100.0, 1, 3);
|
2012-05-22 15:18:43 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Radius", "Radius of the skin");
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
|
|
|
|
|
|
|
/* Flags */
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_root", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", MVERT_SKIN_ROOT);
|
2018-08-08 11:31:28 +10:00
|
|
|
RNA_def_property_ui_text(prop, "Root",
|
|
|
|
"Vertex is a root for rotation calculations and armature generation, "
|
|
|
|
"setting this flag does not clear other roots in the same mesh island");
|
2012-05-22 15:18:43 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2012-05-22 15:18:43 +00:00
|
|
|
prop = RNA_def_property(srna, "use_loose", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", MVERT_SKIN_LOOSE);
|
|
|
|
RNA_def_property_ui_text(prop, "Loose", "If vertex has multiple adjacent edges, it is hulled to them directly");
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
|
|
|
}
|
|
|
|
|
2014-11-03 23:31:55 +01:00
|
|
|
static void rna_def_paint_mask(BlenderRNA *brna, PropertyRNA *UNUSED(cprop))
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "MeshPaintMaskLayer", NULL);
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Paint Mask Layer", "Per-vertex paint mask data");
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshPaintMaskLayer_path");
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_struct_type(prop, "MeshPaintMaskProperty");
|
|
|
|
RNA_def_property_ui_text(prop, "Data", "");
|
|
|
|
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_MeshPaintMaskLayer_data_begin", "rna_iterator_array_next",
|
|
|
|
"rna_iterator_array_end", "rna_iterator_array_get",
|
|
|
|
"rna_MeshPaintMaskLayer_data_length", NULL, NULL, NULL);
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "MeshPaintMaskProperty", NULL);
|
|
|
|
RNA_def_struct_sdna(srna, "MFloatProperty");
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Paint Mask Property",
|
|
|
|
"Floating point paint mask value");
|
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshPaintMask_path");
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "f");
|
|
|
|
RNA_def_property_ui_text(prop, "Value", "");
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
|
|
|
}
|
|
|
|
|
2017-07-20 18:37:30 +10:00
|
|
|
static void rna_def_face_map(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "MeshFaceMapLayer", NULL);
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Face Map Layer", "Per-face map index");
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshFaceMapLayer_path");
|
|
|
|
|
|
|
|
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_MeshPolyLayer_name_set");
|
|
|
|
RNA_def_property_ui_text(prop, "Name", "Name of face-map layer");
|
|
|
|
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, "MeshFaceMap");
|
|
|
|
RNA_def_property_ui_text(prop, "Data", "");
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_MeshFaceMapLayer_data_begin", "rna_iterator_array_next",
|
|
|
|
"rna_iterator_array_end", "rna_iterator_array_get",
|
|
|
|
"rna_MeshFaceMapLayer_data_length", NULL, NULL, NULL);
|
|
|
|
|
|
|
|
/* FaceMap struct */
|
|
|
|
srna = RNA_def_struct(brna, "MeshFaceMap", NULL);
|
|
|
|
RNA_def_struct_sdna(srna, "MIntProperty");
|
|
|
|
RNA_def_struct_ui_text(srna, "Int Property", "");
|
|
|
|
RNA_def_struct_path_func(srna, "rna_MeshFaceMap_path");
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "i");
|
|
|
|
RNA_def_property_ui_text(prop, "Value", "");
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_def_face_maps(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "MeshFaceMapLayers");
|
|
|
|
srna = RNA_def_struct(brna, "MeshFaceMapLayers", NULL);
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh Face Map Layer", "Per-face map index");
|
|
|
|
RNA_def_struct_sdna(srna, "Mesh");
|
|
|
|
RNA_def_struct_ui_text(srna, "Mesh FaceMaps", "Collection of mesh face-maps");
|
|
|
|
|
|
|
|
/* add this since we only ever have one layer anyway, don't bother with active_index */
|
|
|
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
|
|
|
RNA_def_property_struct_type(prop, "MeshFaceMapLayer");
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Mesh_face_map_active_get",
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Active FaceMap Layer", "");
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
|
|
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "new", "rna_Mesh_face_map_new");
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
|
|
|
RNA_def_function_ui_description(func, "Add a float property layer to Mesh");
|
|
|
|
RNA_def_string(func, "name", "Face Map", 0, "", "Face map name");
|
|
|
|
parm = RNA_def_pointer(func, "layer", "MeshFaceMapLayer", "", "The newly created layer");
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "remove", "rna_Mesh_face_map_remove");
|
|
|
|
RNA_def_function_ui_description(func, "Remove a face map layer");
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
|
|
|
parm = RNA_def_pointer(func, "layer", "MeshFaceMapLayer", "", "The layer to remove");
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
|
|
|
|
}
|
|
|
|
|
2008-11-24 12:12:24 +00:00
|
|
|
static void rna_def_mesh(BlenderRNA *brna)
|
2008-11-07 02:58:25 +00:00
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
srna = RNA_def_struct(brna, "Mesh", "ID");
|
2015-10-24 02:44:43 +11:00
|
|
|
RNA_def_struct_ui_text(srna, "Mesh", "Mesh data-block defining geometric surfaces");
|
2009-06-03 23:16:51 +00:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_MESH_DATA);
|
2008-11-07 02:58:25 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "vertices", PROP_COLLECTION, PROP_NONE);
|
2008-11-07 02:58:25 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "mvert", "totvert");
|
2009-01-02 14:48:03 +00:00
|
|
|
RNA_def_property_struct_type(prop, "MeshVertex");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Vertices", "Vertices of the mesh");
|
2010-08-26 22:44:05 +00:00
|
|
|
rna_def_mesh_vertices(brna, prop);
|
2008-11-07 02:58:25 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "edges", PROP_COLLECTION, PROP_NONE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "medge", "totedge");
|
2009-01-02 14:48:03 +00:00
|
|
|
RNA_def_property_struct_type(prop, "MeshEdge");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Edges", "Edges of the mesh");
|
2010-08-26 22:44:05 +00:00
|
|
|
rna_def_mesh_edges(brna, prop);
|
2008-11-07 02:58:25 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "loops", PROP_COLLECTION, PROP_NONE);
|
2011-08-31 11:21:54 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "mloop", "totloop");
|
|
|
|
RNA_def_property_struct_type(prop, "MeshLoop");
|
2012-03-23 01:55:38 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Loops", "Loops of the mesh (polygon corners)");
|
2011-08-31 11:21:54 +00:00
|
|
|
rna_def_mesh_loops(brna, prop);
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "polygons", PROP_COLLECTION, PROP_NONE);
|
2011-08-31 05:13:21 +00:00
|
|
|
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);
|
|
|
|
|
2018-09-06 14:28:14 +02:00
|
|
|
prop = RNA_def_property(srna, "loop_triangles", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "runtime.looptris.array", "runtime.looptris.len");
|
|
|
|
RNA_def_property_struct_type(prop, "MeshLoopTriangle");
|
|
|
|
RNA_def_property_ui_text(prop, "Loop Triangles", "Tessellation of mesh polygons into triangles");
|
|
|
|
rna_def_mesh_looptris(brna, prop);
|
|
|
|
|
2009-10-07 09:23:29 +00:00
|
|
|
/* TODO, should this be allowed to be its self? */
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "texture_mesh", PROP_POINTER, PROP_NONE);
|
2009-10-07 09:23:29 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "texcomesh");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
|
2012-03-05 16:19:16 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Texture Mesh",
|
|
|
|
"Use another mesh for texture indices (vertex indices must be aligned)");
|
2009-06-27 01:10:39 +00:00
|
|
|
|
2011-11-17 05:03:07 +00:00
|
|
|
/* UV loop layers */
|
2012-04-22 23:51:50 +00:00
|
|
|
prop = RNA_def_property(srna, "uv_layers", PROP_COLLECTION, PROP_NONE);
|
2011-11-17 05:03:07 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer");
|
2012-04-22 23:51:50 +00:00
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_layers_begin", NULL, NULL, NULL,
|
|
|
|
"rna_Mesh_uv_layers_length", NULL, NULL, NULL);
|
2011-11-17 05:03:07 +00:00
|
|
|
RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
|
|
|
|
RNA_def_property_ui_text(prop, "UV Loop Layers", "All UV loop layers");
|
2012-04-22 23:51:50 +00:00
|
|
|
rna_def_uv_layers(brna, prop);
|
2011-11-17 05:03:07 +00:00
|
|
|
|
2012-12-11 14:11:46 +00:00
|
|
|
prop = RNA_def_property(srna, "uv_layer_clone", PROP_POINTER, PROP_NONE);
|
2011-11-17 05:03:07 +00:00
|
|
|
RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
|
2012-04-22 23:51:50 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_clone_get",
|
|
|
|
"rna_Mesh_uv_layer_clone_set", NULL, NULL);
|
2011-11-17 05:03:07 +00:00
|
|
|
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");
|
2009-06-27 01:10:39 +00:00
|
|
|
|
2012-04-22 23:51:50 +00:00
|
|
|
prop = RNA_def_property(srna, "uv_layer_clone_index", PROP_INT, PROP_UNSIGNED);
|
|
|
|
RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_clone_index_get",
|
|
|
|
"rna_Mesh_uv_layer_clone_index_set", "rna_Mesh_uv_layer_index_range");
|
2011-11-17 05:03:07 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Clone UV loop layer Index", "Clone UV loop layer index");
|
|
|
|
|
2012-12-11 14:11:46 +00:00
|
|
|
prop = RNA_def_property(srna, "uv_layer_stencil", PROP_POINTER, PROP_NONE);
|
2011-11-17 05:03:07 +00:00
|
|
|
RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
|
2012-04-22 23:51:50 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_stencil_get",
|
|
|
|
"rna_Mesh_uv_layer_stencil_set", NULL, NULL);
|
2011-11-17 05:03:07 +00:00
|
|
|
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");
|
|
|
|
|
2012-04-22 23:51:50 +00:00
|
|
|
prop = RNA_def_property(srna, "uv_layer_stencil_index", PROP_INT, PROP_UNSIGNED);
|
|
|
|
RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_stencil_index_get",
|
|
|
|
"rna_Mesh_uv_layer_stencil_index_set", "rna_Mesh_uv_layer_index_range");
|
2011-11-17 05:03:07 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Mask UV loop layer Index", "Mask UV loop layer index");
|
2019-03-21 16:44:01 +01:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2011-11-17 05:03:07 +00:00
|
|
|
|
2009-07-01 22:25:49 +00:00
|
|
|
/* Vertex colors */
|
2009-06-27 01:10:39 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "vertex_colors", PROP_COLLECTION, PROP_NONE);
|
2009-07-16 09:17:27 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer");
|
2011-10-20 07:56:04 +00:00
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", NULL, NULL, NULL,
|
|
|
|
"rna_Mesh_vertex_colors_length", NULL, NULL, NULL);
|
2011-11-25 13:28:04 +00:00
|
|
|
RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
|
|
|
|
RNA_def_property_ui_text(prop, "Vertex Colors", "All vertex colors");
|
|
|
|
rna_def_loop_colors(brna, prop);
|
2008-11-24 12:12:24 +00:00
|
|
|
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
/* TODO, edge customdata layers (bmesh py api can access already) */
|
|
|
|
prop = RNA_def_property(srna, "vertex_layers_float", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_float_layers_begin", NULL, NULL, NULL,
|
|
|
|
"rna_Mesh_vertex_float_layers_length", NULL, NULL, NULL);
|
|
|
|
RNA_def_property_struct_type(prop, "MeshVertexFloatPropertyLayer");
|
|
|
|
RNA_def_property_ui_text(prop, "Float Property Layers", "");
|
|
|
|
rna_def_vertex_float_layers(brna, prop);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "vertex_layers_int", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_int_layers_begin", NULL, NULL, NULL,
|
|
|
|
"rna_Mesh_vertex_int_layers_length", NULL, NULL, NULL);
|
|
|
|
RNA_def_property_struct_type(prop, "MeshVertexIntPropertyLayer");
|
|
|
|
RNA_def_property_ui_text(prop, "Int Property Layers", "");
|
|
|
|
rna_def_vertex_int_layers(brna, prop);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "vertex_layers_string", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_string_layers_begin", NULL, NULL, NULL,
|
|
|
|
"rna_Mesh_vertex_string_layers_length", NULL, NULL, NULL);
|
|
|
|
RNA_def_property_struct_type(prop, "MeshVertexStringPropertyLayer");
|
|
|
|
RNA_def_property_ui_text(prop, "String Property Layers", "");
|
|
|
|
rna_def_vertex_string_layers(brna, prop);
|
|
|
|
|
2012-04-03 11:10:26 +00:00
|
|
|
prop = RNA_def_property(srna, "polygon_layers_float", PROP_COLLECTION, PROP_NONE);
|
2009-07-16 09:17:27 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
|
2012-04-03 11:10:26 +00:00
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Mesh_polygon_float_layers_begin", NULL, NULL, NULL,
|
|
|
|
"rna_Mesh_polygon_float_layers_length", NULL, NULL, NULL);
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
RNA_def_property_struct_type(prop, "MeshPolygonFloatPropertyLayer");
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Float Property Layers", "");
|
2012-04-03 11:10:26 +00:00
|
|
|
rna_def_polygon_float_layers(brna, prop);
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-04-03 11:10:26 +00:00
|
|
|
prop = RNA_def_property(srna, "polygon_layers_int", PROP_COLLECTION, PROP_NONE);
|
2009-07-16 09:17:27 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
|
2012-04-03 11:10:26 +00:00
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Mesh_polygon_int_layers_begin", NULL, NULL, NULL,
|
|
|
|
"rna_Mesh_polygon_int_layers_length", NULL, NULL, NULL);
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
RNA_def_property_struct_type(prop, "MeshPolygonIntPropertyLayer");
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Int Property Layers", "");
|
2012-04-03 11:10:26 +00:00
|
|
|
rna_def_polygon_int_layers(brna, prop);
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-04-03 11:10:26 +00:00
|
|
|
prop = RNA_def_property(srna, "polygon_layers_string", PROP_COLLECTION, PROP_NONE);
|
2009-07-16 09:17:27 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
|
2012-04-03 11:10:26 +00:00
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Mesh_polygon_string_layers_begin", NULL, NULL, NULL,
|
|
|
|
"rna_Mesh_polygon_string_layers_length", NULL, NULL, NULL);
|
Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.
The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.
Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-15 10:33:54 +01:00
|
|
|
RNA_def_property_struct_type(prop, "MeshPolygonStringPropertyLayer");
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_ui_text(prop, "String Property Layers", "");
|
2012-04-03 11:10:26 +00:00
|
|
|
rna_def_polygon_string_layers(brna, prop);
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2017-07-20 18:37:30 +10:00
|
|
|
/* face-maps */
|
|
|
|
prop = RNA_def_property(srna, "face_maps", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Mesh_face_maps_begin", NULL, NULL, NULL,
|
|
|
|
"rna_Mesh_face_maps_length", NULL, NULL, NULL);
|
|
|
|
RNA_def_property_struct_type(prop, "MeshFaceMapLayer");
|
|
|
|
RNA_def_property_ui_text(prop, "FaceMap", "");
|
|
|
|
rna_def_face_maps(brna, prop);
|
|
|
|
|
2012-05-22 15:18:43 +00:00
|
|
|
/* Skin vertices */
|
|
|
|
prop = RNA_def_property(srna, "skin_vertices", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Mesh_skin_vertices_begin", NULL, NULL, NULL,
|
2012-11-09 09:33:28 +00:00
|
|
|
"rna_Mesh_skin_vertices_length", NULL, NULL, NULL);
|
2012-05-22 15:18:43 +00:00
|
|
|
RNA_def_property_struct_type(prop, "MeshSkinVertexLayer");
|
|
|
|
RNA_def_property_ui_text(prop, "Skin Vertices", "All skin vertices");
|
|
|
|
rna_def_skin_vertices(brna, prop);
|
|
|
|
/* End skin vertices */
|
|
|
|
|
2014-11-03 23:31:55 +01:00
|
|
|
/* Paint mask */
|
|
|
|
prop = RNA_def_property(srna, "vertex_paint_masks", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_paint_masks_begin", NULL, NULL, NULL,
|
|
|
|
"rna_Mesh_vertex_paint_masks_length", NULL, NULL, NULL);
|
|
|
|
RNA_def_property_struct_type(prop, "MeshPaintMaskLayer");
|
|
|
|
RNA_def_property_ui_text(prop, "Vertex Paint Mask", "Vertex paint mask");
|
|
|
|
rna_def_paint_mask(brna, prop);
|
|
|
|
/* End paint mask */
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "use_auto_smooth", PROP_BOOLEAN, PROP_NONE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_AUTOSMOOTH);
|
2012-03-05 16:19:16 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Auto Smooth",
|
Add Custom Loop Normals.
This is the core code for it, tools (datatransfer and modifier) will come in next commits).
RNA api is already there, though.
See the code for details, but basically, we define, for each 'smooth fan'
(which is a set of adjacent loops around a same vertex that are smooth, i.e. have a single same normal),
a 'loop normal space' (or lnor space), using auto-computed normal and relevant edges, and store
custom normal as two angular factors inside that space. This allows to have custom normals
'following' deformations of the geometry, and to only save two shorts per loop in new clnor CDLayer.
Normal manipulation (editing, mixing, interpolating, etc.) shall always happen with plain 3D vectors normals,
and be converted back into storage format at the end.
Clnor computation has also been threaded (at least for Mesh case, not for BMesh), since the process can
be rather heavy with high poly meshes.
Also, bumping subversion, and fix mess in 2.70 versioning code.
2015-02-05 14:24:48 +01:00
|
|
|
"Auto smooth (based on smooth/sharp faces/edges and angle between faces), "
|
|
|
|
"or use custom split normals data if available");
|
2014-04-13 12:18:51 +02:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGLE);
|
2014-04-13 12:18:51 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "smoothresh");
|
|
|
|
RNA_def_property_float_default(prop, DEG2RADF(180.0f));
|
|
|
|
RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
|
2012-03-05 16:19:16 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Auto Smooth Angle",
|
Add Custom Loop Normals.
This is the core code for it, tools (datatransfer and modifier) will come in next commits).
RNA api is already there, though.
See the code for details, but basically, we define, for each 'smooth fan'
(which is a set of adjacent loops around a same vertex that are smooth, i.e. have a single same normal),
a 'loop normal space' (or lnor space), using auto-computed normal and relevant edges, and store
custom normal as two angular factors inside that space. This allows to have custom normals
'following' deformations of the geometry, and to only save two shorts per loop in new clnor CDLayer.
Normal manipulation (editing, mixing, interpolating, etc.) shall always happen with plain 3D vectors normals,
and be converted back into storage format at the end.
Clnor computation has also been threaded (at least for Mesh case, not for BMesh), since the process can
be rather heavy with high poly meshes.
Also, bumping subversion, and fix mess in 2.70 versioning code.
2015-02-05 14:24:48 +01:00
|
|
|
"Maximum angle between face normals that will be considered as smooth "
|
|
|
|
"(unused if custom split normals data are available)");
|
2014-04-13 12:18:51 +02:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
Add Custom Loop Normals.
This is the core code for it, tools (datatransfer and modifier) will come in next commits).
RNA api is already there, though.
See the code for details, but basically, we define, for each 'smooth fan'
(which is a set of adjacent loops around a same vertex that are smooth, i.e. have a single same normal),
a 'loop normal space' (or lnor space), using auto-computed normal and relevant edges, and store
custom normal as two angular factors inside that space. This allows to have custom normals
'following' deformations of the geometry, and to only save two shorts per loop in new clnor CDLayer.
Normal manipulation (editing, mixing, interpolating, etc.) shall always happen with plain 3D vectors normals,
and be converted back into storage format at the end.
Clnor computation has also been threaded (at least for Mesh case, not for BMesh), since the process can
be rather heavy with high poly meshes.
Also, bumping subversion, and fix mess in 2.70 versioning code.
2015-02-05 14:24:48 +01:00
|
|
|
RNA_define_verify_sdna(false);
|
|
|
|
prop = RNA_def_property(srna, "has_custom_normals", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "", 0);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_ui_text(prop, "Has Custom Normals",
|
|
|
|
"True if there are custom split normals data in this mesh");
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_Mesh_has_custom_normals_get", NULL);
|
|
|
|
RNA_define_verify_sdna(true);
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "show_double_sided", PROP_BOOLEAN, PROP_NONE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_TWOSIDED);
|
2015-06-13 19:45:45 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Double Sided", "Display the mesh with double or single sided lighting (OpenGL only)");
|
2009-07-01 22:25:49 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2008-11-24 12:12:24 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "texco_mesh", PROP_POINTER, PROP_NONE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "texcomesh");
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Texture Space Mesh", "Derive texture coordinates from another mesh");
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
|
2009-01-10 22:57:33 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "key");
|
2008-12-04 00:07:47 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Shape Keys", "");
|
2012-03-05 16:19:16 +00:00
|
|
|
|
2010-04-12 05:04:49 +00:00
|
|
|
/* texture space */
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
|
2012-02-19 22:17:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE);
|
2012-03-05 16:19:16 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Auto Texture Space",
|
|
|
|
"Adjust active object's texture space automatically when transforming object");
|
2019-01-28 22:25:26 +01:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
|
2011-11-18 16:06:20 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
#if 0
|
|
|
|
prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
|
2010-04-12 05:04:49 +00:00
|
|
|
RNA_def_property_array(prop, 3);
|
2010-05-04 05:15:53 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
|
2010-04-12 05:04:49 +00:00
|
|
|
RNA_def_property_editable_func(prop, "rna_Mesh_texspace_editable");
|
2011-11-18 16:06:20 +00:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", "rna_Mesh_texspace_loc_set", NULL);
|
2010-04-12 05:04:49 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
|
2012-05-12 11:01:29 +00:00
|
|
|
#endif
|
2011-11-18 16:06:20 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
/* not supported yet */
|
|
|
|
#if 0
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
|
2011-11-11 13:09:14 +00:00
|
|
|
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");
|
2012-05-12 11:01:29 +00:00
|
|
|
#endif
|
2010-08-26 22:44:05 +00:00
|
|
|
|
2009-10-14 14:28:05 +00:00
|
|
|
/* editflag */
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
|
2009-10-14 14:28:05 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_X);
|
|
|
|
RNA_def_property_ui_text(prop, "X Mirror", "X Axis mirror editing");
|
2018-09-23 20:41:10 +03:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
|
2009-10-14 14:28:05 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
#if 0
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
|
2009-10-14 14:28:05 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_Y);
|
|
|
|
RNA_def_property_ui_text(prop, "Y Mirror", "Y Axis mirror editing");
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
prop = RNA_def_property(srna, "use_mirror_z", PROP_BOOLEAN, PROP_NONE);
|
2009-10-14 14:28:05 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_Z);
|
|
|
|
RNA_def_property_ui_text(prop, "Z Mirror", "Z Axis mirror editing");
|
2012-05-12 11:01:29 +00:00
|
|
|
#endif
|
2009-10-14 14:28:05 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "use_mirror_topology", PROP_BOOLEAN, PROP_NONE);
|
2010-02-17 19:50:42 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_TOPO);
|
2012-03-05 16:19:16 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Topology Mirror",
|
|
|
|
"Use topology based mirroring "
|
|
|
|
"(for when both sides of mesh have matching, unique topology)");
|
2010-02-17 19:50:42 +00:00
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "use_paint_mask", PROP_BOOLEAN, PROP_NONE);
|
2012-12-22 14:25:34 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_FACE_SEL);
|
2009-10-20 19:27:27 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Paint Mask", "Face selection masking for painting");
|
2018-10-16 20:20:24 +02:00
|
|
|
RNA_def_property_ui_icon(prop, ICON_FACESEL, 0);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Mesh_update_facemask");
|
2012-03-05 16:19:16 +00:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_paint_mask_vertex", PROP_BOOLEAN, PROP_NONE);
|
2012-12-22 14:25:34 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_VERT_SEL);
|
2011-09-14 08:45:12 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Vertex Selection", "Vertex selection masking for painting (weight paint only)");
|
2011-07-13 20:45:09 +00:00
|
|
|
RNA_def_property_ui_icon(prop, ICON_VERTEXSEL, 0);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Mesh_update_vertmask");
|
2010-02-12 22:03:23 +00:00
|
|
|
|
2013-01-10 04:43:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* customdata flags */
|
|
|
|
prop = RNA_def_property(srna, "use_customdata_vertex_bevel", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_VERT_BWEIGHT);
|
|
|
|
RNA_def_property_ui_text(prop, "Store Vertex Bevel Weight", "");
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_customdata_edge_bevel", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_EDGE_BWEIGHT);
|
|
|
|
RNA_def_property_ui_text(prop, "Store Edge Bevel Weight", "");
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_customdata_edge_crease", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_EDGE_CREASE);
|
|
|
|
RNA_def_property_ui_text(prop, "Store Edge Crease", "");
|
|
|
|
|
|
|
|
|
2010-02-12 22:03:23 +00:00
|
|
|
/* readonly editmesh info - use for extrude menu */
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "total_vert_sel", PROP_INT, PROP_UNSIGNED);
|
2010-02-12 22:03:23 +00:00
|
|
|
RNA_def_property_int_funcs(prop, "rna_Mesh_tot_vert_get", NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Selected Vert Total", "Selected vertex count in editmode");
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "total_edge_sel", PROP_INT, PROP_UNSIGNED);
|
2010-02-12 22:03:23 +00:00
|
|
|
RNA_def_property_int_funcs(prop, "rna_Mesh_tot_edge_get", NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Selected Edge Total", "Selected edge count in editmode");
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
2012-03-05 16:19:16 +00:00
|
|
|
prop = RNA_def_property(srna, "total_face_sel", PROP_INT, PROP_UNSIGNED);
|
2010-02-12 22:03:23 +00:00
|
|
|
RNA_def_property_int_funcs(prop, "rna_Mesh_tot_face_get", NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Selected Face Total", "Selected face count in editmode");
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
2013-07-03 22:57:00 +00:00
|
|
|
prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_Mesh_is_editmode_get", NULL);
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
|
|
|
|
|
2009-12-28 00:52:31 +00:00
|
|
|
/* pointers */
|
|
|
|
rna_def_animdata_common(srna);
|
2008-12-02 23:45:11 +00:00
|
|
|
rna_def_texmat_common(srna, "rna_Mesh_texspace_editable");
|
2009-06-18 19:48:55 +00:00
|
|
|
|
|
|
|
RNA_api_mesh(srna);
|
2008-11-24 12:12:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RNA_def_mesh(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
rna_def_mesh(brna);
|
|
|
|
rna_def_mvert(brna);
|
|
|
|
rna_def_mvert_group(brna);
|
|
|
|
rna_def_medge(brna);
|
2018-09-06 14:28:14 +02:00
|
|
|
rna_def_mlooptri(brna);
|
2011-08-31 11:21:54 +00:00
|
|
|
rna_def_mloop(brna);
|
2011-08-31 05:13:21 +00:00
|
|
|
rna_def_mpolygon(brna);
|
2011-11-17 05:03:07 +00:00
|
|
|
rna_def_mloopuv(brna);
|
2009-07-16 09:17:27 +00:00
|
|
|
rna_def_mloopcol(brna);
|
2008-11-24 12:12:24 +00:00
|
|
|
rna_def_mproperties(brna);
|
2017-07-20 18:37:30 +10:00
|
|
|
rna_def_face_map(brna);
|
2008-11-07 02:58:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|