LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 * ***** BEGIN GPL LICENSE BLOCK ***** | 2 * ***** BEGIN GPL LICENSE BLOCK ***** |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or | 4 * This program is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU General Public License | 5 * modify it under the terms of the GNU General Public License |
6 * as published by the Free Software Foundation; either version 2 | 6 * as published by the Free Software Foundation; either version 2 |
7 * of the License, or (at your option) any later version. | 7 * of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 CustomDataLayer *cdl = ptr->data; | 1392 CustomDataLayer *cdl = ptr->data; |
1393 char name_esc[sizeof(cdl->name) * 2]; | 1393 char name_esc[sizeof(cdl->name) * 2]; |
1394 BLI_strescape(name_esc, cdl->name, sizeof(name_esc)); | 1394 BLI_strescape(name_esc, cdl->name, sizeof(name_esc)); |
1395 return BLI_sprintfN("string_layers[\"%s\"]", name_esc); | 1395 return BLI_sprintfN("string_layers[\"%s\"]", name_esc); |
1396 } | 1396 } |
1397 | 1397 |
1398 static char *rna_MeshStringProperty_path(PointerRNA *ptr) | 1398 static char *rna_MeshStringProperty_path(PointerRNA *ptr) |
1399 { | 1399 { |
1400 return rna_PolyCustomData_data_path(ptr, "layers_string", CD_PROP_STR); | 1400 return rna_PolyCustomData_data_path(ptr, "layers_string", CD_PROP_STR); |
1401 } | 1401 } |
1402 | |
1403 /* XXX, we dont have propper byte string support yet, so for now use the (bytes
+ 1) | |
1404 * bmesh API exposes correct python/bytestring access */ | |
1405 void rna_MeshStringProperty_s_get(PointerRNA *ptr, char *value) | |
1406 { | |
1407 MStringProperty *ms = (MStringProperty *)ptr->data; | |
1408 BLI_strncpy(value, ms->s, (int)ms->s_len + 1); | |
1409 } | |
1410 | |
1411 int rna_MeshStringProperty_s_length(PointerRNA *ptr) | |
1412 { | |
1413 MStringProperty *ms = (MStringProperty *)ptr->data; | |
1414 return (int)ms->s_len + 1; | |
1415 } | |
1416 | |
1417 void rna_MeshStringProperty_s_set(PointerRNA *ptr, const char *value) | |
1418 { | |
1419 MStringProperty *ms = (MStringProperty *)ptr->data; | |
1420 BLI_strncpy(ms->s, value, sizeof(ms->s)); | |
1421 } | |
1422 | |
1423 static int rna_Mesh_tot_vert_get(PointerRNA *ptr) | |
1424 { | |
1425 Mesh *me = rna_mesh(ptr); | |
1426 return me->edit_btmesh ? me->edit_btmesh->bm->totvertsel : 0; | |
1427 } | |
1428 static int rna_Mesh_tot_edge_get(PointerRNA *ptr) | |
1429 { | |
1430 Mesh *me = rna_mesh(ptr); | |
1431 return me->edit_btmesh ? me->edit_btmesh->bm->totedgesel : 0; | |
1432 } | |
1433 static int rna_Mesh_tot_face_get(PointerRNA *ptr) | |
1434 { | |
1435 Mesh *me = rna_mesh(ptr); | |
1436 return me->edit_btmesh ? me->edit_btmesh->bm->totfacesel : 0; | |
1437 } | |
1438 | |
1439 static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, const char *name) | |
1440 { | |
1441 PointerRNA ptr; | |
1442 CustomData *ldata; | |
1443 CustomDataLayer *cdl = NULL; | |
1444 int index = ED_mesh_color_add(me, name, false); | |
1445 | |
1446 if (index != -1) { | |
1447 ldata = rna_mesh_ldata_helper(me); | |
1448 cdl = &ldata->layers[CustomData_get_layer_index_n(ldata, CD_MLOO
PCOL, index)]; | |
1449 } | |
1450 | |
1451 RNA_pointer_create(&me->id, &RNA_MeshLoopColorLayer, cdl, &ptr); | |
1452 return ptr; | |
1453 } | |
1454 | |
1455 static void rna_Mesh_vertex_color_remove(struct Mesh *me, ReportList *reports, C
ustomDataLayer *layer) | |
1456 { | |
1457 if (ED_mesh_color_remove_named(me, layer->name) == false) { | |
1458 BKE_reportf(reports, RPT_ERROR, "Vertex color '%s' not found", l
ayer->name); | |
1459 } | |
1460 } | |
1461 | |
1462 static PointerRNA rna_Mesh_tessface_vertex_color_new(struct Mesh *me, ReportList
*reports, const char *name) | |
1463 { | |
1464 PointerRNA ptr; | |
1465 CustomData *fdata; | |
1466 CustomDataLayer *cdl = NULL; | |
1467 int index; | |
1468 | |
1469 if (me->edit_btmesh) { | |
1470 BKE_report(reports, RPT_ERROR, "Cannot add tessface colors in ed
it mode"); | |
1471 return PointerRNA_NULL; | |
1472 } | |
1473 | |
1474 if (me->mpoly) { | |
1475 BKE_report(reports, RPT_ERROR, "Cannot add tessface colors when
MPoly's exist"); | |
1476 return PointerRNA_NULL; | |
1477 } | |
1478 | |
1479 index = ED_mesh_color_add(me, name, false); | |
1480 | |
1481 if (index != -1) { | |
1482 fdata = rna_mesh_fdata_helper(me); | |
1483 cdl = &fdata->layers[CustomData_get_layer_index_n(fdata, CD_MCOL
, index)]; | |
1484 } | |
1485 | |
1486 RNA_pointer_create(&me->id, &RNA_MeshColorLayer, cdl, &ptr); | |
1487 return ptr; | |
1488 } | |
1489 | |
1490 static PointerRNA rna_Mesh_polygon_int_property_new(struct Mesh *me, const char
*name) | |
1491 { | |
1492 PointerRNA ptr; | |
1493 CustomDataLayer *cdl = NULL; | |
1494 int index; | |
1495 | |
1496 CustomData_add_layer_named(&me->pdata, CD_PROP_INT, CD_DEFAULT, NULL, me
->totpoly, name); | |
1497 index = CustomData_get_named_layer_index(&me->pdata, CD_PROP_INT, name); | |
1498 | |
1499 cdl = (index == -1) ? NULL : &(me->pdata.layers[index]); | |
1500 | |
1501 RNA_pointer_create(&me->id, &RNA_MeshIntPropertyLayer, cdl, &ptr); | |
1502 return ptr; | |
1503 } | |
1504 | |
1505 static PointerRNA rna_Mesh_polygon_float_property_new(struct Mesh *me, const cha
r *name) | |
1506 { | |
1507 PointerRNA ptr; | |
1508 CustomDataLayer *cdl = NULL; | |
1509 int index; | |
1510 | |
1511 CustomData_add_layer_named(&me->pdata, CD_PROP_FLT, CD_DEFAULT, NULL, me
->totpoly, name); | |
1512 index = CustomData_get_named_layer_index(&me->pdata, CD_PROP_FLT, name); | |
1513 | |
1514 cdl = (index == -1) ? NULL : &(me->pdata.layers[index]); | |
1515 | |
1516 RNA_pointer_create(&me->id, &RNA_MeshFloatPropertyLayer, cdl, &ptr); | |
1517 return ptr; | |
1518 } | |
1519 | |
1520 static PointerRNA rna_Mesh_polygon_string_property_new(struct Mesh *me, const ch
ar *name) | |
1521 { | |
1522 PointerRNA ptr; | |
1523 CustomDataLayer *cdl = NULL; | |
1524 int index; | |
1525 | |
1526 CustomData_add_layer_named(&me->pdata, CD_PROP_STR, CD_DEFAULT, NULL, me
->totpoly, name); | |
1527 index = CustomData_get_named_layer_index(&me->pdata, CD_PROP_STR, name); | |
1528 | |
1529 cdl = (index == -1) ? NULL : &(me->pdata.layers[index]); | |
1530 | |
1531 RNA_pointer_create(&me->id, &RNA_MeshStringPropertyLayer, cdl, &ptr); | |
1532 return ptr; | |
1533 } | |
1534 | |
1535 static PointerRNA rna_Mesh_uv_texture_new(struct Mesh *me, const char *name) | |
1536 { | |
1537 PointerRNA ptr; | |
1538 CustomData *pdata; | |
1539 CustomDataLayer *cdl = NULL; | |
1540 int index = ED_mesh_uv_texture_add(me, name, false); | |
1541 | |
1542 if (index != -1) { | |
1543 pdata = rna_mesh_pdata_helper(me); | |
1544 cdl = &pdata->layers[CustomData_get_layer_index_n(pdata, CD_MTEX
POLY, index)]; | |
1545 } | |
1546 | |
1547 RNA_pointer_create(&me->id, &RNA_MeshTexturePolyLayer, cdl, &ptr); | |
1548 return ptr; | |
1549 } | |
1550 | |
1551 static void rna_Mesh_uv_texture_layers_remove(struct Mesh *me, ReportList *repor
ts, CustomDataLayer *layer) | |
1552 { | |
1553 if (ED_mesh_uv_texture_remove_named(me, layer->name) == false) { | |
1554 BKE_reportf(reports, RPT_ERROR, "Texture layer '%s' not found",
layer->name); | |
1555 } | |
1556 } | |
1557 | |
1558 /* while this is supposed to be readonly, | |
1559 * keep it to support importers that only make tessfaces */ | |
1560 | |
1561 static PointerRNA rna_Mesh_tessface_uv_texture_new(struct Mesh *me, ReportList *
reports, const char *name) | |
1562 { | |
1563 PointerRNA ptr; | |
1564 CustomData *fdata; | |
1565 CustomDataLayer *cdl = NULL; | |
1566 int index; | |
1567 | |
1568 if (me->edit_btmesh) { | |
1569 BKE_report(reports, RPT_ERROR, "Cannot add tessface uv's in edit
mode"); | |
1570 return PointerRNA_NULL; | |
1571 } | |
1572 | |
1573 if (me->mpoly) { | |
1574 BKE_report(reports, RPT_ERROR, "Cannot add tessface uv's when MP
oly's exist"); | |
1575 return PointerRNA_NULL; | |
1576 } | |
1577 | |
1578 index = ED_mesh_uv_texture_add(me, name, false); | |
1579 | |
1580 if (index != -1) { | |
1581 fdata = rna_mesh_fdata_helper(me); | |
1582 cdl = &fdata->layers[CustomData_get_layer_index_n(fdata, CD_MTFA
CE, index)]; | |
1583 } | |
1584 | |
1585 RNA_pointer_create(&me->id, &RNA_MeshTextureFaceLayer, cdl, &ptr); | |
1586 return ptr; | |
1587 } | |
1588 | |
1589 | |
1590 static int rna_Mesh_is_editmode_get(PointerRNA *ptr) | |
1591 { | |
1592 Mesh *me = rna_mesh(ptr); | |
1593 return (me->edit_btmesh != NULL); | |
1594 } | |
1595 | |
1596 /* only to quiet warnings */ | |
1597 static void UNUSED_FUNCTION(rna_mesh_unused)(void) | |
1598 { | |
1599 /* unused functions made by macros */ | |
1600 (void)rna_Mesh_skin_vertice_index_range; | |
1601 (void)rna_Mesh_tessface_uv_texture_active_set; | |
1602 (void)rna_Mesh_tessface_uv_texture_clone_get; | |
1603 (void)rna_Mesh_tessface_uv_texture_clone_index_get; | |
1604 (void)rna_Mesh_tessface_uv_texture_clone_index_set; | |
1605 (void)rna_Mesh_tessface_uv_texture_clone_set; | |
1606 (void)rna_Mesh_tessface_uv_texture_index_range; | |
1607 (void)rna_Mesh_tessface_uv_texture_render_get; | |
1608 (void)rna_Mesh_tessface_uv_texture_render_index_get; | |
1609 (void)rna_Mesh_tessface_uv_texture_render_index_set; | |
1610 (void)rna_Mesh_tessface_uv_texture_render_set; | |
1611 (void)rna_Mesh_tessface_uv_texture_stencil_get; | |
1612 (void)rna_Mesh_tessface_uv_texture_stencil_index_get; | |
1613 (void)rna_Mesh_tessface_uv_texture_stencil_index_set; | |
1614 (void)rna_Mesh_tessface_uv_texture_stencil_set; | |
1615 (void)rna_Mesh_tessface_vertex_color_active_set; | |
1616 (void)rna_Mesh_tessface_vertex_color_index_range; | |
1617 (void)rna_Mesh_tessface_vertex_color_render_get; | |
1618 (void)rna_Mesh_tessface_vertex_color_render_index_get; | |
1619 (void)rna_Mesh_tessface_vertex_color_render_index_set; | |
1620 (void)rna_Mesh_tessface_vertex_color_render_set; | |
1621 (void)rna_Mesh_uv_layer_render_get; | |
1622 (void)rna_Mesh_uv_layer_render_index_get; | |
1623 (void)rna_Mesh_uv_layer_render_index_set; | |
1624 (void)rna_Mesh_uv_layer_render_set; | |
1625 (void)rna_Mesh_uv_texture_render_get; | |
1626 (void)rna_Mesh_uv_texture_render_index_get; | |
1627 (void)rna_Mesh_uv_texture_render_index_set; | |
1628 (void)rna_Mesh_uv_texture_render_set; | |
1629 (void)rna_Mesh_vertex_color_render_get; | |
1630 (void)rna_Mesh_vertex_color_render_index_get; | |
1631 (void)rna_Mesh_vertex_color_render_index_set; | |
1632 (void)rna_Mesh_vertex_color_render_set; | |
1633 /* end unused function block */ | |
1634 } | |
1635 | |
1636 #else | |
1637 | |
1638 static void rna_def_mvert_group(BlenderRNA *brna) | |
1639 { | |
1640 StructRNA *srna; | |
1641 PropertyRNA *prop; | |
1642 | |
1643 srna = RNA_def_struct(brna, "VertexGroupElement", NULL); | |
1644 RNA_def_struct_sdna(srna, "MDeformWeight"); | |
1645 RNA_def_struct_path_func(srna, "rna_VertexGroupElement_path"); | |
1646 RNA_def_struct_ui_text(srna, "Vertex Group Element", "Weight value of a
vertex in a vertex group"); | |
1647 RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX); | |
1648 | |
1649 /* we can't point to actual group, it is in the object and so | |
1650 * there is no unique group to point to, hence the index */ | |
1651 prop = RNA_def_property(srna, "group", PROP_INT, PROP_UNSIGNED); | |
1652 RNA_def_property_int_sdna(prop, NULL, "def_nr"); | |
1653 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
1654 RNA_def_property_ui_text(prop, "Group Index", ""); | |
1655 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
1656 | |
1657 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); | |
1658 RNA_def_property_range(prop, 0.0f, 1.0f); | |
1659 RNA_def_property_ui_text(prop, "Weight", "Vertex Weight"); | |
1660 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
1661 } | |
1662 | |
1663 static void rna_def_mvert(BlenderRNA *brna) | |
1664 { | |
1665 StructRNA *srna; | |
1666 PropertyRNA *prop; | |
1667 | |
1668 srna = RNA_def_struct(brna, "MeshVertex", NULL); | |
1669 RNA_def_struct_sdna(srna, "MVert"); | |
1670 RNA_def_struct_ui_text(srna, "Mesh Vertex", "Vertex in a Mesh datablock"
); | |
1671 RNA_def_struct_path_func(srna, "rna_MeshVertex_path"); | |
1672 RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL); | |
1673 | |
1674 prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION); | |
1675 RNA_def_property_ui_text(prop, "Location", ""); | |
1676 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
1677 | |
1678 prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION); | |
1679 /* RNA_def_property_float_sdna(prop, NULL, "no"); */ | |
1680 RNA_def_property_array(prop, 3); | |
1681 RNA_def_property_range(prop, -1.0f, 1.0f); | |
1682 RNA_def_property_float_funcs(prop, "rna_MeshVertex_normal_get", "rna_Mes
hVertex_normal_set", NULL); | |
1683 RNA_def_property_ui_text(prop, "Normal", "Vertex Normal"); | |
1684 | |
1685 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); | |
1686 RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT); | |
1687 RNA_def_property_ui_text(prop, "Select", ""); | |
1688 RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); | |
1689 | |
1690 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); | |
1691 RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE); | |
1692 RNA_def_property_ui_text(prop, "Hide", ""); | |
1693 RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); | |
1694 | |
1695 prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE); | |
1696 RNA_def_property_float_funcs(prop, "rna_MeshVertex_bevel_weight_get", "r
na_MeshVertex_bevel_weight_set", NULL); | |
1697 RNA_def_property_ui_text(prop, "Bevel Weight", "Weight used by the Bevel
modifier 'Only Vertices' option"); | |
1698 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
1699 | |
1700 prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE); | |
1701 RNA_def_property_collection_funcs(prop, "rna_MeshVertex_groups_begin", "
rna_iterator_array_next", | |
1702 "rna_iterator_array_end", "rna_iterato
r_array_get", NULL, NULL, NULL, NULL); | |
1703 RNA_def_property_struct_type(prop, "VertexGroupElement"); | |
1704 RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups
this vertex is member of"); | |
1705 | |
1706 prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); | |
1707 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
1708 RNA_def_property_int_funcs(prop, "rna_MeshVertex_index_get", NULL, NULL)
; | |
1709 RNA_def_property_ui_text(prop, "Index", "Index of this vertex"); | |
1710 | |
1711 prop = RNA_def_property(srna, "undeformed_co", PROP_FLOAT, PROP_TRANSLAT
ION); | |
1712 RNA_def_property_array(prop, 3); | |
1713 RNA_def_property_ui_text(prop, "Undeformed Location", | |
1714 "For meshes with modifiers applied, the coordin
ate of the vertex with no deforming " | |
1715 "modifiers applied, as used for generated textu
re coordinates"); | |
1716 RNA_def_property_float_funcs(prop, "rna_MeshVertex_undeformed_co_get", N
ULL, NULL); | |
1717 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
1718 } | |
1719 | |
1720 static void rna_def_medge(BlenderRNA *brna) | |
1721 { | |
1722 StructRNA *srna; | |
1723 PropertyRNA *prop; | |
1724 | |
1725 srna = RNA_def_struct(brna, "MeshEdge", NULL); | |
1726 RNA_def_struct_sdna(srna, "MEdge"); | |
1727 RNA_def_struct_ui_text(srna, "Mesh Edge", "Edge in a Mesh datablock"); | |
1728 RNA_def_struct_path_func(srna, "rna_MeshEdge_path"); | |
1729 RNA_def_struct_ui_icon(srna, ICON_EDGESEL); | |
1730 | |
1731 prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED); | |
1732 RNA_def_property_int_sdna(prop, NULL, "v1"); | |
1733 RNA_def_property_array(prop, 2); | |
1734 RNA_def_property_ui_text(prop, "Vertices", "Vertex indices"); | |
1735 /* XXX allows creating invalid meshes */ | |
1736 | |
1737 prop = RNA_def_property(srna, "crease", PROP_FLOAT, PROP_NONE); | |
1738 RNA_def_property_float_funcs(prop, "rna_MEdge_crease_get", "rna_MEdge_cr
ease_set", NULL); | |
1739 RNA_def_property_ui_text(prop, "Crease", "Weight used by the Subsurf mod
ifier for creasing"); | |
1740 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
1741 | |
1742 prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE); | |
1743 RNA_def_property_float_funcs(prop, "rna_MEdge_bevel_weight_get", "rna_ME
dge_bevel_weight_set", NULL); | |
1744 RNA_def_property_ui_text(prop, "Bevel Weight", "Weight used by the Bevel
modifier"); | |
1745 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
1746 | |
1747 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); | |
1748 RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT); | |
1749 RNA_def_property_ui_text(prop, "Select", ""); | |
1750 RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); | |
1751 | |
1752 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); | |
1753 RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE); | |
1754 RNA_def_property_ui_text(prop, "Hide", ""); | |
1755 RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); | |
1756 | |
1757 prop = RNA_def_property(srna, "use_seam", PROP_BOOLEAN, PROP_NONE); | |
1758 RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SEAM); | |
1759 RNA_def_property_ui_text(prop, "Seam", "Seam edge for UV unwrapping"); | |
1760 RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); | |
1761 | |
1762 prop = RNA_def_property(srna, "use_edge_sharp", PROP_BOOLEAN, PROP_NONE)
; | |
1763 RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SHARP); | |
1764 RNA_def_property_ui_text(prop, "Sharp", "Sharp edge for the EdgeSplit mo
difier"); | |
1765 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
1766 | |
1767 prop = RNA_def_property(srna, "is_loose", PROP_BOOLEAN, PROP_NONE); | |
1768 RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_LOOSEEDGE); | |
1769 RNA_def_property_ui_text(prop, "Loose", "Loose edge"); | |
1770 | |
1771 prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); | |
1772 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
1773 RNA_def_property_int_funcs(prop, "rna_MeshEdge_index_get", NULL, NULL); | |
1774 RNA_def_property_ui_text(prop, "Index", "Index of this edge"); | |
1775 } | |
1776 | |
1777 static void rna_def_mface(BlenderRNA *brna) | |
1778 { | |
1779 StructRNA *srna; | |
1780 PropertyRNA *prop; | |
1781 | |
1782 srna = RNA_def_struct(brna, "MeshTessFace", NULL); | |
1783 RNA_def_struct_sdna(srna, "MFace"); | |
1784 RNA_def_struct_ui_text(srna, "Mesh TessFace", "TessFace in a Mesh databl
ock"); | |
1785 RNA_def_struct_path_func(srna, "rna_MeshTessFace_path"); | |
1786 RNA_def_struct_ui_icon(srna, ICON_FACESEL); | |
1787 | |
1788 /* XXX allows creating invalid meshes */ | |
1789 prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED); | |
1790 RNA_def_property_array(prop, 4); | |
1791 RNA_def_property_flag(prop, PROP_DYNAMIC); | |
1792 RNA_def_property_dynamic_array_funcs(prop, "rna_MeshTessFace_verts_get_l
ength"); | |
1793 RNA_def_property_int_funcs(prop, "rna_MeshTessFace_verts_get", "rna_Mesh
TessFace_verts_set", NULL); | |
1794 RNA_def_property_ui_text(prop, "Vertices", "Vertex indices"); | |
1795 | |
1796 /* leaving this fixed size array for foreach_set used in import scripts
*/ | |
1797 prop = RNA_def_property(srna, "vertices_raw", PROP_INT, PROP_UNSIGNED); | |
1798 RNA_def_property_int_sdna(prop, NULL, "v1"); | |
1799 RNA_def_property_array(prop, 4); | |
1800 RNA_def_property_ui_text(prop, "Vertices", "Fixed size vertex indices ar
ray"); | |
1801 | |
1802 prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED)
; | |
1803 RNA_def_property_int_sdna(prop, NULL, "mat_nr"); | |
1804 RNA_def_property_ui_text(prop, "Material Index", ""); | |
1805 #if 0 | |
1806 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshPoly_material_inde
x_range"); /* reuse for tessface is ok */ | |
1807 #endif | |
1808 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
1809 | |
1810 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); | |
1811 RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_FACE_SEL); | |
1812 RNA_def_property_ui_text(prop, "Select", ""); | |
1813 RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); | |
1814 | |
1815 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); | |
1816 RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE); | |
1817 RNA_def_property_ui_text(prop, "Hide", ""); | |
1818 RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); | |
1819 | |
1820 prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE); | |
1821 RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SMOOTH); | |
1822 RNA_def_property_ui_text(prop, "Smooth", ""); | |
1823 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
1824 | |
1825 prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION); | |
1826 RNA_def_property_array(prop, 3); | |
1827 RNA_def_property_range(prop, -1.0f, 1.0f); | |
1828 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
1829 RNA_def_property_float_funcs(prop, "rna_MeshTessFace_normal_get", NULL,
NULL); | |
1830 RNA_def_property_ui_text(prop, "Face Normal", "Local space unit length n
ormal vector for this face"); | |
1831 | |
1832 prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED); | |
1833 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
1834 RNA_def_property_float_funcs(prop, "rna_MeshTessFace_area_get", NULL, NU
LL); | |
1835 RNA_def_property_ui_text(prop, "Face Area", "Read only area of this face
"); | |
1836 | |
1837 prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); | |
1838 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
1839 RNA_def_property_int_funcs(prop, "rna_MeshTessFace_index_get", NULL, NUL
L); | |
1840 RNA_def_property_ui_text(prop, "Index", "Index of this face"); | |
1841 } | |
1842 | |
1843 | |
1844 static void rna_def_mloop(BlenderRNA *brna) | |
1845 { | |
1846 StructRNA *srna; | |
1847 PropertyRNA *prop; | |
1848 | |
1849 srna = RNA_def_struct(brna, "MeshLoop", NULL); | |
1850 RNA_def_struct_sdna(srna, "MLoop"); | |
1851 RNA_def_struct_ui_text(srna, "Mesh Loop", "Loop in a Mesh datablock"); | |
1852 RNA_def_struct_path_func(srna, "rna_MeshLoop_path"); | |
1853 RNA_def_struct_ui_icon(srna, ICON_EDGESEL); | |
1854 | |
1855 prop = RNA_def_property(srna, "vertex_index", PROP_INT, PROP_UNSIGNED); | |
1856 RNA_def_property_int_sdna(prop, NULL, "v"); | |
1857 RNA_def_property_ui_text(prop, "Vertex", "Vertex index"); | |
1858 | |
1859 prop = RNA_def_property(srna, "edge_index", PROP_INT, PROP_UNSIGNED); | |
1860 RNA_def_property_int_sdna(prop, NULL, "e"); | |
1861 RNA_def_property_ui_text(prop, "Edge", "Edge index"); | |
1862 | |
1863 prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); | |
1864 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
1865 RNA_def_property_int_funcs(prop, "rna_MeshLoop_index_get", NULL, NULL); | |
1866 RNA_def_property_ui_text(prop, "Index", "Index of this loop"); | |
1867 | |
1868 prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION); | |
1869 RNA_def_property_array(prop, 3); | |
1870 RNA_def_property_range(prop, -1.0f, 1.0f); | |
1871 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
1872 RNA_def_property_float_funcs(prop, "rna_MeshLoop_normal_get", NULL, NULL
); | |
1873 RNA_def_property_ui_text(prop, "Loop Normal", | |
1874 "Local space unit length split normal vector of
this vertex for this polygon " | |
1875 "(only computed on demand!)"); | |
1876 | |
1877 } | |
1878 | |
1879 static void rna_def_mpolygon(BlenderRNA *brna) | |
1880 { | |
1881 StructRNA *srna; | |
1882 PropertyRNA *prop; | |
1883 | |
1884 srna = RNA_def_struct(brna, "MeshPolygon", NULL); | |
1885 RNA_def_struct_sdna(srna, "MPoly"); | |
1886 RNA_def_struct_ui_text(srna, "Mesh Polygon", "Polygon in a Mesh databloc
k"); | |
1887 RNA_def_struct_path_func(srna, "rna_MeshPolygon_path"); | |
1888 RNA_def_struct_ui_icon(srna, ICON_FACESEL); | |
1889 | |
1890 /* Faked, actually access to loop vertex values, don't this way because
manually setting up | |
1891 * vertex/edge per loop is very low level. | |
1892 * Instead we setup poly sizes, assign indices, then calc edges automati
c when creating | |
1893 * meshes from rna/py. */ | |
1894 prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED); | |
1895 /* Eek, this is still used in some cases but in fact we don't want to us
e it at all here. */ | |
1896 RNA_def_property_array(prop, 3); | |
1897 RNA_def_property_flag(prop, PROP_DYNAMIC); | |
1898 RNA_def_property_dynamic_array_funcs(prop, "rna_MeshPoly_vertices_get_le
ngth"); | |
1899 RNA_def_property_int_funcs(prop, "rna_MeshPoly_vertices_get", "rna_MeshP
oly_vertices_set", NULL); | |
1900 RNA_def_property_ui_text(prop, "Vertices", "Vertex indices"); | |
1901 | |
1902 /* these are both very low level access */ | |
1903 prop = RNA_def_property(srna, "loop_start", PROP_INT, PROP_UNSIGNED); | |
1904 RNA_def_property_int_sdna(prop, NULL, "loopstart"); | |
1905 RNA_def_property_ui_text(prop, "Loop Start", "Index of the first loop of
this polygon"); | |
1906 /* also low level */ | |
1907 prop = RNA_def_property(srna, "loop_total", PROP_INT, PROP_UNSIGNED); | |
1908 RNA_def_property_int_sdna(prop, NULL, "totloop"); | |
1909 RNA_def_property_ui_text(prop, "Loop Total", "Number of loops used by th
is polygon"); | |
1910 | |
1911 prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED)
; | |
1912 RNA_def_property_int_sdna(prop, NULL, "mat_nr"); | |
1913 RNA_def_property_ui_text(prop, "Material Index", ""); | |
1914 #if 0 | |
1915 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshPoly_material_inde
x_range"); | |
1916 #endif | |
1917 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
1918 | |
1919 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); | |
1920 RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_FACE_SEL); | |
1921 RNA_def_property_ui_text(prop, "Select", ""); | |
1922 RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); | |
1923 | |
1924 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); | |
1925 RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE); | |
1926 RNA_def_property_ui_text(prop, "Hide", ""); | |
1927 RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); | |
1928 | |
1929 prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE); | |
1930 RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SMOOTH); | |
1931 RNA_def_property_ui_text(prop, "Smooth", ""); | |
1932 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
1933 | |
1934 prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION); | |
1935 RNA_def_property_array(prop, 3); | |
1936 RNA_def_property_range(prop, -1.0f, 1.0f); | |
1937 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
1938 RNA_def_property_float_funcs(prop, "rna_MeshPolygon_normal_get", NULL, N
ULL); | |
1939 RNA_def_property_ui_text(prop, "Polygon Normal", "Local space unit lengt
h normal vector for this polygon"); | |
1940 | |
1941 prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_NONE); | |
1942 RNA_def_property_array(prop, 3); | |
1943 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
1944 RNA_def_property_float_funcs(prop, "rna_MeshPolygon_center_get", NULL, N
ULL); | |
1945 RNA_def_property_ui_text(prop, "Polygon Center", "Center of this polygon
"); | |
1946 | |
1947 prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED); | |
1948 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
1949 RNA_def_property_float_funcs(prop, "rna_MeshPolygon_area_get", NULL, NUL
L); | |
1950 RNA_def_property_ui_text(prop, "Polygon Area", "Read only area of this p
olygon"); | |
1951 | |
1952 prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); | |
1953 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
1954 RNA_def_property_int_funcs(prop, "rna_MeshPolygon_index_get", NULL, NULL
); | |
1955 RNA_def_property_ui_text(prop, "Index", "Index of this polygon"); | |
1956 } | |
1957 | |
1958 /* mesh.loop_uvs */ | |
1959 static void rna_def_mloopuv(BlenderRNA *brna) | |
1960 { | |
1961 StructRNA *srna; | |
1962 PropertyRNA *prop; | |
1963 | |
1964 srna = RNA_def_struct(brna, "MeshUVLoopLayer", NULL); | |
1965 RNA_def_struct_sdna(srna, "CustomDataLayer"); | |
1966 RNA_def_struct_path_func(srna, "rna_MeshUVLoopLayer_path"); | |
1967 | |
1968 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); | |
1969 RNA_def_property_struct_type(prop, "MeshUVLoop"); | |
1970 RNA_def_property_collection_funcs(prop, "rna_MeshUVLoopLayer_data_begin"
, "rna_iterator_array_next", | |
1971 "rna_iterator_array_end", "rna_iterato
r_array_get", | |
1972 "rna_MeshUVLoopLayer_data_length", NUL
L, NULL, NULL); | |
1973 | |
1974 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | |
1975 RNA_def_struct_name_property(srna, prop); | |
1976 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshUVLayer_name_se
t"); | |
1977 RNA_def_property_ui_text(prop, "Name", "Name of UV map"); | |
1978 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
1979 | |
1980 srna = RNA_def_struct(brna, "MeshUVLoop", NULL); | |
1981 RNA_def_struct_sdna(srna, "MLoopUV"); | |
1982 RNA_def_struct_path_func(srna, "rna_MeshUVLoop_path"); | |
1983 | |
1984 prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_XYZ); | |
1985 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
1986 | |
1987 prop = RNA_def_property(srna, "pin_uv", PROP_BOOLEAN, PROP_NONE); | |
1988 RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_PINNED); | |
1989 RNA_def_property_ui_text(prop, "UV Pinned", ""); | |
1990 | |
1991 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); | |
1992 RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_VERTSEL); | |
1993 RNA_def_property_ui_text(prop, "UV Select", ""); | |
1994 | |
1995 prop = RNA_def_property(srna, "select_edge", PROP_BOOLEAN, PROP_NONE); | |
1996 RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_EDGESEL); | |
1997 RNA_def_property_ui_text(prop, "UV Edge Select", ""); | |
1998 } | |
1999 | |
2000 static void rna_def_mtface(BlenderRNA *brna) | |
2001 { | |
2002 StructRNA *srna; | |
2003 PropertyRNA *prop; | |
2004 const int uv_dim[] = {4, 2}; | |
2005 | |
2006 srna = RNA_def_struct(brna, "MeshTextureFaceLayer", NULL); | |
2007 RNA_def_struct_ui_text(srna, "Mesh UV Map", "UV map with assigned image
textures in a Mesh datablock"); | |
2008 RNA_def_struct_sdna(srna, "CustomDataLayer"); | |
2009 RNA_def_struct_path_func(srna, "rna_MeshTextureFaceLayer_path"); | |
2010 RNA_def_struct_ui_icon(srna, ICON_GROUP_UVS); | |
2011 | |
2012 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | |
2013 RNA_def_struct_name_property(srna, prop); | |
2014 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshUVLayer_name_se
t"); | |
2015 RNA_def_property_ui_text(prop, "Name", "Name of UV map"); | |
2016 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2017 | |
2018 prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); | |
2019 RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_ge
t", "rna_MeshTextureFaceLayer_active_set"); | |
2020 RNA_def_property_ui_text(prop, "Active", "Set the map as active for disp
lay and editing"); | |
2021 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2022 | |
2023 prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE); | |
2024 RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0); | |
2025 RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_re
nder_get", | |
2026 "rna_MeshTextureFaceLayer_active_render_s
et"); | |
2027 RNA_def_property_ui_text(prop, "Active Render", "Set the map as active f
or rendering"); | |
2028 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2029 | |
2030 prop = RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE); | |
2031 RNA_def_property_boolean_sdna(prop, NULL, "active_clone", 0); | |
2032 RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_clone_get
", "rna_MeshTextureFaceLayer_clone_set"); | |
2033 RNA_def_property_ui_text(prop, "Active Clone", "Set the map as active fo
r cloning"); | |
2034 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2035 | |
2036 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); | |
2037 RNA_def_property_struct_type(prop, "MeshTextureFace"); | |
2038 RNA_def_property_ui_text(prop, "Data", ""); | |
2039 RNA_def_property_collection_funcs(prop, "rna_MeshTextureFaceLayer_data_b
egin", "rna_iterator_array_next", | |
2040 "rna_iterator_array_end", "rna_iterato
r_array_get", | |
2041 "rna_MeshTextureFaceLayer_data_length"
, NULL, NULL, NULL); | |
2042 | |
2043 srna = RNA_def_struct(brna, "MeshTextureFace", NULL); | |
2044 RNA_def_struct_sdna(srna, "MTFace"); | |
2045 RNA_def_struct_ui_text(srna, "Mesh UV Map Face", "UV map and image textu
re for a face"); | |
2046 RNA_def_struct_path_func(srna, "rna_MeshTextureFace_path"); | |
2047 RNA_def_struct_ui_icon(srna, ICON_FACESEL_HLT); | |
2048 | |
2049 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); | |
2050 RNA_def_property_pointer_sdna(prop, NULL, "tpage"); | |
2051 RNA_def_property_pointer_funcs(prop, NULL, "rna_TextureFace_image_set",
NULL, NULL); | |
2052 RNA_def_property_flag(prop, PROP_EDITABLE); | |
2053 RNA_def_property_ui_text(prop, "Image", ""); | 1402 RNA_def_property_ui_text(prop, "Image", ""); |
2054 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | 1403 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); |
2055 | 1404 |
2056 /* these are for editing only, access at loops now */ | 1405 prop= RNA_def_property(srna, "use_image", PROP_BOOLEAN, PROP_NONE); |
2057 #if 0 | 1406 RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_TEX); |
2058 prop = RNA_def_property(srna, "select_uv", PROP_BOOLEAN, PROP_NONE); | 1407 RNA_def_property_ui_text(prop, "Tex", "Render face with texture"); |
2059 RNA_def_property_boolean_sdna(prop, NULL, "flag", TF_SEL1); | |
2060 RNA_def_property_array(prop, 4); | |
2061 RNA_def_property_ui_text(prop, "UV Selected", ""); | |
2062 RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); | |
2063 | |
2064 prop = RNA_def_property(srna, "pin_uv", PROP_BOOLEAN, PROP_NONE); | |
2065 RNA_def_property_boolean_sdna(prop, NULL, "unwrap", TF_PIN1); | |
2066 RNA_def_property_array(prop, 4); | |
2067 RNA_def_property_ui_text(prop, "UV Pinned", ""); | |
2068 RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); | |
2069 #endif | |
2070 | |
2071 prop = RNA_def_property(srna, "uv1", PROP_FLOAT, PROP_XYZ); | |
2072 RNA_def_property_array(prop, 2); | |
2073 RNA_def_property_float_funcs(prop, "rna_MeshTextureFace_uv1_get", "rna_M
eshTextureFace_uv1_set", NULL); | |
2074 RNA_def_property_ui_text(prop, "UV 1", ""); | |
2075 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2076 | |
2077 prop = RNA_def_property(srna, "uv2", PROP_FLOAT, PROP_XYZ); | |
2078 RNA_def_property_array(prop, 2); | |
2079 RNA_def_property_float_funcs(prop, "rna_MeshTextureFace_uv2_get", "rna_M
eshTextureFace_uv2_set", NULL); | |
2080 RNA_def_property_ui_text(prop, "UV 2", ""); | |
2081 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2082 | |
2083 prop = RNA_def_property(srna, "uv3", PROP_FLOAT, PROP_XYZ); | |
2084 RNA_def_property_array(prop, 2); | |
2085 RNA_def_property_float_funcs(prop, "rna_MeshTextureFace_uv3_get", "rna_M
eshTextureFace_uv3_set", NULL); | |
2086 RNA_def_property_ui_text(prop, "UV 3", ""); | |
2087 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2088 | |
2089 prop = RNA_def_property(srna, "uv4", PROP_FLOAT, PROP_XYZ); | |
2090 RNA_def_property_array(prop, 2); | |
2091 RNA_def_property_float_funcs(prop, "rna_MeshTextureFace_uv4_get", "rna_M
eshTextureFace_uv4_set", NULL); | |
2092 RNA_def_property_ui_text(prop, "UV 4", ""); | |
2093 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2094 | |
2095 prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE); | |
2096 RNA_def_property_multi_array(prop, 2, uv_dim); | |
2097 RNA_def_property_flag(prop, PROP_DYNAMIC); | |
2098 RNA_def_property_dynamic_array_funcs(prop, "rna_MeshTextureFace_uv_get_l
ength"); | |
2099 RNA_def_property_float_funcs(prop, "rna_MeshTextureFace_uv_get", "rna_Me
shTextureFace_uv_set", NULL); | |
2100 RNA_def_property_ui_text(prop, "UV", ""); | |
2101 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2102 | |
2103 prop = RNA_def_property(srna, "uv_raw", PROP_FLOAT, PROP_NONE); | |
2104 RNA_def_property_multi_array(prop, 2, uv_dim); | |
2105 RNA_def_property_float_sdna(prop, NULL, "uv"); | |
2106 RNA_def_property_ui_text(prop, "UV Raw", "Fixed size UV coordinates arra
y"); | |
2107 | |
2108 } | |
2109 | |
2110 static void rna_def_mtexpoly(BlenderRNA *brna) | |
2111 { | |
2112 StructRNA *srna; | |
2113 PropertyRNA *prop; | |
2114 #if 0 /* BMESH_TODO: needed later when do another todo */ | |
2115 int uv_dim[] = {4, 2}; | |
2116 #endif | |
2117 | |
2118 srna = RNA_def_struct(brna, "MeshTexturePolyLayer", NULL); | |
2119 RNA_def_struct_ui_text(srna, "Mesh UV Map", "UV map with assigned image
textures in a Mesh datablock"); | |
2120 RNA_def_struct_sdna(srna, "CustomDataLayer"); | |
2121 RNA_def_struct_path_func(srna, "rna_MeshTexturePolyLayer_path"); | |
2122 RNA_def_struct_ui_icon(srna, ICON_GROUP_UVS); | |
2123 | |
2124 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | |
2125 RNA_def_struct_name_property(srna, prop); | |
2126 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshUVLayer_name_se
t"); | |
2127 RNA_def_property_ui_text(prop, "Name", "Name of UV map"); | |
2128 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2129 | |
2130 prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); | |
2131 RNA_def_property_boolean_funcs(prop, "rna_MeshTexturePolyLayer_active_ge
t", "rna_MeshTexturePolyLayer_active_set"); | |
2132 RNA_def_property_ui_text(prop, "Active", "Set the map as active for disp
lay and editing"); | |
2133 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2134 | |
2135 prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE); | |
2136 RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0); | |
2137 RNA_def_property_boolean_funcs(prop, "rna_MeshTexturePolyLayer_active_re
nder_get", | |
2138 "rna_MeshTexturePolyLayer_active_render_s
et"); | |
2139 RNA_def_property_ui_text(prop, "Active Render", "Set the map as active f
or rendering"); | |
2140 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2141 | |
2142 prop = RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE); | |
2143 RNA_def_property_boolean_sdna(prop, NULL, "active_clone", 0); | |
2144 RNA_def_property_boolean_funcs(prop, "rna_MeshTexturePolyLayer_clone_get
", "rna_MeshTexturePolyLayer_clone_set"); | |
2145 RNA_def_property_ui_text(prop, "Active Clone", "Set the map as active fo
r cloning"); | |
2146 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2147 | |
2148 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); | |
2149 RNA_def_property_struct_type(prop, "MeshTexturePoly"); | |
2150 RNA_def_property_ui_text(prop, "Data", ""); | |
2151 RNA_def_property_collection_funcs(prop, "rna_MeshTexturePolyLayer_data_b
egin", "rna_iterator_array_next", | |
2152 "rna_iterator_array_end", "rna_iterato
r_array_get", | |
2153 "rna_MeshTexturePolyLayer_data_length"
, NULL, NULL, NULL); | |
2154 | |
2155 srna = RNA_def_struct(brna, "MeshTexturePoly", NULL); | |
2156 RNA_def_struct_sdna(srna, "MTexPoly"); | |
2157 RNA_def_struct_ui_text(srna, "Mesh UV Map Face", "UV map and image textu
re for a face"); | |
2158 RNA_def_struct_path_func(srna, "rna_MeshTexturePoly_path"); | |
2159 RNA_def_struct_ui_icon(srna, ICON_FACESEL_HLT); | |
2160 | |
2161 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); | |
2162 RNA_def_property_pointer_sdna(prop, NULL, "tpage"); | |
2163 RNA_def_property_pointer_funcs(prop, NULL, "rna_TexturePoly_image_set",
NULL, NULL); | |
2164 RNA_def_property_flag(prop, PROP_EDITABLE); | |
2165 RNA_def_property_ui_text(prop, "Image", ""); | |
2166 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2167 | |
2168 #if 0 /* moved to MeshUVLoopLayer */ | |
2169 prop = RNA_def_property(srna, "select_uv", PROP_BOOLEAN, PROP_NONE); | |
2170 RNA_def_property_boolean_sdna(prop, NULL, "flag", TF_SEL1); | |
2171 RNA_def_property_array(prop, 4); | |
2172 RNA_def_property_ui_text(prop, "UV Selected", ""); | |
2173 RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); | |
2174 | |
2175 prop = RNA_def_property(srna, "pin_uv", PROP_BOOLEAN, PROP_NONE); | |
2176 RNA_def_property_boolean_sdna(prop, NULL, "unwrap", TF_PIN1); | |
2177 RNA_def_property_array(prop, 4); | |
2178 RNA_def_property_ui_text(prop, "UV Pinned", ""); | |
2179 RNA_def_property_update(prop, 0, "rna_Mesh_update_select"); | |
2180 | |
2181 prop = RNA_def_property(srna, "uv_raw", PROP_FLOAT, PROP_NONE); | |
2182 RNA_def_property_multi_array(prop, 2, uv_dim); | |
2183 RNA_def_property_float_sdna(prop, NULL, "uv"); | |
2184 RNA_def_property_ui_text(prop, "UV", "Fixed size UV coordinates array"); | |
2185 #endif | |
2186 } | |
2187 | |
2188 static void rna_def_mcol(BlenderRNA *brna) | |
2189 { | |
2190 StructRNA *srna; | |
2191 PropertyRNA *prop; | |
2192 | |
2193 srna = RNA_def_struct(brna, "MeshColorLayer", NULL); | |
2194 RNA_def_struct_ui_text(srna, "Mesh Vertex Color Layer", "Layer of vertex
colors in a Mesh datablock"); | |
2195 RNA_def_struct_sdna(srna, "CustomDataLayer"); | |
2196 RNA_def_struct_path_func(srna, "rna_MeshColorLayer_path"); | |
2197 RNA_def_struct_ui_icon(srna, ICON_GROUP_VCOL); | |
2198 | |
2199 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | |
2200 RNA_def_struct_name_property(srna, prop); | |
2201 RNA_def_property_string_funcs(prop, NULL, NULL, NULL); | |
2202 RNA_def_property_ui_text(prop, "Name", "Name of Vertex color layer"); | |
2203 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2204 | |
2205 prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); | |
2206 RNA_def_property_boolean_funcs(prop, "rna_MeshColorLayer_active_get", "r
na_MeshColorLayer_active_set"); | |
2207 RNA_def_property_ui_text(prop, "Active", "Sets the layer as active for d
isplay and editing"); | |
2208 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2209 | |
2210 prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE); | |
2211 RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0); | |
2212 RNA_def_property_boolean_funcs(prop, "rna_MeshColorLayer_active_render_g
et", | |
2213 "rna_MeshColorLayer_active_render_set"); | |
2214 RNA_def_property_ui_text(prop, "Active Render", "Sets the layer as activ
e for rendering"); | |
2215 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2216 | |
2217 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); | |
2218 RNA_def_property_struct_type(prop, "MeshColor"); | |
2219 RNA_def_property_ui_text(prop, "Data", ""); | |
2220 RNA_def_property_collection_funcs(prop, "rna_MeshColorLayer_data_begin",
"rna_iterator_array_next", | |
2221 "rna_iterator_array_end", "rna_iterato
r_array_get", | |
2222 "rna_MeshColorLayer_data_length", NULL
, NULL, NULL); | |
2223 | |
2224 srna = RNA_def_struct(brna, "MeshColor", NULL); | |
2225 RNA_def_struct_sdna(srna, "MCol"); | |
2226 RNA_def_struct_ui_text(srna, "Mesh Vertex Color", "Vertex colors for a f
ace in a Mesh"); | |
2227 RNA_def_struct_path_func(srna, "rna_MeshColor_path"); | |
2228 | |
2229 prop = RNA_def_property(srna, "color1", PROP_FLOAT, PROP_COLOR); | |
2230 RNA_def_property_array(prop, 3); | |
2231 RNA_def_property_range(prop, 0.0f, 1.0f); | |
2232 RNA_def_property_float_funcs(prop, "rna_MeshColor_color1_get", "rna_Mesh
Color_color1_set", NULL); | |
2233 RNA_def_property_ui_text(prop, "Color 1", ""); | |
2234 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2235 | |
2236 prop = RNA_def_property(srna, "color2", PROP_FLOAT, PROP_COLOR); | |
2237 RNA_def_property_array(prop, 3); | |
2238 RNA_def_property_range(prop, 0.0f, 1.0f); | |
2239 RNA_def_property_float_funcs(prop, "rna_MeshColor_color2_get", "rna_Mesh
Color_color2_set", NULL); | |
2240 RNA_def_property_ui_text(prop, "Color 2", ""); | |
2241 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2242 | |
2243 prop = RNA_def_property(srna, "color3", PROP_FLOAT, PROP_COLOR); | |
2244 RNA_def_property_array(prop, 3); | |
2245 RNA_def_property_range(prop, 0.0f, 1.0f); | |
2246 RNA_def_property_float_funcs(prop, "rna_MeshColor_color3_get", "rna_Mesh
Color_color3_set", NULL); | |
2247 RNA_def_property_ui_text(prop, "Color 3", ""); | |
2248 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2249 | |
2250 prop = RNA_def_property(srna, "color4", PROP_FLOAT, PROP_COLOR); | |
2251 RNA_def_property_array(prop, 3); | |
2252 RNA_def_property_range(prop, 0.0f, 1.0f); | |
2253 RNA_def_property_float_funcs(prop, "rna_MeshColor_color4_get", "rna_Mesh
Color_color4_set", NULL); | |
2254 RNA_def_property_ui_text(prop, "Color 4", ""); | |
2255 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2256 } | |
2257 | |
2258 static void rna_def_mloopcol(BlenderRNA *brna) | |
2259 { | |
2260 StructRNA *srna; | |
2261 PropertyRNA *prop; | |
2262 | |
2263 srna = RNA_def_struct(brna, "MeshLoopColorLayer", NULL); | |
2264 RNA_def_struct_ui_text(srna, "Mesh Vertex Color Layer", "Layer of vertex
colors in a Mesh datablock"); | |
2265 RNA_def_struct_sdna(srna, "CustomDataLayer"); | |
2266 RNA_def_struct_path_func(srna, "rna_MeshLoopColorLayer_path"); | |
2267 RNA_def_struct_ui_icon(srna, ICON_GROUP_VCOL); | |
2268 | |
2269 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | |
2270 RNA_def_struct_name_property(srna, prop); | |
2271 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshLoopLayer_name_
set"); | |
2272 RNA_def_property_ui_text(prop, "Name", "Name of Vertex color layer"); | |
2273 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2274 | |
2275 prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); | |
2276 RNA_def_property_boolean_funcs(prop, "rna_MeshLoopColorLayer_active_get"
, "rna_MeshLoopColorLayer_active_set"); | |
2277 RNA_def_property_ui_text(prop, "Active", "Sets the layer as active for d
isplay and editing"); | |
2278 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2279 | |
2280 prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE); | |
2281 RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0); | |
2282 RNA_def_property_boolean_funcs(prop, "rna_MeshLoopColorLayer_active_rend
er_get", | |
2283 "rna_MeshLoopColorLayer_active_render_set
"); | |
2284 RNA_def_property_ui_text(prop, "Active Render", "Sets the layer as activ
e for rendering"); | |
2285 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2286 | |
2287 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); | |
2288 RNA_def_property_struct_type(prop, "MeshLoopColor"); | |
2289 RNA_def_property_ui_text(prop, "Data", ""); | |
2290 RNA_def_property_collection_funcs(prop, "rna_MeshLoopColorLayer_data_beg
in", "rna_iterator_array_next", | |
2291 "rna_iterator_array_end", "rna_iterato
r_array_get", | |
2292 "rna_MeshLoopColorLayer_data_length",
NULL, NULL, NULL); | |
2293 | |
2294 | |
2295 srna = RNA_def_struct(brna, "MeshLoopColor", NULL); | |
2296 RNA_def_struct_sdna(srna, "MLoopCol"); | |
2297 RNA_def_struct_ui_text(srna, "Mesh Vertex Color", "Vertex loop colors in
a Mesh"); | |
2298 RNA_def_struct_path_func(srna, "rna_MeshColor_path"); | |
2299 | |
2300 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); | |
2301 RNA_def_property_array(prop, 3); | |
2302 RNA_def_property_range(prop, 0.0f, 1.0f); | |
2303 RNA_def_property_float_funcs(prop, "rna_MeshLoopColor_color_get", "rna_M
eshLoopColor_color_set", NULL); | |
2304 RNA_def_property_ui_text(prop, "Color", ""); | |
2305 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2306 } | |
2307 | |
2308 static void rna_def_mproperties(BlenderRNA *brna) | |
2309 { | |
2310 StructRNA *srna; | |
2311 PropertyRNA *prop; | |
2312 | |
2313 /* Float */ | |
2314 srna = RNA_def_struct(brna, "MeshFloatPropertyLayer", NULL); | |
2315 RNA_def_struct_sdna(srna, "CustomDataLayer"); | |
2316 RNA_def_struct_ui_text(srna, "Mesh Float Property Layer", "User defined
layer of floating point number values"); | |
2317 RNA_def_struct_path_func(srna, "rna_MeshFloatPropertyLayer_path"); | |
2318 | |
2319 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | |
2320 RNA_def_struct_name_property(srna, prop); | |
2321 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_s
et"); | |
2322 RNA_def_property_ui_text(prop, "Name", ""); | |
2323 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2324 | |
2325 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); | |
2326 RNA_def_property_struct_type(prop, "MeshFloatProperty"); | |
2327 RNA_def_property_ui_text(prop, "Data", ""); | |
2328 RNA_def_property_collection_funcs(prop, "rna_MeshFloatPropertyLayer_data
_begin", "rna_iterator_array_next", | |
2329 "rna_iterator_array_end", "rna_iterato
r_array_get", | |
2330 "rna_MeshFloatPropertyLayer_data_lengt
h", NULL, NULL, NULL); | |
2331 | |
2332 srna = RNA_def_struct(brna, "MeshFloatProperty", NULL); | |
2333 RNA_def_struct_sdna(srna, "MFloatProperty"); | |
2334 RNA_def_struct_ui_text(srna, "Mesh Float Property", | |
2335 "User defined floating point number value in a fl
oat properties layer"); | |
2336 RNA_def_struct_path_func(srna, "rna_MeshFloatProperty_path"); | |
2337 | |
2338 prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); | |
2339 RNA_def_property_float_sdna(prop, NULL, "f"); | |
2340 RNA_def_property_ui_text(prop, "Value", ""); | |
2341 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2342 | |
2343 /* Int */ | |
2344 srna = RNA_def_struct(brna, "MeshIntPropertyLayer", NULL); | |
2345 RNA_def_struct_sdna(srna, "CustomDataLayer"); | |
2346 RNA_def_struct_ui_text(srna, "Mesh Int Property Layer", "User defined la
yer of integer number values"); | |
2347 RNA_def_struct_path_func(srna, "rna_MeshIntPropertyLayer_path"); | |
2348 | |
2349 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | |
2350 RNA_def_struct_name_property(srna, prop); | |
2351 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_s
et"); | |
2352 RNA_def_property_ui_text(prop, "Name", ""); | |
2353 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2354 | |
2355 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); | |
2356 RNA_def_property_struct_type(prop, "MeshIntProperty"); | |
2357 RNA_def_property_ui_text(prop, "Data", ""); | |
2358 RNA_def_property_collection_funcs(prop, "rna_MeshIntPropertyLayer_data_b
egin", "rna_iterator_array_next", | |
2359 "rna_iterator_array_end", "rna_iterato
r_array_get", | |
2360 "rna_MeshIntPropertyLayer_data_length"
, NULL, NULL, NULL); | |
2361 | |
2362 srna = RNA_def_struct(brna, "MeshIntProperty", NULL); | |
2363 RNA_def_struct_sdna(srna, "MIntProperty"); | |
2364 RNA_def_struct_ui_text(srna, "Mesh Int Property", | |
2365 "User defined integer number value in an integer
properties layer"); | |
2366 RNA_def_struct_path_func(srna, "rna_MeshIntProperty_path"); | |
2367 | |
2368 prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE); | |
2369 RNA_def_property_int_sdna(prop, NULL, "i"); | |
2370 RNA_def_property_ui_text(prop, "Value", ""); | |
2371 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2372 | |
2373 /* String */ | |
2374 srna = RNA_def_struct(brna, "MeshStringPropertyLayer", NULL); | |
2375 RNA_def_struct_sdna(srna, "CustomDataLayer"); | |
2376 RNA_def_struct_ui_text(srna, "Mesh String Property Layer", "User defined
layer of string text values"); | |
2377 RNA_def_struct_path_func(srna, "rna_MeshStringPropertyLayer_path"); | |
2378 | |
2379 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | |
2380 RNA_def_struct_name_property(srna, prop); | |
2381 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_s
et"); | |
2382 RNA_def_property_ui_text(prop, "Name", ""); | |
2383 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2384 | |
2385 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); | |
2386 RNA_def_property_struct_type(prop, "MeshStringProperty"); | |
2387 RNA_def_property_ui_text(prop, "Data", ""); | |
2388 RNA_def_property_collection_funcs(prop, "rna_MeshStringPropertyLayer_dat
a_begin", "rna_iterator_array_next", | |
2389 "rna_iterator_array_end", "rna_iterato
r_array_get", | |
2390 "rna_MeshStringPropertyLayer_data_leng
th", NULL, NULL, NULL); | |
2391 | |
2392 srna = RNA_def_struct(brna, "MeshStringProperty", NULL); | |
2393 RNA_def_struct_sdna(srna, "MStringProperty"); | |
2394 RNA_def_struct_ui_text(srna, "Mesh String Property", | |
2395 "User defined string text value in a string prope
rties layer"); | |
2396 RNA_def_struct_path_func(srna, "rna_MeshStringProperty_path"); | |
2397 | |
2398 /* low level mesh data access, treat as bytes */ | |
2399 prop = RNA_def_property(srna, "value", PROP_STRING, PROP_BYTESTRING); | |
2400 RNA_def_property_string_sdna(prop, NULL, "s"); | |
2401 RNA_def_property_string_funcs(prop, "rna_MeshStringProperty_s_get", "rna
_MeshStringProperty_s_length", "rna_MeshStringProperty_s_set"); | |
2402 RNA_def_property_ui_text(prop, "Value", ""); | |
2403 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2404 } | |
2405 | |
2406 void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable) | |
2407 { | |
2408 PropertyRNA *prop; | |
2409 | |
2410 /* texture space */ | |
2411 prop = RNA_def_property(srna, "auto_texspace", PROP_BOOLEAN, PROP_NONE); | |
2412 RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE); | |
2413 RNA_def_property_ui_text(prop, "Auto Texture Space", | |
2414 "Adjust active object's texture space automatic
ally when transforming object"); | |
2415 | |
2416 prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRAN
SLATION); | |
2417 RNA_def_property_float_sdna(prop, NULL, "loc"); | |
2418 RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space
location"); | |
2419 RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", NULL, NU
LL); | |
2420 RNA_def_property_editable_func(prop, texspace_editable); | |
2421 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2422 | |
2423 prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ); | |
2424 RNA_def_property_float_sdna(prop, NULL, "size"); | |
2425 RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size
"); | |
2426 RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_size_get", NULL, N
ULL); | |
2427 RNA_def_property_editable_func(prop, texspace_editable); | |
2428 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2429 | |
2430 /* not supported yet */ | |
2431 #if 0 | |
2432 prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER); | |
2433 RNA_def_property_float(prop, NULL, "rot"); | |
2434 RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space
rotation"); | |
2435 RNA_def_property_editable_func(prop, texspace_editable); | |
2436 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2437 #endif | |
2438 | |
2439 /* materials */ | |
2440 prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE); | |
2441 RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol"); | |
2442 RNA_def_property_struct_type(prop, "Material"); | |
2443 RNA_def_property_ui_text(prop, "Materials", ""); | |
2444 RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */ | |
2445 RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NU
LL, NULL, "rna_IDMaterials_assign_int"); | |
2446 } | |
2447 | |
2448 | |
2449 /* scene.objects */ | |
2450 /* mesh.vertices */ | |
2451 static void rna_def_mesh_vertices(BlenderRNA *brna, PropertyRNA *cprop) | |
2452 { | |
2453 StructRNA *srna; | |
2454 /* PropertyRNA *prop; */ | |
2455 | |
2456 FunctionRNA *func; | |
2457 /* PropertyRNA *parm; */ | |
2458 | |
2459 RNA_def_property_srna(cprop, "MeshVertices"); | |
2460 srna = RNA_def_struct(brna, "MeshVertices", NULL); | |
2461 RNA_def_struct_sdna(srna, "Mesh"); | |
2462 RNA_def_struct_ui_text(srna, "Mesh Vertices", "Collection of mesh vertic
es"); | |
2463 | |
2464 func = RNA_def_function(srna, "add", "ED_mesh_vertices_add"); | |
2465 RNA_def_function_flag(func, FUNC_USE_REPORTS); | |
2466 RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices t
o add", 0, INT_MAX); | |
2467 #if 0 /* BMESH_TODO Remove until BMesh merge */ | |
2468 func = RNA_def_function(srna, "remove", "ED_mesh_vertices_remove"); | |
2469 RNA_def_function_flag(func, FUNC_USE_REPORTS); | |
2470 RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices t
o remove", 0, INT_MAX); | |
2471 #endif | |
2472 } | |
2473 | |
2474 /* mesh.edges */ | |
2475 static void rna_def_mesh_edges(BlenderRNA *brna, PropertyRNA *cprop) | |
2476 { | |
2477 StructRNA *srna; | |
2478 /* PropertyRNA *prop; */ | |
2479 | |
2480 FunctionRNA *func; | |
2481 /* PropertyRNA *parm; */ | |
2482 | |
2483 RNA_def_property_srna(cprop, "MeshEdges"); | |
2484 srna = RNA_def_struct(brna, "MeshEdges", NULL); | |
2485 RNA_def_struct_sdna(srna, "Mesh"); | |
2486 RNA_def_struct_ui_text(srna, "Mesh Edges", "Collection of mesh edges"); | |
2487 | |
2488 func = RNA_def_function(srna, "add", "ED_mesh_edges_add"); | |
2489 RNA_def_function_flag(func, FUNC_USE_REPORTS); | |
2490 RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to a
dd", 0, INT_MAX); | |
2491 #if 0 /* BMESH_TODO Remove until BMesh merge */ | |
2492 func = RNA_def_function(srna, "remove", "ED_mesh_edges_remove"); | |
2493 RNA_def_function_flag(func, FUNC_USE_REPORTS); | |
2494 RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to r
emove", 0, INT_MAX); | |
2495 #endif | |
2496 } | |
2497 | |
2498 /* mesh.faces */ | |
2499 static void rna_def_mesh_tessfaces(BlenderRNA *brna, PropertyRNA *cprop) | |
2500 { | |
2501 StructRNA *srna; | |
2502 PropertyRNA *prop; | |
2503 | |
2504 FunctionRNA *func; | |
2505 /* PropertyRNA *parm; */ | |
2506 | |
2507 RNA_def_property_srna(cprop, "MeshTessFaces"); | |
2508 srna = RNA_def_struct(brna, "MeshTessFaces", NULL); | |
2509 RNA_def_struct_sdna(srna, "Mesh"); | |
2510 RNA_def_struct_ui_text(srna, "Mesh Faces", "Collection of mesh faces"); | |
2511 | |
2512 prop = RNA_def_property(srna, "active", PROP_INT, PROP_NONE); | |
2513 RNA_def_property_int_sdna(prop, NULL, "act_face"); | |
2514 RNA_def_property_ui_text(prop, "Active Face", "The active face for this
mesh"); | |
2515 | |
2516 func = RNA_def_function(srna, "add", "ED_mesh_tessfaces_add"); | |
2517 RNA_def_function_flag(func, FUNC_USE_REPORTS); | |
2518 RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of faces to a
dd", 0, INT_MAX); | |
2519 #if 0 /* BMESH_TODO Remove until BMesh merge */ | |
2520 func = RNA_def_function(srna, "remove", "ED_mesh_faces_remove"); | |
2521 RNA_def_function_flag(func, FUNC_USE_REPORTS); | |
2522 RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of faces to r
emove", 0, INT_MAX); | |
2523 #endif | |
2524 } | |
2525 | |
2526 /* mesh.loops */ | |
2527 static void rna_def_mesh_loops(BlenderRNA *brna, PropertyRNA *cprop) | |
2528 { | |
2529 StructRNA *srna; | |
2530 | |
2531 /*PropertyRNA *prop;*/ | |
2532 | |
2533 FunctionRNA *func; | |
2534 /*PropertyRNA *parm;*/ | |
2535 | |
2536 RNA_def_property_srna(cprop, "MeshLoops"); | |
2537 srna = RNA_def_struct(brna, "MeshLoops", NULL); | |
2538 RNA_def_struct_sdna(srna, "Mesh"); | |
2539 RNA_def_struct_ui_text(srna, "Mesh Loops", "Collection of mesh loops"); | |
2540 | |
2541 func = RNA_def_function(srna, "add", "ED_mesh_loops_add"); | |
2542 RNA_def_function_flag(func, FUNC_USE_REPORTS); | |
2543 RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of loops to a
dd", 0, INT_MAX); | |
2544 } | |
2545 | |
2546 /* mesh.polygons */ | |
2547 static void rna_def_mesh_polygons(BlenderRNA *brna, PropertyRNA *cprop) | |
2548 { | |
2549 StructRNA *srna; | |
2550 | |
2551 PropertyRNA *prop; | |
2552 | |
2553 FunctionRNA *func; | |
2554 /* PropertyRNA *parm; */ | |
2555 | |
2556 RNA_def_property_srna(cprop, "MeshPolygons"); | |
2557 srna = RNA_def_struct(brna, "MeshPolygons", NULL); | |
2558 RNA_def_struct_sdna(srna, "Mesh"); | |
2559 RNA_def_struct_ui_text(srna, "Mesh Polygons", "Collection of mesh polygo
ns"); | |
2560 | |
2561 prop = RNA_def_property(srna, "active", PROP_INT, PROP_NONE); | |
2562 RNA_def_property_int_sdna(prop, NULL, "act_face"); | |
2563 RNA_def_property_ui_text(prop, "Active Polygon", "The active polygon for
this mesh"); | |
2564 | |
2565 func = RNA_def_function(srna, "add", "ED_mesh_polys_add"); | |
2566 RNA_def_function_flag(func, FUNC_USE_REPORTS); | |
2567 RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of polygons t
o add", 0, INT_MAX); | |
2568 } | |
2569 | |
2570 | |
2571 /* mesh.vertex_colors */ | |
2572 static void rna_def_tessface_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop) | |
2573 { | |
2574 StructRNA *srna; | |
2575 PropertyRNA *prop; | |
2576 | |
2577 FunctionRNA *func; | |
2578 PropertyRNA *parm; | |
2579 | |
2580 RNA_def_property_srna(cprop, "VertexColors"); | |
2581 srna = RNA_def_struct(brna, "VertexColors", NULL); | |
2582 RNA_def_struct_sdna(srna, "Mesh"); | |
2583 RNA_def_struct_ui_text(srna, "Vertex Colors", "Collection of vertex colo
rs"); | |
2584 | |
2585 /* eventually deprecate this */ | |
2586 func = RNA_def_function(srna, "new", "rna_Mesh_tessface_vertex_color_new
"); | |
2587 RNA_def_function_flag(func, FUNC_USE_REPORTS); | |
2588 RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh"
); | |
2589 RNA_def_string(func, "name", "Col", 0, "", "Vertex color name"); | |
2590 parm = RNA_def_pointer(func, "layer", "MeshColorLayer", "", "The newly c
reated layer"); | |
2591 RNA_def_property_flag(parm, PROP_RNAPTR); | |
2592 RNA_def_function_return(func, parm); | |
2593 | |
2594 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); | |
2595 RNA_def_property_struct_type(prop, "MeshColorLayer"); | |
2596 RNA_def_property_pointer_funcs(prop, "rna_Mesh_tessface_vertex_color_act
ive_get", | |
2597 "rna_Mesh_tessface_vertex_color_active_se
t", NULL, NULL); | |
2598 RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vert
ex color layer"); | |
2599 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2600 | |
2601 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); | |
2602 RNA_def_property_int_funcs(prop, "rna_Mesh_tessface_vertex_color_active_
index_get", | |
2603 "rna_Mesh_tessface_vertex_color_active_index_
set", "rna_Mesh_vertex_color_index_range"); | |
2604 RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vert
ex color index"); | |
2605 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2606 } | |
2607 | |
2608 static void rna_def_loop_colors(BlenderRNA *brna, PropertyRNA *cprop) | |
2609 { | |
2610 StructRNA *srna; | |
2611 PropertyRNA *prop; | |
2612 | |
2613 FunctionRNA *func; | |
2614 PropertyRNA *parm; | |
2615 | |
2616 RNA_def_property_srna(cprop, "LoopColors"); | |
2617 srna = RNA_def_struct(brna, "LoopColors", NULL); | |
2618 RNA_def_struct_sdna(srna, "Mesh"); | |
2619 RNA_def_struct_ui_text(srna, "Loop Colors", "Collection of vertex colors
"); | |
2620 | |
2621 func = RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new"); | |
2622 RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh"
); | |
2623 RNA_def_string(func, "name", "Col", 0, "", "Vertex color name"); | |
2624 parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The new
ly created layer"); | |
2625 RNA_def_property_flag(parm, PROP_RNAPTR); | |
2626 RNA_def_function_return(func, parm); | |
2627 | |
2628 func = RNA_def_function(srna, "remove", "rna_Mesh_vertex_color_remove"); | |
2629 RNA_def_function_ui_description(func, "Remove a vertex color layer"); | |
2630 RNA_def_function_flag(func, FUNC_USE_REPORTS); | |
2631 parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The lay
er to remove"); | |
2632 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | |
2633 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); | |
2634 | |
2635 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); | |
2636 RNA_def_property_struct_type(prop, "MeshLoopColorLayer"); | |
2637 RNA_def_property_pointer_funcs(prop, "rna_Mesh_vertex_color_active_get", | |
2638 "rna_Mesh_vertex_color_active_set", NULL,
NULL); | |
2639 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK); | |
2640 RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vert
ex color layer"); | |
2641 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2642 | |
2643 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); | |
2644 RNA_def_property_int_funcs(prop, "rna_Mesh_vertex_color_active_index_get
", | |
2645 "rna_Mesh_vertex_color_active_index_set", "rn
a_Mesh_vertex_color_index_range"); | |
2646 RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vert
ex color index"); | |
2647 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2648 } | |
2649 | |
2650 static void rna_def_uv_layers(BlenderRNA *brna, PropertyRNA *cprop) | |
2651 { | |
2652 StructRNA *srna; | |
2653 PropertyRNA *prop; | |
2654 | |
2655 /* FunctionRNA *func; */ | |
2656 /* PropertyRNA *parm; */ | |
2657 | |
2658 RNA_def_property_srna(cprop, "UVLoopLayers"); | |
2659 srna = RNA_def_struct(brna, "UVLoopLayers", NULL); | |
2660 RNA_def_struct_sdna(srna, "Mesh"); | |
2661 RNA_def_struct_ui_text(srna, "UV Loop Layers", "Collection of uv loop la
yers"); | |
2662 | |
2663 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); | |
2664 RNA_def_property_struct_type(prop, "MeshUVLoopLayer"); | |
2665 RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_active_get", | |
2666 "rna_Mesh_uv_layer_active_set", NULL, NUL
L); | |
2667 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK); | |
2668 RNA_def_property_ui_text(prop, "Active UV loop layer", "Active UV loop l
ayer"); | |
2669 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2670 | |
2671 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); | |
2672 RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_active_index_get", | |
2673 "rna_Mesh_uv_layer_active_index_set", "rna_Me
sh_uv_layer_index_range"); | |
2674 RNA_def_property_ui_text(prop, "Active UV loop layer Index", "Active UV
loop layer index"); | |
2675 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2676 } | |
2677 | |
2678 /* mesh int layers */ | |
2679 static void rna_def_polygon_int_layers(BlenderRNA *brna, PropertyRNA *cprop) | |
2680 { | |
2681 StructRNA *srna; | |
2682 | |
2683 FunctionRNA *func; | |
2684 PropertyRNA *parm; | |
2685 | |
2686 RNA_def_property_srna(cprop, "IntProperties"); | |
2687 srna = RNA_def_struct(brna, "IntProperties", NULL); | |
2688 RNA_def_struct_sdna(srna, "Mesh"); | |
2689 RNA_def_struct_ui_text(srna, "Int Properties", "Collection of int proper
ties"); | |
2690 | |
2691 func = RNA_def_function(srna, "new", "rna_Mesh_polygon_int_property_new"
); | |
2692 RNA_def_function_ui_description(func, "Add a integer property layer to M
esh"); | |
2693 RNA_def_string(func, "name", "Int Prop", 0, "", "Int property name"); | |
2694 parm = RNA_def_pointer(func, "layer", "MeshIntPropertyLayer", "", "The n
ewly created layer"); | |
2695 RNA_def_property_flag(parm, PROP_RNAPTR); | |
2696 RNA_def_function_return(func, parm); | |
2697 } | |
2698 | |
2699 /* mesh float layers */ | |
2700 static void rna_def_polygon_float_layers(BlenderRNA *brna, PropertyRNA *cprop) | |
2701 { | |
2702 StructRNA *srna; | |
2703 | |
2704 FunctionRNA *func; | |
2705 PropertyRNA *parm; | |
2706 | |
2707 RNA_def_property_srna(cprop, "FloatProperties"); | |
2708 srna = RNA_def_struct(brna, "FloatProperties", NULL); | |
2709 RNA_def_struct_sdna(srna, "Mesh"); | |
2710 RNA_def_struct_ui_text(srna, "Float Properties", "Collection of float pr
operties"); | |
2711 | |
2712 func = RNA_def_function(srna, "new", "rna_Mesh_polygon_float_property_ne
w"); | |
2713 RNA_def_function_ui_description(func, "Add a float property layer to Mes
h"); | |
2714 RNA_def_string(func, "name", "Float Prop", 0, "", "Float property name")
; | |
2715 parm = RNA_def_pointer(func, "layer", "MeshFloatPropertyLayer", "", "The
newly created layer"); | |
2716 RNA_def_property_flag(parm, PROP_RNAPTR); | |
2717 RNA_def_function_return(func, parm); | |
2718 } | |
2719 | |
2720 /* mesh string layers */ | |
2721 static void rna_def_polygon_string_layers(BlenderRNA *brna, PropertyRNA *cprop) | |
2722 { | |
2723 StructRNA *srna; | |
2724 | |
2725 FunctionRNA *func; | |
2726 PropertyRNA *parm; | |
2727 | |
2728 RNA_def_property_srna(cprop, "StringProperties"); | |
2729 srna = RNA_def_struct(brna, "StringProperties", NULL); | |
2730 RNA_def_struct_sdna(srna, "Mesh"); | |
2731 RNA_def_struct_ui_text(srna, "String Properties", "Collection of string
properties"); | |
2732 | |
2733 func = RNA_def_function(srna, "new", "rna_Mesh_polygon_string_property_n
ew"); | |
2734 RNA_def_function_ui_description(func, "Add a string property layer to Me
sh"); | |
2735 RNA_def_string(func, "name", "String Prop", 0, "", "String property name
"); | |
2736 parm = RNA_def_pointer(func, "layer", "MeshStringPropertyLayer", "", "Th
e newly created layer"); | |
2737 RNA_def_property_flag(parm, PROP_RNAPTR); | |
2738 RNA_def_function_return(func, parm); | |
2739 } | |
2740 | |
2741 /* mesh.tessface_uv_layers */ | |
2742 static void rna_def_tessface_uv_textures(BlenderRNA *brna, PropertyRNA *cprop) | |
2743 { | |
2744 StructRNA *srna; | |
2745 PropertyRNA *prop; | |
2746 | |
2747 FunctionRNA *func; | |
2748 PropertyRNA *parm; | |
2749 | |
2750 RNA_def_property_srna(cprop, "TessfaceUVTextures"); | |
2751 srna = RNA_def_struct(brna, "TessfaceUVTextures", NULL); | |
2752 RNA_def_struct_sdna(srna, "Mesh"); | |
2753 RNA_def_struct_ui_text(srna, "UV Maps", "Collection of UV maps for tesse
llated faces"); | |
2754 | |
2755 /* eventually deprecate this */ | |
2756 func = RNA_def_function(srna, "new", "rna_Mesh_tessface_uv_texture_new")
; | |
2757 RNA_def_function_flag(func, FUNC_USE_REPORTS); | |
2758 RNA_def_function_ui_description(func, "Add a UV tessface-texture layer t
o Mesh (only for meshes with no polygons)"); | |
2759 RNA_def_string(func, "name", "UVMap", 0, "", "UV map name"); | |
2760 parm = RNA_def_pointer(func, "layer", "MeshTextureFaceLayer", "", "The n
ewly created layer"); | |
2761 RNA_def_property_flag(parm, PROP_RNAPTR); | |
2762 RNA_def_function_return(func, parm); | |
2763 | |
2764 | |
2765 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); | |
2766 RNA_def_property_struct_type(prop, "MeshTextureFaceLayer"); | |
2767 RNA_def_property_pointer_funcs(prop, "rna_Mesh_tessface_uv_texture_activ
e_get", | |
2768 "rna_Mesh_tessface_uv_texture_active_set"
, NULL, NULL); | |
2769 RNA_def_property_ui_text(prop, "Active UV Map", "Active UV Map"); | |
2770 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2771 | |
2772 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); | |
2773 RNA_def_property_int_funcs(prop, "rna_Mesh_tessface_uv_texture_active_in
dex_get", | |
2774 "rna_Mesh_tessface_uv_texture_active_index_se
t", "rna_Mesh_uv_texture_index_range"); | |
2775 RNA_def_property_ui_text(prop, "Active UV Map Index", "Active UV Map ind
ex"); | |
2776 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2777 } | |
2778 | |
2779 | |
2780 static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop) | |
2781 { | |
2782 StructRNA *srna; | |
2783 PropertyRNA *prop; | |
2784 | |
2785 FunctionRNA *func; | |
2786 PropertyRNA *parm; | |
2787 | |
2788 RNA_def_property_srna(cprop, "UVTextures"); | |
2789 srna = RNA_def_struct(brna, "UVTextures", NULL); | |
2790 RNA_def_struct_sdna(srna, "Mesh"); | |
2791 RNA_def_struct_ui_text(srna, "UV Maps", "Collection of UV maps"); | |
2792 | |
2793 func = RNA_def_function(srna, "new", "rna_Mesh_uv_texture_new"); | |
2794 RNA_def_function_ui_description(func, "Add a UV map layer to Mesh"); | |
2795 RNA_def_string(func, "name", "UVMap", 0, "", "UV map name"); | |
2796 parm = RNA_def_pointer(func, "layer", "MeshTexturePolyLayer", "", "The n
ewly created layer"); | |
2797 RNA_def_property_flag(parm, PROP_RNAPTR); | |
2798 RNA_def_function_return(func, parm); | |
2799 | |
2800 func = RNA_def_function(srna, "remove", "rna_Mesh_uv_texture_layers_remo
ve"); | |
2801 RNA_def_function_ui_description(func, "Remove a vertex color layer"); | |
2802 RNA_def_function_flag(func, FUNC_USE_REPORTS); | |
2803 parm = RNA_def_pointer(func, "layer", "MeshTexturePolyLayer", "", "The l
ayer to remove"); | |
2804 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | |
2805 | |
2806 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); | |
2807 RNA_def_property_struct_type(prop, "MeshTexturePolyLayer"); | |
2808 RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_active_get", | |
2809 "rna_Mesh_uv_texture_active_set", NULL, N
ULL); | |
2810 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK); | |
2811 RNA_def_property_ui_text(prop, "Active UV Map", "Active UV Map"); | |
2812 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2813 | |
2814 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); | |
2815 RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_active_index_get", | |
2816 "rna_Mesh_uv_texture_active_index_set", "rna_
Mesh_uv_texture_index_range"); | |
2817 RNA_def_property_ui_text(prop, "Active UV Map Index", "Active UV Map ind
ex"); | |
2818 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2819 } | |
2820 | |
2821 static void rna_def_skin_vertices(BlenderRNA *brna, PropertyRNA *UNUSED(cprop)) | |
2822 { | |
2823 StructRNA *srna; | |
2824 PropertyRNA *prop; | |
2825 | |
2826 srna = RNA_def_struct(brna, "MeshSkinVertexLayer", NULL); | |
2827 RNA_def_struct_ui_text(srna, "Mesh Skin Vertex Layer", "Per-vertex skin
data for use with the Skin modifier"); | |
2828 RNA_def_struct_sdna(srna, "CustomDataLayer"); | |
2829 RNA_def_struct_path_func(srna, "rna_MeshSkinVertexLayer_path"); | |
2830 | |
2831 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | |
2832 RNA_def_struct_name_property(srna, prop); | |
2833 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshVertexLayer_nam
e_set"); | |
2834 RNA_def_property_ui_text(prop, "Name", "Name of skin layer"); | |
2835 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2836 | |
2837 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); | |
2838 RNA_def_property_struct_type(prop, "MeshSkinVertex"); | |
2839 RNA_def_property_ui_text(prop, "Data", ""); | |
2840 RNA_def_property_collection_funcs(prop, "rna_MeshSkinVertexLayer_data_be
gin", "rna_iterator_array_next", | |
2841 "rna_iterator_array_end", "rna_iterato
r_array_get", | |
2842 "rna_MeshSkinVertexLayer_data_length",
NULL, NULL, NULL); | |
2843 | |
2844 /* SkinVertex struct */ | |
2845 srna = RNA_def_struct(brna, "MeshSkinVertex", NULL); | |
2846 RNA_def_struct_sdna(srna, "MVertSkin"); | |
2847 RNA_def_struct_ui_text(srna, "Skin Vertex", "Per-vertex skin data for us
e with the Skin modifier"); | |
2848 RNA_def_struct_path_func(srna, "rna_MeshSkinVertex_path"); | |
2849 | |
2850 prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE); | |
2851 RNA_def_property_array(prop, 2); | |
2852 RNA_def_property_ui_range(prop, 0.001, 100, 1, 3); | |
2853 RNA_def_property_ui_text(prop, "Radius", "Radius of the skin"); | |
2854 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2855 | |
2856 /* Flags */ | |
2857 | |
2858 prop = RNA_def_property(srna, "use_root", PROP_BOOLEAN, PROP_NONE); | |
2859 RNA_def_property_boolean_sdna(prop, NULL, "flag", MVERT_SKIN_ROOT); | |
2860 RNA_def_property_ui_text(prop, "Root", "Vertex is a root for rotation ca
lculations and armature generation"); | |
2861 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2862 ········ | |
2863 prop = RNA_def_property(srna, "use_loose", PROP_BOOLEAN, PROP_NONE); | |
2864 RNA_def_property_boolean_sdna(prop, NULL, "flag", MVERT_SKIN_LOOSE); | |
2865 RNA_def_property_ui_text(prop, "Loose", "If vertex has multiple adjacent
edges, it is hulled to them directly"); | |
2866 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
2867 } | |
2868 | |
2869 static void rna_def_mesh(BlenderRNA *brna) | |
2870 { | |
2871 StructRNA *srna; | |
2872 PropertyRNA *prop; | |
2873 | |
2874 srna = RNA_def_struct(brna, "Mesh", "ID"); | |
2875 RNA_def_struct_ui_text(srna, "Mesh", "Mesh datablock defining geometric
surfaces"); | |
2876 RNA_def_struct_ui_icon(srna, ICON_MESH_DATA); | |
2877 | |
2878 prop = RNA_def_property(srna, "vertices", PROP_COLLECTION, PROP_NONE); | |
2879 RNA_def_property_collection_sdna(prop, NULL, "mvert", "totvert"); | |
2880 RNA_def_property_struct_type(prop, "MeshVertex"); | |
2881 RNA_def_property_ui_text(prop, "Vertices", "Vertices of the mesh"); | |
2882 rna_def_mesh_vertices(brna, prop); | |
2883 | |
2884 prop = RNA_def_property(srna, "edges", PROP_COLLECTION, PROP_NONE); | |
2885 RNA_def_property_collection_sdna(prop, NULL, "medge", "totedge"); | |
2886 RNA_def_property_struct_type(prop, "MeshEdge"); | |
2887 RNA_def_property_ui_text(prop, "Edges", "Edges of the mesh"); | |
2888 rna_def_mesh_edges(brna, prop); | |
2889 | |
2890 prop = RNA_def_property(srna, "tessfaces", PROP_COLLECTION, PROP_NONE); | |
2891 RNA_def_property_collection_sdna(prop, NULL, "mface", "totface"); | |
2892 RNA_def_property_struct_type(prop, "MeshTessFace"); | |
2893 RNA_def_property_ui_text(prop, "TessFaces", "Tessellated faces of the me
sh (derived from polygons)"); | |
2894 rna_def_mesh_tessfaces(brna, prop); | |
2895 | |
2896 prop = RNA_def_property(srna, "loops", PROP_COLLECTION, PROP_NONE); | |
2897 RNA_def_property_collection_sdna(prop, NULL, "mloop", "totloop"); | |
2898 RNA_def_property_struct_type(prop, "MeshLoop"); | |
2899 RNA_def_property_ui_text(prop, "Loops", "Loops of the mesh (polygon corn
ers)"); | |
2900 rna_def_mesh_loops(brna, prop); | |
2901 | |
2902 prop = RNA_def_property(srna, "polygons", PROP_COLLECTION, PROP_NONE); | |
2903 RNA_def_property_collection_sdna(prop, NULL, "mpoly", "totpoly"); | |
2904 RNA_def_property_struct_type(prop, "MeshPolygon"); | |
2905 RNA_def_property_ui_text(prop, "Polygons", "Polygons of the mesh"); | |
2906 rna_def_mesh_polygons(brna, prop); | |
2907 | |
2908 /* TODO, should this be allowed to be its self? */ | |
2909 prop = RNA_def_property(srna, "texture_mesh", PROP_POINTER, PROP_NONE); | |
2910 RNA_def_property_pointer_sdna(prop, NULL, "texcomesh"); | |
2911 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); | |
2912 RNA_def_property_ui_text(prop, "Texture Mesh", | |
2913 "Use another mesh for texture indices (vertex i
ndices must be aligned)"); | |
2914 | |
2915 /* UV loop layers */ | |
2916 prop = RNA_def_property(srna, "uv_layers", PROP_COLLECTION, PROP_NONE); | |
2917 RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totl
ayer"); | |
2918 RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_layers_begin", NULL
, NULL, NULL, | |
2919 "rna_Mesh_uv_layers_length", NULL, NUL
L, NULL); | |
2920 RNA_def_property_struct_type(prop, "MeshUVLoopLayer"); | |
2921 RNA_def_property_ui_text(prop, "UV Loop Layers", "All UV loop layers"); | |
2922 rna_def_uv_layers(brna, prop); | |
2923 | |
2924 prop = RNA_def_property(srna, "uv_layer_clone", PROP_POINTER, PROP_NONE)
; | |
2925 RNA_def_property_struct_type(prop, "MeshUVLoopLayer"); | |
2926 RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_clone_get", | |
2927 "rna_Mesh_uv_layer_clone_set", NULL, NULL
); | |
2928 RNA_def_property_flag(prop, PROP_EDITABLE); | |
2929 RNA_def_property_ui_text(prop, "Clone UV loop layer", "UV loop layer to
be used as cloning source"); | |
2930 | |
2931 prop = RNA_def_property(srna, "uv_layer_clone_index", PROP_INT, PROP_UNS
IGNED); | |
2932 RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_clone_index_get", | |
2933 "rna_Mesh_uv_layer_clone_index_set", "rna_Mes
h_uv_layer_index_range"); | |
2934 RNA_def_property_ui_text(prop, "Clone UV loop layer Index", "Clone UV lo
op layer index"); | |
2935 | |
2936 prop = RNA_def_property(srna, "uv_layer_stencil", PROP_POINTER, PROP_NON
E); | |
2937 RNA_def_property_struct_type(prop, "MeshUVLoopLayer"); | |
2938 RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_stencil_get", | |
2939 "rna_Mesh_uv_layer_stencil_set", NULL, NU
LL); | |
2940 RNA_def_property_flag(prop, PROP_EDITABLE); | |
2941 RNA_def_property_ui_text(prop, "Mask UV loop layer", "UV loop layer to m
ask the painted area"); | |
2942 | |
2943 prop = RNA_def_property(srna, "uv_layer_stencil_index", PROP_INT, PROP_U
NSIGNED); | |
2944 RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_stencil_index_get", | |
2945 "rna_Mesh_uv_layer_stencil_index_set", "rna_M
esh_uv_layer_index_range"); | |
2946 RNA_def_property_ui_text(prop, "Mask UV loop layer Index", "Mask UV loop
layer index"); | |
2947 | |
2948 /* Tessellated face UV maps - used by renderers */ | |
2949 prop = RNA_def_property(srna, "tessface_uv_textures", PROP_COLLECTION, P
ROP_NONE); | |
2950 RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totl
ayer"); | |
2951 RNA_def_property_collection_funcs(prop, "rna_Mesh_tessface_uv_textures_b
egin", NULL, NULL, NULL, | |
2952 "rna_Mesh_tessface_uv_textures_length"
, NULL, NULL, NULL); | |
2953 RNA_def_property_struct_type(prop, "MeshTextureFaceLayer"); | |
2954 RNA_def_property_ui_text(prop, "Tessellated Face UV Maps", | |
2955 "All UV maps for tessellated faces (read-only,
for use by renderers)"); | |
2956 rna_def_tessface_uv_textures(brna, prop); | |
2957 | |
2958 /* UV maps */ | |
2959 prop = RNA_def_property(srna, "uv_textures", PROP_COLLECTION, PROP_NONE)
; | |
2960 RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totl
ayer"); | |
2961 RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", NU
LL, NULL, NULL, | |
2962 "rna_Mesh_uv_textures_length", NULL, N
ULL, NULL); | |
2963 RNA_def_property_struct_type(prop, "MeshTexturePolyLayer"); | |
2964 RNA_def_property_ui_text(prop, "UV Maps", "All UV maps"); | |
2965 rna_def_uv_textures(brna, prop); | |
2966 | |
2967 prop = RNA_def_property(srna, "uv_texture_clone", PROP_POINTER, PROP_NON
E); | |
2968 RNA_def_property_struct_type(prop, "MeshTexturePolyLayer"); | |
2969 RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_clone_get", | |
2970 "rna_Mesh_uv_texture_clone_set", NULL, NU
LL); | |
2971 RNA_def_property_flag(prop, PROP_EDITABLE); | |
2972 RNA_def_property_ui_text(prop, "Clone UV Map", "UV map to be used as clo
ning source"); | |
2973 | |
2974 prop = RNA_def_property(srna, "uv_texture_clone_index", PROP_INT, PROP_U
NSIGNED); | |
2975 RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_clone_index_get", | |
2976 "rna_Mesh_uv_texture_clone_index_set", "rna_M
esh_uv_texture_index_range"); | |
2977 RNA_def_property_ui_text(prop, "Clone UV Map Index", "Clone UV map index
"); | |
2978 | |
2979 prop = RNA_def_property(srna, "uv_texture_stencil", PROP_POINTER, PROP_N
ONE); | |
2980 RNA_def_property_struct_type(prop, "MeshTexturePolyLayer"); | |
2981 RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_stencil_get", | |
2982 "rna_Mesh_uv_texture_stencil_set", NULL,
NULL); | |
2983 RNA_def_property_flag(prop, PROP_EDITABLE); | |
2984 RNA_def_property_ui_text(prop, "Mask UV Map", "UV map to mask the painte
d area"); | |
2985 | |
2986 prop = RNA_def_property(srna, "uv_texture_stencil_index", PROP_INT, PROP
_UNSIGNED); | |
2987 RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_stencil_index_get"
, | |
2988 "rna_Mesh_uv_texture_stencil_index_set", "rna
_Mesh_uv_texture_index_range"); | |
2989 RNA_def_property_ui_text(prop, "Mask UV Map Index", "Mask UV map index")
; | |
2990 | |
2991 /* Tessellated face colors - used by renderers */ | |
2992 | |
2993 prop = RNA_def_property(srna, "tessface_vertex_colors", PROP_COLLECTION,
PROP_NONE); | |
2994 RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totl
ayer"); | |
2995 RNA_def_property_collection_funcs(prop, "rna_Mesh_tessface_vertex_colors
_begin", NULL, NULL, NULL, | |
2996 "rna_Mesh_tessface_vertex_colors_lengt
h", NULL, NULL, NULL); | |
2997 RNA_def_property_struct_type(prop, "MeshColorLayer"); | |
2998 RNA_def_property_ui_text(prop, "Tessellated Face Colors", | |
2999 "All tessellated face colors (read-only, for us
e by renderers)"); | |
3000 rna_def_tessface_vertex_colors(brna, prop); | |
3001 | |
3002 /* Vertex colors */ | |
3003 | |
3004 prop = RNA_def_property(srna, "vertex_colors", PROP_COLLECTION, PROP_NON
E); | |
3005 RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totl
ayer"); | |
3006 RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin",
NULL, NULL, NULL, | |
3007 "rna_Mesh_vertex_colors_length", NULL,
NULL, NULL); | |
3008 RNA_def_property_struct_type(prop, "MeshLoopColorLayer"); | |
3009 RNA_def_property_ui_text(prop, "Vertex Colors", "All vertex colors"); | |
3010 rna_def_loop_colors(brna, prop); | |
3011 | |
3012 /* TODO, vertex, edge customdata layers (bmesh py api can access already
) */ | |
3013 prop = RNA_def_property(srna, "polygon_layers_float", PROP_COLLECTION, P
ROP_NONE); | |
3014 RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totl
ayer"); | |
3015 RNA_def_property_collection_funcs(prop, "rna_Mesh_polygon_float_layers_b
egin", NULL, NULL, NULL, | |
3016 "rna_Mesh_polygon_float_layers_length"
, NULL, NULL, NULL); | |
3017 RNA_def_property_struct_type(prop, "MeshFloatPropertyLayer"); | |
3018 RNA_def_property_ui_text(prop, "Float Property Layers", ""); | |
3019 rna_def_polygon_float_layers(brna, prop); | |
3020 | |
3021 prop = RNA_def_property(srna, "polygon_layers_int", PROP_COLLECTION, PRO
P_NONE); | |
3022 RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totl
ayer"); | |
3023 RNA_def_property_collection_funcs(prop, "rna_Mesh_polygon_int_layers_beg
in", NULL, NULL, NULL, | |
3024 "rna_Mesh_polygon_int_layers_length",
NULL, NULL, NULL); | |
3025 RNA_def_property_struct_type(prop, "MeshIntPropertyLayer"); | |
3026 RNA_def_property_ui_text(prop, "Int Property Layers", ""); | |
3027 rna_def_polygon_int_layers(brna, prop); | |
3028 | |
3029 prop = RNA_def_property(srna, "polygon_layers_string", PROP_COLLECTION,
PROP_NONE); | |
3030 RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totl
ayer"); | |
3031 RNA_def_property_collection_funcs(prop, "rna_Mesh_polygon_string_layers_
begin", NULL, NULL, NULL, | |
3032 "rna_Mesh_polygon_string_layers_length
", NULL, NULL, NULL); | |
3033 RNA_def_property_struct_type(prop, "MeshStringPropertyLayer"); | |
3034 RNA_def_property_ui_text(prop, "String Property Layers", ""); | |
3035 rna_def_polygon_string_layers(brna, prop); | |
3036 | |
3037 /* Skin vertices */ | |
3038 prop = RNA_def_property(srna, "skin_vertices", PROP_COLLECTION, PROP_NON
E); | |
3039 RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totl
ayer"); | |
3040 RNA_def_property_collection_funcs(prop, "rna_Mesh_skin_vertices_begin",
NULL, NULL, NULL, | |
3041 "rna_Mesh_skin_vertices_length", NULL,
NULL, NULL); | |
3042 RNA_def_property_struct_type(prop, "MeshSkinVertexLayer"); | |
3043 RNA_def_property_ui_text(prop, "Skin Vertices", "All skin vertices"); | |
3044 rna_def_skin_vertices(brna, prop); | |
3045 /* End skin vertices */ | |
3046 | |
3047 prop = RNA_def_property(srna, "use_auto_smooth", PROP_BOOLEAN, PROP_NONE
); | |
3048 RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_AUTOSMOOTH); | |
3049 RNA_def_property_ui_text(prop, "Auto Smooth", | |
3050 "Treat all set-smoothed faces with angles less
than the specified angle " | |
3051 "as 'smooth' during render"); | |
3052 | |
3053 #if 1 /* expose as radians */ | |
3054 prop = RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGL
E); | |
3055 RNA_def_property_float_funcs(prop, "rna_Mesh_auto_smooth_angle_get", "rn
a_Mesh_auto_smooth_angle_set", NULL); | |
3056 RNA_def_property_ui_range(prop, DEG2RAD(1.0), DEG2RAD(80), 1.0, 1); | |
3057 #else | |
3058 prop = RNA_def_property(srna, "auto_smooth_angle", PROP_INT, PROP_NONE); | |
3059 RNA_def_property_int_sdna(prop, NULL, "smoothresh"); | |
3060 RNA_def_property_range(prop, 1, 80); | |
3061 #endif | |
3062 RNA_def_property_ui_text(prop, "Auto Smooth Angle", | |
3063 "Maximum angle between face normals that 'Auto
Smooth' will operate on"); | |
3064 | |
3065 prop = RNA_def_property(srna, "show_double_sided", PROP_BOOLEAN, PROP_NO
NE); | |
3066 RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_TWOSIDED); | |
3067 RNA_def_property_ui_text(prop, "Double Sided", "Render/display the mesh
with double or single sided lighting"); | |
3068 RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); | |
3069 | |
3070 prop = RNA_def_property(srna, "texco_mesh", PROP_POINTER, PROP_NONE); | |
3071 RNA_def_property_pointer_sdna(prop, NULL, "texcomesh"); | |
3072 RNA_def_property_flag(prop, PROP_EDITABLE); | |
3073 RNA_def_property_ui_text(prop, "Texture Space Mesh", "Derive texture coo
rdinates from another mesh"); | |
3074 | |
3075 prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE); | |
3076 RNA_def_property_pointer_sdna(prop, NULL, "key"); | |
3077 RNA_def_property_ui_text(prop, "Shape Keys", ""); | |
3078 | |
3079 /* texture space */ | |
3080 prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NO
NE); | |
3081 RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE); | |
3082 RNA_def_property_ui_text(prop, "Auto Texture Space", | |
3083 "Adjust active object's texture space automatic
ally when transforming object"); | |
3084 | |
3085 #if 0 | |
3086 prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRAN
SLATION); | |
3087 RNA_def_property_array(prop, 3); | |
3088 RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space
location"); | |
3089 RNA_def_property_editable_func(prop, "rna_Mesh_texspace_editable"); | |
3090 RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", "rna_Mes
h_texspace_loc_set", NULL); | |
3091 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3092 #endif | |
3093 | |
3094 /* not supported yet */ | |
3095 #if 0 | |
3096 prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER); | |
3097 RNA_def_property_float(prop, NULL, "rot"); | |
3098 RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space
rotation"); | |
3099 RNA_def_property_editable_func(prop, texspace_editable); | |
3100 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3101 #endif | |
3102 | |
3103 /* Mesh Draw Options for Edit Mode*/ | |
3104 | |
3105 prop = RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE); | |
3106 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEDGES); | |
3107 RNA_def_property_ui_text(prop, "Draw Edges", | |
3108 "Display selected edges using highlights in the
3D view and UV editor"); | |
3109 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3110 | |
3111 prop = RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE); | |
3112 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWFACES); | |
3113 RNA_def_property_ui_text(prop, "Draw Faces", "Display all faces as shade
s in the 3D view and UV editor"); | |
3114 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3115 | |
3116 prop = RNA_def_property(srna, "show_normal_face", PROP_BOOLEAN, PROP_NON
E); | |
3117 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWNORMALS); | |
3118 RNA_def_property_ui_text(prop, "Draw Normals", "Display face normals as
lines"); | |
3119 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3120 | |
3121 prop = RNA_def_property(srna, "show_normal_vertex", PROP_BOOLEAN, PROP_N
ONE); | |
3122 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_VNORMALS); | |
3123 RNA_def_property_ui_text(prop, "Draw Vertex Normals", "Display vertex no
rmals as lines"); | |
3124 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3125 | |
3126 prop = RNA_def_property(srna, "show_weight", PROP_BOOLEAN, PROP_NONE); | |
3127 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEIGHT); | |
3128 RNA_def_property_ui_text(prop, "Show Weights", "Draw weights in editmode
"); | |
3129 RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_color"); /*
needs to rebuild 'dm' */ | |
3130 | |
3131 prop = RNA_def_property(srna, "show_edge_crease", PROP_BOOLEAN, PROP_NON
E); | |
3132 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWCREASES); | |
3133 RNA_def_property_ui_text(prop, "Draw Creases", "Display creases created
for subsurf weighting"); | |
3134 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3135 | |
3136 prop = RNA_def_property(srna, "show_edge_bevel_weight", PROP_BOOLEAN, PR
OP_NONE); | |
3137 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWBWEIGHTS); | |
3138 RNA_def_property_ui_text(prop, "Draw Bevel Weights", "Display weights cr
eated for the Bevel modifier"); | |
3139 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3140 | |
3141 prop = RNA_def_property(srna, "show_edge_seams", PROP_BOOLEAN, PROP_NONE
); | |
3142 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWSEAMS); | |
3143 RNA_def_property_ui_text(prop, "Draw Seams", "Display UV unwrapping seam
s"); | |
3144 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3145 | |
3146 prop = RNA_def_property(srna, "show_edge_sharp", PROP_BOOLEAN, PROP_NONE
); | |
3147 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWSHARP); | |
3148 RNA_def_property_ui_text(prop, "Draw Sharp", "Display sharp edges, used
with the EdgeSplit modifier"); | |
3149 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3150 | |
3151 prop = RNA_def_property(srna, "show_freestyle_edge_marks", PROP_BOOLEAN,
PROP_NONE); | |
3152 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_FREESTYLE_
EDGE); | |
3153 RNA_def_property_ui_text(prop, "Draw Freestyle Edge Marks", "Display Fre
estyle edge marks, used with the Freestyle renderer"); | |
3154 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3155 | |
3156 prop = RNA_def_property(srna, "show_freestyle_face_marks", PROP_BOOLEAN,
PROP_NONE); | |
3157 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_FREESTYLE_
FACE); | |
3158 RNA_def_property_ui_text(prop, "Draw Freestyle Face Marks", "Display Fre
estyle face marks, used with the Freestyle renderer"); | |
3159 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3160 | |
3161 prop = RNA_def_property(srna, "show_statvis", PROP_BOOLEAN, PROP_NONE); | |
3162 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_STATVIS); | |
3163 RNA_def_property_ui_text(prop, "Stat Vis", "Display statistical informat
ion about the mesh"); | |
3164 RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_color"); | |
3165 | |
3166 prop = RNA_def_property(srna, "show_extra_edge_length", PROP_BOOLEAN, PR
OP_NONE); | |
3167 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_EDGEL
EN); | |
3168 RNA_def_property_ui_text(prop, "Edge Length", | |
3169 "Display selected edge lengths, using global va
lues when set in the transform panel"); | |
3170 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3171 | |
3172 prop = RNA_def_property(srna, "show_extra_edge_angle", PROP_BOOLEAN, PRO
P_NONE); | |
3173 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_EDGEA
NG); | |
3174 RNA_def_property_ui_text(prop, "Edge Angle", | |
3175 "Display selected edge angle, using global valu
es when set in the transform panel"); | |
3176 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3177 | |
3178 prop = RNA_def_property(srna, "show_extra_face_angle", PROP_BOOLEAN, PRO
P_NONE); | |
3179 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEA
NG); | |
3180 RNA_def_property_ui_text(prop, "Face Angles", | |
3181 "Display the angles in the selected edges, " | |
3182 "using global values when set in the transform
panel"); | |
3183 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3184 | |
3185 prop = RNA_def_property(srna, "show_extra_face_area", PROP_BOOLEAN, PROP
_NONE); | |
3186 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEA
REA); | |
3187 RNA_def_property_ui_text(prop, "Face Area", | |
3188 "Display the area of selected faces, " | |
3189 "using global values when set in the transform
panel"); | |
3190 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3191 | |
3192 prop = RNA_def_property(srna, "show_extra_indices", PROP_BOOLEAN, PROP_N
ONE); | |
3193 RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_INDIC
ES); | |
3194 RNA_def_property_ui_text(prop, "Indices", "Display the index numbers of
selected vertices, edges, and faces"); | |
3195 RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); | |
3196 | |
3197 /* editflag */ | |
3198 prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE); | |
3199 RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_X); | |
3200 RNA_def_property_ui_text(prop, "X Mirror", "X Axis mirror editing"); | |
3201 | |
3202 #if 0 | |
3203 prop = RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE); | |
3204 RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_Y); | |
3205 RNA_def_property_ui_text(prop, "Y Mirror", "Y Axis mirror editing"); | |
3206 | |
3207 prop = RNA_def_property(srna, "use_mirror_z", PROP_BOOLEAN, PROP_NONE); | |
3208 RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_Z); | |
3209 RNA_def_property_ui_text(prop, "Z Mirror", "Z Axis mirror editing"); | |
3210 #endif | |
3211 | |
3212 prop = RNA_def_property(srna, "use_mirror_topology", PROP_BOOLEAN, PROP_
NONE); | |
3213 RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_TOP
O); | |
3214 RNA_def_property_ui_text(prop, "Topology Mirror", | |
3215 "Use topology based mirroring " | |
3216 "(for when both sides of mesh have matching, un
ique topology)"); | |
3217 | |
3218 prop = RNA_def_property(srna, "use_paint_mask", PROP_BOOLEAN, PROP_NONE)
; | |
3219 RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_FACE
_SEL); | |
3220 RNA_def_property_ui_text(prop, "Paint Mask", "Face selection masking for
painting"); | |
3221 RNA_def_property_ui_icon(prop, ICON_FACESEL_HLT, 0); | |
3222 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Mesh_upda
te_facemask"); | |
3223 | |
3224 prop = RNA_def_property(srna, "use_paint_mask_vertex", PROP_BOOLEAN, PRO
P_NONE); | |
3225 RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_VERT
_SEL); | |
3226 RNA_def_property_ui_text(prop, "Vertex Selection", "Vertex selection mas
king for painting (weight paint only)"); | |
3227 RNA_def_property_ui_icon(prop, ICON_VERTEXSEL, 0); | |
3228 RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Mesh_upda
te_vertmask"); | |
3229 | |
3230 | |
3231 | |
3232 /* customdata flags */ | |
3233 prop = RNA_def_property(srna, "use_customdata_vertex_bevel", PROP_BOOLEA
N, PROP_NONE); | |
3234 RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_VERT_BWEI
GHT); | |
3235 RNA_def_property_ui_text(prop, "Store Vertex Bevel Weight", ""); | |
3236 | |
3237 prop = RNA_def_property(srna, "use_customdata_edge_bevel", PROP_BOOLEAN,
PROP_NONE); | |
3238 RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_EDGE_BWEI
GHT); | |
3239 RNA_def_property_ui_text(prop, "Store Edge Bevel Weight", ""); | |
3240 | |
3241 prop = RNA_def_property(srna, "use_customdata_edge_crease", PROP_BOOLEAN
, PROP_NONE); | |
3242 RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_EDGE_CREA
SE); | |
3243 RNA_def_property_ui_text(prop, "Store Edge Crease", ""); | |
3244 | |
3245 | |
3246 /* readonly editmesh info - use for extrude menu */ | |
3247 prop = RNA_def_property(srna, "total_vert_sel", PROP_INT, PROP_UNSIGNED)
; | |
3248 RNA_def_property_int_funcs(prop, "rna_Mesh_tot_vert_get", NULL, NULL); | |
3249 RNA_def_property_ui_text(prop, "Selected Vert Total", "Selected vertex c
ount in editmode"); | |
3250 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
3251 | |
3252 prop = RNA_def_property(srna, "total_edge_sel", PROP_INT, PROP_UNSIGNED)
; | |
3253 RNA_def_property_int_funcs(prop, "rna_Mesh_tot_edge_get", NULL, NULL); | |
3254 RNA_def_property_ui_text(prop, "Selected Edge Total", "Selected edge cou
nt in editmode"); | |
3255 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
3256 | |
3257 prop = RNA_def_property(srna, "total_face_sel", PROP_INT, PROP_UNSIGNED)
; | |
3258 RNA_def_property_int_funcs(prop, "rna_Mesh_tot_face_get", NULL, NULL); | |
3259 RNA_def_property_ui_text(prop, "Selected Face Total", "Selected face cou
nt in editmode"); | |
3260 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
3261 | |
3262 prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE); | |
3263 RNA_def_property_boolean_funcs(prop, "rna_Mesh_is_editmode_get", NULL); | |
3264 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |
3265 RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmod
e"); | |
3266 | |
3267 /* pointers */ | |
3268 rna_def_animdata_common(srna); | |
3269 rna_def_texmat_common(srna, "rna_Mesh_texspace_editable"); | |
3270 | |
3271 RNA_api_mesh(srna); | |
3272 } | |
3273 | |
3274 void RNA_def_mesh(BlenderRNA *brna) | |
3275 { | |
3276 rna_def_mesh(brna); | |
3277 rna_def_mvert(brna); | |
3278 rna_def_mvert_group(brna); | |
3279 rna_def_medge(brna); | |
3280 rna_def_mface(brna); | |
3281 rna_def_mloop(brna); | |
3282 rna_def_mpolygon(brna); | |
3283 rna_def_mloopuv(brna); | |
3284 rna_def_mtface(brna); | |
3285 rna_def_mtexpoly(brna); | |
3286 rna_def_mcol(brna); | |
3287 rna_def_mloopcol(brna); | |
3288 rna_def_mproperties(brna); | |
3289 } | |
3290 | |
3291 #endif | |
LEFT | RIGHT |