~ubuntu-branches/ubuntu/maverick/blender/maverick

« back to all changes in this revision

Viewing changes to source/blender/blenkernel/intern/customdata.c

  • Committer: Bazaar Package Importer
  • Author(s): Khashayar Naderehvandi, Khashayar Naderehvandi, Alessio Treglia
  • Date: 2009-01-22 16:53:59 UTC
  • mfrom: (14.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090122165359-v0996tn7fbit64ni
Tags: 2.48a+dfsg-1ubuntu1
[ Khashayar Naderehvandi ]
* Merge from debian experimental (LP: #320045), Ubuntu remaining changes:
  - Add patch correcting header file locations.
  - Add libvorbis-dev and libgsm1-dev to Build-Depends.
  - Use avcodec_decode_audio2() in source/blender/src/hddaudio.c

[ Alessio Treglia ]
* Add missing previous changelog entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
* $Id: customdata.c 14853 2008-05-15 19:40:09Z blendix $
 
2
* $Id: customdata.c 16827 2008-09-29 17:08:11Z campbellbarton $
3
3
*
4
4
* ***** BEGIN GPL LICENSE BLOCK *****
5
5
*
36
36
 
37
37
#include "BLI_blenlib.h"
38
38
#include "BLI_linklist.h"
 
39
#include "BLI_mempool.h"
39
40
 
40
41
#include "DNA_customdata_types.h"
41
42
#include "DNA_listBase.h"
264
265
{
265
266
        MTFace *tf = data;
266
267
        float uv[4][2];
 
268
        static const short pin_flags[4] =
 
269
            { TF_PIN1, TF_PIN2, TF_PIN3, TF_PIN4 };
 
270
        static const char sel_flags[4] =
 
271
            { TF_SEL1, TF_SEL2, TF_SEL3, TF_SEL4 };
 
272
        short unwrap = tf->unwrap & ~(TF_PIN1 | TF_PIN2 | TF_PIN3 | TF_PIN4);
 
273
        char flag = tf->flag & ~(TF_SEL1 | TF_SEL2 | TF_SEL3 | TF_SEL4);
267
274
        int j;
268
275
 
269
276
        for(j = 0; j < 4; ++j) {
270
 
                uv[j][0] = tf->uv[corner_indices[j]][0];
271
 
                uv[j][1] = tf->uv[corner_indices[j]][1];
 
277
                int source_index = corner_indices[j];
 
278
 
 
279
                uv[j][0] = tf->uv[source_index][0];
 
280
                uv[j][1] = tf->uv[source_index][1];
 
281
 
 
282
                // swap pinning flags around
 
283
                if(tf->unwrap & pin_flags[source_index]) {
 
284
                        unwrap |= pin_flags[j];
 
285
                }
 
286
 
 
287
                // swap selection flags around
 
288
                if(tf->flag & sel_flags[source_index]) {
 
289
                        flag |= sel_flags[j];
 
290
                }
272
291
        }
273
292
 
274
293
        memcpy(tf->uv, uv, sizeof(tf->uv));
 
294
        tf->unwrap = unwrap;
 
295
        tf->flag = flag;
275
296
}
276
297
 
277
298
static void layerDefault_tface(void *data, int count)
359
380
}
360
381
/* --------- */
361
382
 
362
 
 
363
 
 
 
383
static void layerDefault_mloopcol(void *data, int count)
 
384
{
 
385
        static MLoopCol default_mloopcol = {255,255,255,255};
 
386
        MLoopCol *mlcol = (MLoopCol*)data;
 
387
        int i;
 
388
        for(i = 0; i < count; i++)
 
389
                mlcol[i] = default_mloopcol;
 
390
 
 
391
}
 
392
 
 
393
static void layerInterp_mloopcol(void **sources, float *weights,
 
394
                                float *sub_weights, int count, void *dest)
 
395
{
 
396
        MLoopCol *mc = dest;
 
397
        int i;
 
398
        float *sub_weight;
 
399
        struct {
 
400
                float a;
 
401
                float r;
 
402
                float g;
 
403
                float b;
 
404
        } col;
 
405
        col.a = col.r = col.g = col.b = 0;
 
406
 
 
407
        sub_weight = sub_weights;
 
408
        for(i = 0; i < count; ++i){
 
409
                float weight = weights ? weights[i] : 1;
 
410
                MLoopCol *src = sources[i];
 
411
                if(sub_weights){
 
412
                        col.a += src->a * (*sub_weight) * weight;
 
413
                        col.r += src->r * (*sub_weight) * weight;
 
414
                        col.g += src->g * (*sub_weight) * weight;
 
415
                        col.b += src->b * (*sub_weight) * weight;
 
416
                        sub_weight++;           
 
417
                } else {
 
418
                        col.a += src->a * weight;
 
419
                        col.r += src->r * weight;
 
420
                        col.g += src->g * weight;
 
421
                        col.b += src->b * weight;
 
422
                }
 
423
        }
 
424
        mc->a = (int)col.a;
 
425
        mc->r = (int)col.r;
 
426
        mc->g = (int)col.g;
 
427
        mc->b = (int)col.b;
 
428
}
 
429
static void layerInterp_mloopuv(void **sources, float *weights,
 
430
                                float *sub_weights, int count, void *dest)
 
431
{
 
432
        MLoopUV *mluv = dest;
 
433
        int i;
 
434
        float *sub_weight;
 
435
        struct {
 
436
                float u;
 
437
                float v;
 
438
        }uv;
 
439
        uv.u = uv.v = 0.0;
 
440
 
 
441
        sub_weight = sub_weights;
 
442
        for(i = 0; i < count; ++i){
 
443
                float weight = weights ? weights[i] : 1;
 
444
                MLoopUV *src = sources[i];
 
445
                if(sub_weights){
 
446
                        uv.u += src->uv[0] * (*sub_weight) * weight;
 
447
                        uv.v += src->uv[1] * (*sub_weight) * weight;
 
448
                        sub_weight++;           
 
449
                } else {
 
450
                        uv.u += src->uv[0] * weight;
 
451
                        uv.v += src->uv[1] * weight;
 
452
                }
 
453
        }
 
454
        mluv->uv[0] = uv.u;
 
455
        mluv->uv[1] = uv.v;
 
456
}
364
457
 
365
458
static void layerInterp_mcol(void **sources, float *weights,
366
459
                             float *sub_weights, int count, void *dest)
432
525
                mcol[i] = default_mcol;
433
526
}
434
527
 
 
528
 
 
529
 
435
530
const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
436
531
        {sizeof(MVert), "MVert", 1, NULL, NULL, NULL, NULL, NULL, NULL},
437
532
        {sizeof(MSticky), "MSticky", 1, NULL, NULL, NULL, layerInterp_msticky, NULL,
454
549
        {sizeof(MStringProperty), "MStringProperty",1,"String",NULL,NULL,NULL,NULL},
455
550
        {sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVTex", layerCopy_origspace_face, NULL,
456
551
         layerInterp_origspace_face, layerSwap_origspace_face, layerDefault_origspace_face},
457
 
        {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}
 
552
        {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
 
553
        {sizeof(MTexPoly), "MTexPoly", 1, "Face Texture", NULL, NULL, NULL, NULL, NULL},
 
554
        {sizeof(MLoopUV), "MLoopUV", 1, "UV coord", NULL, NULL, layerInterp_mloopuv, NULL, NULL},
 
555
        {sizeof(MLoopCol), "MLoopCol", 1, "Col", NULL, NULL, layerInterp_mloopcol, NULL, layerDefault_mloopcol},
 
556
        {sizeof(float)*3*4, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}
458
557
};
459
558
 
460
559
const char *LAYERTYPENAMES[CD_NUMTYPES] = {
461
560
        "CDMVert", "CDMSticky", "CDMDeformVert", "CDMEdge", "CDMFace", "CDMTFace",
462
561
        "CDMCol", "CDOrigIndex", "CDNormal", "CDFlags","CDMFloatProperty",
463
 
        "CDMIntProperty","CDMStringProperty", "CDOrigSpace", "CDOrco"};
 
562
        "CDMIntProperty","CDMStringProperty", "CDOrigSpace", "CDOrco", "CDMTexPoly", "CDMLoopUV", "CDMloopCol", "CDTangent"};
