miro
07/10/2010, 09h52
Re-bonjour à tous,
Je proposer de continuer le fil de la question que j'avais posée dans le bac à sable ici, si les modos n'y voyent pas d'inconvénient.
Il s'agit de créer un matériau avec une texture chargée à partir d'un fichier en utilisant Py4D.
Valkaari a proposé le code coffee suivant comme point de départ:
myShader = AllocMaterial(Mmaterial);
doc->InsertMaterial(myShader,firstMaterial);
// Set the transparency to on
myShader->SetChannelState(CHANNEL_COLOR,FALSE);
myShader->SetChannelState(CHANNEL_TRANSPARENCY,TRUE);
myShader->SetChannelState(CHANNEL_SPECULAR,FALSE);
// set the texture to it
var trans = myShader->GetChannel(CHANNEL_TRANSPARENCY);
var transBC = trans->GetContainer();
var pathtofile = op#ID_USERDATA:8->GetFullString();
transBC->SetData(CH_TEXTURE,pathtofile);
trans->SetContainer(transBC);
Or, il m'est impossible de récupérer un objet de type Channel en python, la fonction GetChannel est bien présente dans le header de BaseMaterial, mais elle ne semble pas avoir été transposée de Coffee en python. Je précise que la création d'un nouveau matériau, ainsi que le linkage avec un objet joue, je n'arrive "simplement" pas à accéder au chemin d'accès pour charger une texture en code python :(
Merci d'avance si quelqu'un a une idée ou une solution,
Bonne journée
Miro
Je proposer de continuer le fil de la question que j'avais posée dans le bac à sable ici, si les modos n'y voyent pas d'inconvénient.
Il s'agit de créer un matériau avec une texture chargée à partir d'un fichier en utilisant Py4D.
Valkaari a proposé le code coffee suivant comme point de départ:
myShader = AllocMaterial(Mmaterial);
doc->InsertMaterial(myShader,firstMaterial);
// Set the transparency to on
myShader->SetChannelState(CHANNEL_COLOR,FALSE);
myShader->SetChannelState(CHANNEL_TRANSPARENCY,TRUE);
myShader->SetChannelState(CHANNEL_SPECULAR,FALSE);
// set the texture to it
var trans = myShader->GetChannel(CHANNEL_TRANSPARENCY);
var transBC = trans->GetContainer();
var pathtofile = op#ID_USERDATA:8->GetFullString();
transBC->SetData(CH_TEXTURE,pathtofile);
trans->SetContainer(transBC);
Or, il m'est impossible de récupérer un objet de type Channel en python, la fonction GetChannel est bien présente dans le header de BaseMaterial, mais elle ne semble pas avoir été transposée de Coffee en python. Je précise que la création d'un nouveau matériau, ainsi que le linkage avec un objet joue, je n'arrive "simplement" pas à accéder au chemin d'accès pour charger une texture en code python :(
Merci d'avance si quelqu'un a une idée ou une solution,
Bonne journée
Miro