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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorChris Want <cwant@ualberta.ca>2006-11-22 18:53:46 +0300
committerChris Want <cwant@ualberta.ca>2006-11-22 18:53:46 +0300
commit0b0c8c92441aeb0a21aec52de8689e8000495e0e (patch)
treecd8d830fee68535c88547c7ab0a1a34d3bde90e9 /source
parentbb7ad80269d76cba98a90c8bf95e2cc47f88820c (diff)
=Texture Plugins=
Added a callback instance_init() so that any particular instance of a texture plugin can initialize data. Updated the clouds2 and tile example plugins to have a (dummy) call back.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_plugin_types.h1
-rw-r--r--source/blender/blenkernel/intern/texture.c5
-rw-r--r--source/blender/blenloader/intern/readfile.c5
-rw-r--r--source/blender/blenpluginapi/plugin.h2
-rw-r--r--source/blender/makesdna/DNA_texture_types.h1
5 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_plugin_types.h b/source/blender/blenkernel/BKE_plugin_types.h
index 338cfee7291..2b7c6c06832 100644
--- a/source/blender/blenkernel/BKE_plugin_types.h
+++ b/source/blender/blenkernel/BKE_plugin_types.h
@@ -65,6 +65,7 @@ typedef struct _PluginInfo {
void (*callback)(int);
TexDoit tex_doit;
SeqDoit seq_doit;
+ void (*instance_init)(void *);
} PluginInfo;
#endif
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 3f78ad3a1d6..62ac911bea7 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -136,6 +136,7 @@ void open_plugin_tex(PluginTex *pit)
info_func= (int (*)(PluginInfo *))PIL_dynlib_find_symbol(pit->handle, "plugin_getinfo");
if (!test_dlerr(pit->name, "plugin_getinfo")) {
+ info->instance_init = NULL;
info_func(info);
@@ -148,6 +149,7 @@ void open_plugin_tex(PluginTex *pit)
pit->varstr= info->varstr;
pit->result= info->result;
pit->cfra= info->cfra;
+ pit->instance_init = info->instance_init;
if (info->init) info->init();
}
MEM_freeN(info);
@@ -191,6 +193,9 @@ PluginTex *add_plugin_tex(char *str)
*((int *)(pit->data+a))= (int) varstr->def;
}
+ if (pit->instance_init)
+ pit->instance_init((void *) pit->data);
+
return pit;
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 807af79f76b..1a00ff1490c 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2255,6 +2255,11 @@ static void direct_link_texture(FileData *fd, Tex *tex)
if(tex->plugin) {
tex->plugin->handle= 0;
open_plugin_tex(tex->plugin);
+ /* initialize data for this instance, if an initialization
+ * function exists.
+ */
+ if (tex->plugin->instance_init)
+ tex->plugin->instance_init((void *) tex->plugin->data);
}
tex->coba= newdataadr(fd, tex->coba);
tex->env= newdataadr(fd, tex->env);
diff --git a/source/blender/blenpluginapi/plugin.h b/source/blender/blenpluginapi/plugin.h
index f7ffc7e7c8e..b9048b92878 100644
--- a/source/blender/blenpluginapi/plugin.h
+++ b/source/blender/blenpluginapi/plugin.h
@@ -62,6 +62,8 @@ typedef struct _PluginInfo {
void (*callback)(int);
TexDoit tex_doit;
SeqDoit seq_doit;
+
+ void (*instance_init)(void *);
} PluginInfo;
int plugin_tex_getversion(void);
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index b93276624d5..01de2196f8c 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -89,6 +89,7 @@ typedef struct PluginTex {
float data[32];
int (*doit)(void);
+ void (*instance_init)(void *);
/* should be void (*)(unsigned short)... patched */
void (*callback)(dna_ushort_fix);