464
563
 
465
564
const CustomDataMask CD_MASK_BAREMESH =
466
565
        CD_MASK_MVERT | CD_MASK_MEDGE | CD_MASK_MFACE;
474
573
const CustomDataMask CD_MASK_DERIVEDMESH =
475
574
        CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_MTFACE |
476
575
        CD_MASK_MCOL | CD_MASK_ORIGINDEX | CD_MASK_PROP_FLT | CD_MASK_PROP_INT |
477
 
        CD_MASK_PROP_STR | CD_MASK_ORIGSPACE | CD_MASK_ORCO;
 
576
        CD_MASK_PROP_STR | CD_MASK_ORIGSPACE | CD_MASK_ORCO | CD_MASK_TANGENT;
 
577
const CustomDataMask CD_MASK_BMESH = 
 
578
        CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR;
 
579
const CustomDataMask CD_MASK_FACECORNERS =
 
580
        CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_MTEXPOLY | CD_MASK_MLOOPUV |
 
581
        CD_MASK_MLOOPCOL;
 
582
 
478
583
 
479
584
static const LayerTypeInfo *layerType_getInfo(int type)
480
585
{
821
926
int CustomData_free_layer(CustomData *data, int type, int totelem, int index)
822
927
{
823
928
        int i;
824
 
        CustomDataLayer *layer;
825
929
        
826
930
        if (index < 0) return 0;
827
931
 
828
 
        layer = &data->layers[index];
829
 
 
830
932
        customData_free_layer__internal(&data->layers[index], totelem);
831
933
 
832
934
        for (i=index+1; i < data->totlayer; ++i)
1278
1380
        int layer_index;
1279
1381
        
1280
1382
        /* get the layer index of the first layer of type */
1281
 
        layer_index = CustomData_get_active_layer_index(data, type);
 
1383
        layer_index = CustomData_get_layer_index(data, type);
1282
1384
        if(layer_index < 0) return NULL;
1283
1385
 
1284
1386
        return (char *)block + data->layers[layer_index+n].offset;
1449
1551
 
1450
1552
}
1451
1553
 
 
1554
/*Bmesh functions*/
 
1555
/*needed to convert to/from different face reps*/
 
1556
void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata)
 
1557
{
 
1558
        int i;
 
1559
        for(i=0; i < fdata->totlayer; i++){
 
1560
                if(fdata->layers[i].type == CD_MTFACE){
 
1561
                        CustomData_add_layer(pdata, CD_MTEXPOLY, CD_CALLOC, &(fdata->layers[i].name), 0);
 
1562
                        CustomData_add_layer(ldata, CD_MLOOPUV, CD_CALLOC, &(fdata->layers[i].name), 0);
 
1563
                }
 
1564
                else if(fdata->layers[i].type == CD_MCOL)
 
1565
                        CustomData_add_layer(ldata, CD_MLOOPCOL, CD_CALLOC, &(fdata->layers[i].name), 0);
 
1566
        }               
 
1567
}
 
1568
void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, int total){
 
1569
        int i;
 
1570
        for(i=0; i < pdata->totlayer; i++){
 
1571
                if(pdata->layers[i].type == CD_MTEXPOLY)
 
1572
                        CustomData_add_layer(fdata, CD_MTFACE, CD_CALLOC, &(pdata->layers[i].name), total);
 
1573
        }
 
1574
        for(i=0; i < ldata->totlayer; i++){
 
1575
                if(ldata->layers[i].type == CD_MLOOPCOL)
 
1576
                        CustomData_add_layer(fdata, CD_MCOL, CD_CALLOC, &(ldata->layers[i].name), total);
 
1577
        }
 
1578
}
 
1579
 
 
1580
 
 
1581
void CustomData_bmesh_init_pool(CustomData *data, int allocsize){
 
1582
        if(data->totlayer)data->pool = BLI_mempool_create(data->totsize, allocsize, allocsize);
 
1583
}
 
1584
 
 
1585
void CustomData_bmesh_free_block(CustomData *data, void **block)
 
1586
{
 
1587
    const LayerTypeInfo *typeInfo;
 
1588
    int i;
 
1589
 
 
1590
        if(!*block) return;
 
1591
    for(i = 0; i < data->totlayer; ++i) {
 
1592
        if(!(data->layers[i].flag & CD_FLAG_NOFREE)) {
 
1593
            typeInfo = layerType_getInfo(data->layers[i].type);
 
1594
 
 
1595
            if(typeInfo->free) {
 
1596
                                int offset = data->layers[i].offset;
 
1597
                                typeInfo->free((char*)*block + offset, 1, typeInfo->size);
 
1598
                        }
 
1599
        }
 
1600
    }
 
1601
 
 
1602
        BLI_mempool_free(data->pool, *block);
 
1603
        *block = NULL;
 
1604
}
 
1605
 
 
1606
static void CustomData_bmesh_alloc_block(CustomData *data, void **block)
 
1607
{
 
1608
 
 
1609
        if (*block)
 
1610
                CustomData_bmesh_free_block(data, block);
 
1611
 
 
1612
        if (data->totsize > 0)
 
1613
                *block = BLI_mempool_calloc(data->pool);
 
1614
        else
 
1615
                *block = NULL;
 
1616
}
 
1617
 
 
1618
void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
 
1619
                            void *src_block, void **dest_block)
 
1620
{
 
1621
        const LayerTypeInfo *typeInfo;
 
1622
        int dest_i, src_i;
 
1623
 
 
1624
        if (!*dest_block)
 
1625
                CustomData_bmesh_alloc_block(dest, dest_block);
 
1626
        
 
1627
        /* copies a layer at a time */
 
1628
        dest_i = 0;
 
1629
        for(src_i = 0; src_i < source->totlayer; ++src_i) {
 
1630
 
 
1631
                /* find the first dest layer with type >= the source type
 
1632
                 * (this should work because layers are ordered by type)
 
1633
                 */
 
1634
                while(dest_i < dest->totlayer
 
1635
                      && dest->layers[dest_i].type < source->layers[src_i].type)
 
1636
                        ++dest_i;
 
1637
 
 
1638
                /* if there are no more dest layers, we're done */
 
1639
                if(dest_i >= dest->totlayer) return;
 
1640
 
 
1641
                /* if we found a matching layer, copy the data */
 
1642
                if(dest->layers[dest_i].type == source->layers[src_i].type &&
 
1643
                        strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0) {
 
1644
                        char *src_data = (char*)src_block + source->layers[src_i].offset;
 
1645
                        char *dest_data = (char*)*dest_block + dest->layers[dest_i].offset;
 
1646
 
 
1647
                        typeInfo = layerType_getInfo(source->layers[src_i].type);
 
1648
 
 
1649
                        if(typeInfo->copy)
 
1650
                                typeInfo->copy(src_data, dest_data, 1);
 
1651
                        else
 
1652
                                memcpy(dest_data, src_data, typeInfo->size);
 
1653
 
 
1654
                        /* if there are multiple source & dest layers of the same type,
 
1655
                         * we don't want to copy all source layers to the same dest, so
 
1656
                         * increment dest_i
 
1657
                         */
 
1658
                        ++dest_i;
 
1659
                }
 
1660
        }
 
1661
}
 
1662
 
 
1663
/*Bmesh Custom Data Functions. Should replace editmesh ones with these as well, due to more effecient memory alloc*/
 
1664
void *CustomData_bmesh_get(const CustomData *data, void *block, int type)
 
1665
{
 
1666
        int layer_index;
 
1667
        
 
1668
        /* get the layer index of the first layer of type */
 
1669
        layer_index = CustomData_get_active_layer_index(data, type);
 
1670
        if(layer_index < 0) return NULL;
 
1671
 
 
1672
        return (char *)block + data->layers[layer_index].offset;
 
1673
}
 
