Generic Texture Plugin:
Prev | Chapter 27. Blender's Plugins System | Next

## Generic Texture Plugin:

Relevant to Blender v2.31

    #include "plugin.h"

    /* Texture name */
    char name[24]= "";

    #define NR_TYPES 3
    char stnames[NR_TYPES][16]= {"Intens","Color", "Bump"};
    /* Structure for buttons,
     * butcode name default min max 0
     */

    VarStruct varstr[]= {
     {NUM|FLO, "Const 1", 1.7, -1.0, 1.0, ""},
    };

    typedef struct Cast {
     float a;
    } Cast;

    float result[8];
    float cfra;
    int plugin_tex_doit(int, Cast*, float*, float*, float*);

    /* Fixed Functions */
    int plugin_tex_getversion(void) {
     return B_PLUGIN_VERSION;
    }

    void plugin_but_changed(int but) { }

    void plugin_init(void) { }

    void plugin_getinfo(PluginInfo *info) {
     info->name= name;
     info->stypes= NR_TYPES;
     info->nvars= sizeof(varstr)/sizeof(VarStruct);

     info->snames= stnames[0];
     info->result= result;
     info->cfra= &cfra;
     info->varstr= varstr;

     info->init= plugin_init;
     info->tex_doit= (TexDoit) plugin_tex_doit;
     info->callback= plugin_but_changed;
    }

    int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt,
     float *dyt) {

     if (stype == 1) {
     return 1;
     } if (stype == 2) {
     return 2;
     }
     return 0;
    }

Prev | Up | Next
Specification: | Home | Our Modifications: