-
-
Save bdancer/980e49f20b1fd09f8518 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
def ResovleNtreeData(): | |
texPrefix = { | |
'VRayNodeTexGradRamp' : ".Ramp_", | |
'VRayNodeTexRemap' : ".Ramp_", | |
'VRayNodeBitmapBuffer' : ".Bitmap_", | |
} | |
for ma in bpy.data.materials: | |
maName = ma.name | |
if ma.vray.ntree: | |
continue | |
if maName in bpy.data.node_groups: | |
ma.vray.ntree = bpy.data.node_groups[maName] | |
for ob in bpy.context.scene.objects: | |
obName = ob.name | |
if ob.vray.ntree: | |
continue | |
if obName in bpy.data.node_groups: | |
ob.vray.ntree = bpy.data.node_groups[obName] | |
for nt in bpy.data.node_groups: | |
for n in nt.nodes: | |
if not hasattr(n, 'texture'): | |
continue | |
if n.texture: | |
# Just in case | |
n.texture.use_fake_user = True | |
continue | |
texName = texPrefix[n.bl_idname] + n.name | |
if texName in bpy.data.textures: | |
n.texture = bpy.data.textures[texName] | |
n.texture.use_fake_user = True | |
if __name__ == '__main__': | |
ResovleNtreeData() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment