[Bf-python] Texture API- first "sketch"

Willian Padovani Germano wgermano at ig.com.br
Wed Nov 12 17:15:13 CET 2003


Hi,

> What about the stype member though? This stores a number that means
> different things depending on what type of texture it is [if it is an
> envmap texture, stype=0 means something totally different than if it's a
> cloud texture]. Should there just be a constant dict which contains all
> the possible values, with names like 'ENV_ANIM' or 'CLD_COLOR', and
> leave figuring out the proper ones to use to the scripter? This seems
> like the most reasonable option....

That's a good way, since script writers can then consult the docs to see
what each thing means.  For the set???() method for this, maybe you could
standardize a little and accept the string "Default" for stype==0, where
then default would mean something different for each tex type.  Then in the
switch/case statements or if/if else, depending on your preferences:

[pseudo code with bogus examples]

switch (textype) {
  case EXPP_TEX_TYPE_CLOUD:
     if (!strcmp(arg, "Default") || !strcmp(arg, "Color") { ... }
     else if (!strcmp ...
     ...
     break;
  case EXPP_TEX_TYPE_ENVMAP:
     if (!strcmp(arg, "Default") || !strcmp(arg, ...

you got the picture.

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list