1674
 
 
1675
void *CustomData_bmesh_get_n(const CustomData *data, void *block, int type, int n)
 
1676
{
 
1677
        int layer_index;
 
1678
        
 
1679
        /* get the layer index of the first layer of type */
 
1680
        layer_index = CustomData_get_layer_index(data, type);
 
1681
        if(layer_index < 0) return NULL;
 
1682
 
 
1683
        return (char *)block + data->layers[layer_index+n].offset;
 
1684
}
 
1685
 
 
1686
void CustomData_bmesh_set(const CustomData *data, void *block, int type, void *source)
 
1687
{
 
1688
        void *dest = CustomData_bmesh_get(data, block, type);
 
1689
        const LayerTypeInfo *typeInfo = layerType_getInfo(type);
 
1690
 
 
1691
        if(!dest) return;
 
1692
 
 
1693
        if(typeInfo->copy)
 
1694
                typeInfo->copy(source, dest, 1);
 
1695
        else
 
1696
                memcpy(dest, source, typeInfo->size);
 
1697
}
 
1698
 
 
1699
void CustomData_bmesh_set_n(CustomData *data, void *block, int type, int n, void *source)
 
1700
{
 
1701
        void *dest = CustomData_bmesh_get_n(data, block, type, n);
 
1702
        const LayerTypeInfo *typeInfo = layerType_getInfo(type);
 
1703
 
 
1704
        if(!dest) return;
 
1705
 
 
1706
        if(typeInfo->copy)
 
1707
                typeInfo->copy(source, dest, 1);
 
1708
        else
 
1709
                memcpy(dest, source, typeInfo->size);
 
1710
}
 
1711
 
 
1712
void CustomData_bmesh_interp(CustomData *data, void **src_blocks, float *weights,
 
1713
                          float *sub_weights, int count, void *dest_block)
 
1714
{
 
1715
        int i, j;
 
1716
        void *source_buf[SOURCE_BUF_SIZE];
 
1717
        void **sources = source_buf;
 
1718
 
 
1719
        /* slow fallback in case we're interpolating a ridiculous number of
 
1720
         * elements
 
1721
         */
 
1722
        if(count > SOURCE_BUF_SIZE)
 
1723
                sources = MEM_callocN(sizeof(*sources) * count,
 
1724
                                      "CustomData_interp sources");
 
1725
 
 
1726
        /* interpolates a layer at a time */
 
1727
        for(i = 0; i < data->totlayer; ++i) {
 
1728
                CustomDataLayer *layer = &data->layers[i];
 
1729
                const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type);
 
1730
                if(typeInfo->interp) {
 
1731
                        for(j = 0; j < count; ++j)
 
1732
                                sources[j] = (char *)src_blocks[j] + layer->offset;
 
1733
 
 
1734
                        typeInfo->interp(sources, weights, sub_weights, count,
 
1735
                                          (char *)dest_block + layer->offset);
 
1736
                }
 
1737
        }
 
1738
 
 
1739
        if(count > SOURCE_BUF_SIZE) MEM_freeN(sources);
 
1740
}
 
1741
 
 
1742
void CustomData_bmesh_set_default(CustomData *data, void **block)
 
1743
{
 
1744
        const LayerTypeInfo *typeInfo;
 
1745
        int i;
 
1746
 
 
1747
        if (!*block)
 
1748
                CustomData_bmesh_alloc_block(data, block);
 
1749
 
 
1750
        for(i = 0; i < data->totlayer; ++i) {
 
1751
                int offset = data->layers[i].offset;
 
1752
 
 
1753
                typeInfo = layerType_getInfo(data->layers[i].type);
 
1754
 
 
1755
                if(typeInfo->set_default)
 
1756
                        typeInfo->set_default((char*)*block + offset, 1);
 
1757
        }
 
1758
}
 
1759
 
 
1760
void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
 
1761
                            int src_index, void **dest_block)
 
