maur_2005 opened this issue on Jan 09, 2020 ยท 5 posts
adp001 posted Thu, 09 January 2020 at 3:16 PM
Sure, you need to know something about the image you want to change. A path or filename will do if it is unique.
Here is a sample-search:
try:
# I need to do this to make my editor happy
import poser
except ImportError:
poser = None
import re
def find_image(node, name="Image_Source", value="myImage.*"):
if node is None:
return None
if node.Type() == poser.kNodeTypeCodeIMAGEMAP:
test = re.compile(value)
for inp in node.Inputs():
v = inp.Value()
if isinstance(v, basestring) and test.search(v):
return node
result = find_image(inp.InNode())
if result is not None:
return result
return None
sc = poser.Scene()
for mat in sc.CurrentFigure().Materials():
for shadernode in mat.ShaderTree().Nodes():
# change value to what should be part of the
# path you search for
node = find_image(shadernode, value="Mask")
if node is not None:
print node.Name()
print node.InputByInternalName("Image_Source").Value()
This should give you an idea how to solve your problem.