[Durian-svn] [4122] fix for replacing texture node images
campbell
institute at blender.org
Sun May 30 17:37:56 CEST 2010
Revision: 4122
https://blenderinstitute.dyndns.org/durian-svn/?do=log&project=durian&path=/&rev=4122
Author: campbell
Date: 2010-05-30 17:37:56 +0200 (Sun, 30 May 2010)
Log Message:
-----------
fix for replacing texture node images
Modified Paths:
--------------
pro/scripts/utilities/findPathError.py
Modified: pro/scripts/utilities/findPathError.py
===================================================================
--- pro/scripts/utilities/findPathError.py 2010-05-30 15:30:20 UTC (rev 4121)
+++ pro/scripts/utilities/findPathError.py 2010-05-30 15:37:56 UTC (rev 4122)
@@ -66,6 +66,36 @@
return image_dupes
+def replace_image(i, base_image):
+ for tex in bpy.data.textures:
+ if tex.library:
+ continue
+
+ if not tex.node_tree == None:
+ for n in tex.node_tree.nodes:
+ node_type = getattr(n, "type", '') # BLENDER BUG. some texture nodes have no type
+ if node_type == 'IMAGE':
+ if n.image == i:
+ n.image = base_image
+ change = 1
+ print('fixed the image')
+
+ if tex.type == 'IMAGE':
+ if tex.image == i:
+ tex.image = base_image
+ change = 1
+
+ for me in bpy.data.meshes:
+ if me.library:
+ continue
+
+ for uvlay in me.uv_textures:
+ for tf in uvlay.data:
+ if tf.image == i:
+ tf.image = base_image
+ change = 1
+ return change
+
def merge_duplicates():
image_dupes = image_duplicates()
@@ -77,33 +107,8 @@
base_image = value[0]
if len(value) > 1:
for i in value[1:]:
- for tex in bpy.data.textures:
- if tex.library:
- continue
+ change |= replace_image(i, base_image)
- if not tex.node_tree == None:
- for n in tex.node_tree.nodes:
- if n.name == 'Image':
- if n.type == 'IMAGE':
- if n.image == i:
- n.image = base_image
- change = 1
- print('fixed the image')
-
- if tex.type == 'IMAGE':
- if tex.image == i:
- tex.image = base_image
- change = 1
-
- for me in bpy.data.meshes:
- if me.library:
- continue
-
- for uvlay in me.uv_textures:
- for tf in uvlay.data:
- if tf.image == i:
- tf.image = base_image
- change = 1
return change
def report_images():
@@ -152,6 +157,8 @@
if not exists(filename_abs):
print("ERROR PATH:", obj.name, filename, 'ABS:', filename_abs, "(OBJECT MODIFIER)")
+ else:
+ print("PACKED PATH:", obj.name, "(OBJECT MODIFIER)")
def report_drivers():
for attr in dir(bpy.data):
@@ -295,7 +302,7 @@
#change |= make_relative()
#change |= clear_images(rem_missing = True)
#change |= merge_duplicates()
- change |= clear_actions()
+ #change |= clear_actions()
print("Changing??? ", change)
if change:
More information about the Durian-svn
mailing list