1762
{
 
1763
        const LayerTypeInfo *typeInfo;
 
1764
        int dest_i, src_i, src_offset;
 
1765
 
 
1766
        if (!*dest_block)
 
1767
                CustomData_bmesh_alloc_block(dest, dest_block);
 
1768
        
 
1769
        /* copies a layer at a time */
 
1770
        dest_i = 0;
 
1771
        for(src_i = 0; src_i < source->totlayer; ++src_i) {
 
1772
 
 
1773
                /* find the first dest layer with type >= the source type
 
1774
                 * (this should work because layers are ordered by type)
 
1775
                 */
 
1776
                while(dest_i < dest->totlayer
 
1777
                      && dest->layers[dest_i].type < source->layers[src_i].type)
 
1778
                        ++dest_i;
 
1779
 
 
1780
                /* if there are no more dest layers, we're done */
 
1781
                if(dest_i >= dest->totlayer) return;
 
1782
 
 
1783
                /* if we found a matching layer, copy the data */
 
1784
                if(dest->layers[dest_i].type == source->layers[src_i].type) {
 
1785
                        int offset = dest->layers[dest_i].offset;
 
1786
                        char *src_data = source->layers[src_i].data;
 
1787
                        char *dest_data = (char*)*dest_block + offset;
 
1788
 
 
1789
                        typeInfo = layerType_getInfo(dest->layers[dest_i].type);
 
1790
                        src_offset = src_index * typeInfo->size;
 
1791
 
 
1792
                        if(typeInfo->copy)
 
1793
                                typeInfo->copy(src_data + src_offset, dest_data, 1);
 
1794
                        else
 
1795
                                memcpy(dest_data, src_data + src_offset, typeInfo->size);
 
1796
 
 
1797
                        /* if there are multiple source & dest layers of the same type,
 
1798
                         * we don't want to copy all source layers to the same dest, so
 
1799
                         * increment dest_i
 
1800
                         */
 
1801
                        ++dest_i;
 
1802
                }
 
1803
        }
 
1804
}
 
1805
 
 
1806
void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest,
 
1807
                              void *src_block, int dest_index)
 
1808
{
 
1809
        const LayerTypeInfo *typeInfo;
 
1810
        int dest_i, src_i, dest_offset;
 
1811
 
 
1812
        /* copies a layer at a time */
 
1813
        dest_i = 0;
 
1814
        for(src_i = 0; src_i < source->totlayer; ++src_i) {
 
1815
 
 
1816
                /* find the first dest layer with type >= the source type
 
1817
                 * (this should work because layers are ordered by type)
 
1818
                 */
 
1819
                while(dest_i < dest->totlayer
 
1820
                      && dest->layers[dest_i].type < source->layers[src_i].type)
 
1821
                        ++dest_i;
 
1822
 
 
1823
                /* if there are no more dest layers, we're done */
 
1824
                if(dest_i >= dest->totlayer) return;
 
1825
 
 
1826
                /* if we found a matching layer, copy the data */
 
1827
                if(dest->layers[dest_i].type == source->layers[src_i].type) {
 
1828
                        int offset = source->layers[src_i].offset;
 
1829
                        char *src_data = (char*)src_block + offset;
 
1830
                        char *dest_data = dest->layers[dest_i].data;
 
1831
 
 
1832
                        typeInfo = layerType_getInfo(dest->layers[dest_i].type);
 
1833
                        dest_offset = dest_index * typeInfo->size;
 
1834
 
 
1835
                        if(typeInfo->copy)
 
1836
                                typeInfo->copy(src_data, dest_data + dest_offset, 1);
 
1837
                        else
 
1838
                                memcpy(dest_data + dest_offset, src_data, typeInfo->size);
 
1839
 
 
1840
                        /* if there are multiple source & dest layers of the same type,
 
1841
                         * we don't want to copy all source layers to the same dest, so
 
1842
                         * increment dest_i
 
1843
                         */
 
1844
                        ++dest_i;
 
1845
                }
 
1846
        }
 
1847
 
 
1848
}
 
1849
 
1452
1850
void CustomData_file_write_info(int type, char **structname, int *structnum)
1453
1851
{
1454
1852
        const LayerTypeInfo *typeInfo = layerType_getInfo(type);