THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/04/2011 at 23:09, xxxxxxxx wrote:
There are two projects. In project #1, I have an external tools that creates textured objects, like houses, plants, and terrain. Currently, invoking the external process and importing the geometry works fine, only textures are missing. I am trying to load the texture using this code:
void myNode::setTexturePath()
{
if (fileExists(cp1252textureFNchars)) {
GeListNode* node = Get();
GeData* data = new GeData();
BaseDocument* doc = node->GetDocument();
Material *mat = (Material* )m_matlink->GetLink(doc, Mmaterial);
//data->SetFilename("");
//mat->SetParameter(CHANNEL_COLOR, *data, 0);
if (data->SetFilename(cp1252textureFNchars)) {
if(mat->SetParameter(CHANNEL_COLOR, *data, 0))
GePrint ("Setting texture filename succeeded:");
else
GePrint ("Setting texture filename failed (2) :");
else*/
GePrint ("Setting texture filename failed (1) :");
} else {
GePrint ("Texture file does not exist:");
}
GePrint (cp1252textureFNchars);
}
Obviously, I need to call this procedure from somewhere. As the external file can be created at any time, I would like to call setTexturePath when I receive a periodical message in myNode::Message, but I could not find such a periodical message in the documentation. I'm not even certain if setTexturePath is the right way of doing things.
Project #2 is a texture generator. It describes 3D textures as functions, and I want to bake these textures into a 2D pixel exact texture. This works fine as a command line tool that opens OBJ files with UV coordinates and that creates a BMP, but I want to integrate it into Cinema 4D. In this case, I need direct access to the texels. If you tell me how to access texels in a material, it should solve both my problems, because few things are easier than loading an uncompressed BMP file.
I want to integrate both projects tightly with Cinema 4D. Both projects may be a bit experimental, but I'm convinced it can work.
Please help
Regards