Imported asset nodes. Cant change filename on texture
Posted: Fri Jul 03, 2015 8:17 am
I have made a reusable material setup for my DAZ meshes.
Grouped everything used in the material and saved as an orb package.
Idea is to import the mesh and the node with materials.
Then run code that connect mesh and material.
After that it should change the A_FILENAME on some of the texture node to match the specific mesh.
I have written code that connects the mesh pins but when I try to change A_FILENAME on a texture I get an error.
Path seems ok.
Is there something specific with an imported asset that includes texture that prevents me from changing them by code?
I tried the following as well.
I manually changed the texture to the image i wanted.
Then in code i printed out the path with mytexture.getAttribute(octane.A_FILENAME) and i could see it pointing to the image in question.
in the following code row i did mytexture.setAttribute(octane.A_FILENAME, (with the path to the same image as I got above), true) but then I got the error.
Attached error message in case that can help to figure out whats wrong.
EDIT:
I tried this.
currentTextureNode:setAttribute(octane.A_FILENAME,currentTextureNode:getAttribute(octane.A_FILENAME), true)
That is to set path to same at it was already and that works so it does not seems to be anything preventing me prom setting the path.
If I look at the path it has to begin with and been set back to again it is, "assets\imagename.jpg"
The image I try to set is something like c:/xx/image.jpg
So it's a absolute path in the problem case and a relative in the case that works.
Is that the problem and how do I solve it?
EDIT:
OK, I can se that there is a A_PACKAGE attribute in the texture.
So how do I set it back to not use Package and just a file.
Grouped everything used in the material and saved as an orb package.
Idea is to import the mesh and the node with materials.
Then run code that connect mesh and material.
After that it should change the A_FILENAME on some of the texture node to match the specific mesh.
I have written code that connects the mesh pins but when I try to change A_FILENAME on a texture I get an error.
Path seems ok.
Is there something specific with an imported asset that includes texture that prevents me from changing them by code?
I tried the following as well.
I manually changed the texture to the image i wanted.
Then in code i printed out the path with mytexture.getAttribute(octane.A_FILENAME) and i could see it pointing to the image in question.
in the following code row i did mytexture.setAttribute(octane.A_FILENAME, (with the path to the same image as I got above), true) but then I got the error.
Attached error message in case that can help to figure out whats wrong.
EDIT:
I tried this.
currentTextureNode:setAttribute(octane.A_FILENAME,currentTextureNode:getAttribute(octane.A_FILENAME), true)
That is to set path to same at it was already and that works so it does not seems to be anything preventing me prom setting the path.
If I look at the path it has to begin with and been set back to again it is, "assets\imagename.jpg"
The image I try to set is something like c:/xx/image.jpg
So it's a absolute path in the problem case and a relative in the case that works.
Is that the problem and how do I solve it?
EDIT:
OK, I can se that there is a A_PACKAGE attribute in the texture.
So how do I set it back to not use Package and just a file.