@@ -952,9 +952,11 @@ def read_track_angle(track_chunk):
952
952
links .new (bitmap_mix .outputs [0 ], nodes ['Background' ].inputs [0 ])
953
953
links .new (bitmapnode .outputs [0 ], bitmap_mix .inputs [1 ])
954
954
links .new (bitmapping .outputs [0 ], bitmapnode .inputs [0 ])
955
- if coordinates and not bitmapping .inputs ['Vector' ].is_linked :
955
+ if not coordinates :
956
+ coordinates = nodes .new (type = 'ShaderNodeTexCoord' )
957
+ coordinates .location = (- 1200 , 260 )
958
+ if not bitmapping .inputs ['Vector' ].is_linked :
956
959
links .new (coordinates .outputs [0 ], bitmapping .inputs [0 ])
957
- links .new (coordinates .outputs [2 ], bitmapping .inputs [1 ])
958
960
new_chunk .bytes_read += read_str_len
959
961
960
962
# If gradient chunk:
@@ -990,7 +992,6 @@ def read_track_angle(track_chunk):
990
992
links .new (gradientnode .outputs [0 ], nodes ['Background' ].inputs [0 ])
991
993
if mappingnode and not mappingnode .inputs ['Vector' ].is_linked :
992
994
links .new (coordinate .outputs [0 ], mappingnode .inputs [0 ])
993
- links .new (coordinate .outputs [2 ], mappingnode .inputs [1 ])
994
995
gradientnode .color_ramp .elements .new (read_float (new_chunk ))
995
996
read_chunk (file , temp_chunk )
996
997
if temp_chunk .ID == COLOR_F :
@@ -1237,15 +1238,22 @@ def read_track_angle(track_chunk):
1237
1238
gobo_name , read_str_len = read_string (file )
1238
1239
new_chunk .bytes_read += read_str_len
1239
1240
projection = nodes .new (type = 'ShaderNodeTexImage' )
1240
- projection .label = gobo_name
1241
- projection .location = (- 480 , 420 )
1241
+ promapping = nodes .new (type = 'ShaderNodeMapping' )
1242
+ protxcoord = nodes .new (type = 'ShaderNodeTexCoord' )
1243
+ projection .label = "Gobo: " + gobo_name
1244
+ protxcoord .label = "Gobo Coordinate"
1245
+ projection .location = (- 480 , 440 )
1246
+ promapping .location = (- 720 , 440 )
1247
+ protxcoord .location = (- 940 , 400 )
1242
1248
projection .image = load_image (gobo_name , dirname , place_holder = False , recursive = IMAGE_SEARCH , check_existing = True )
1243
1249
emitnode = next ((node for node in nodes if node .type == 'EMISSION' ), False )
1244
1250
emit = emitnode if emitnode else nodes .new (type = 'ShaderNodeEmission' )
1245
1251
emit .label = "Projector"
1246
1252
emit .location = (80 , 300 )
1247
1253
emit .inputs [0 ].default_value [:3 ] = mix .inputs [2 ].default_value [:3 ] = rgb .outputs [0 ].default_value [:3 ] = contextLamp .data .color
1248
1254
links .new (emit .outputs [0 ], nodes ['Light Output' ].inputs [0 ])
1255
+ links .new (promapping .outputs [0 ] ,projection .inputs [0 ])
1256
+ links .new (protxcoord .outputs [2 ] ,promapping .inputs [0 ])
1249
1257
links .new (projection .outputs [0 ], mix .inputs [1 ])
1250
1258
links .new (mix .outputs [0 ], emit .inputs [0 ])
1251
1259
links .new (rgb .outputs [0 ], mix .inputs [2 ])
@@ -1414,21 +1422,19 @@ def read_track_angle(track_chunk):
1414
1422
child .data .color = read_track_data (new_chunk )[0 ]
1415
1423
child .data .use_nodes = True
1416
1424
tree = child .data .node_tree
1417
- emitnode = next ((nd for nd in tree .nodes if nd .type == 'EMISSION' ), False )
1425
+ emitnode = tree .nodes .get ("Emission" )
1426
+ emitnode .inputs [0 ].default_value [:3 ] = child .data .color
1418
1427
colornode = next ((nd for nd in tree .nodes if nd .type == 'RGB' ), False )
1419
- if emitnode :
1420
- emitnode .inputs [0 ].default_value [:3 ] = child .data .color
1421
- if colornode :
1422
- colornode .outputs [0 ].default_value [:3 ] = child .data .color
1428
+ if not colornode :
1429
+ colornode = tree .nodes .new ('ShaderNodeRGB' )
1430
+ colornode .location = (- 380 , 100 )
1431
+ tree .links .new (colornode .outputs [0 ], emitnode .inputs [0 ])
1432
+ colornode .outputs [0 ].default_value [:3 ] = child .data .color
1423
1433
for keydata in keyframe_data .items ():
1424
1434
child .data .color = keydata [1 ]
1425
1435
child .data .keyframe_insert (data_path = "color" , frame = keydata [0 ])
1426
- if emitnode :
1427
- emitnode .inputs [0 ].default_value [:3 ] = keydata [1 ]
1428
- tree .keyframe_insert (data_path = "nodes[\" Emission\" ].inputs[0].default_value" , frame = keydata [0 ])
1429
- if colornode :
1430
- colornode .outputs [0 ].default_value [:3 ] = keydata [1 ]
1431
- tree .keyframe_insert (data_path = "nodes[\" RGB\" ].outputs[0].default_value" , frame = keydata [0 ])
1436
+ colornode .outputs [0 ].default_value [:3 ] = keydata [1 ]
1437
+ tree .keyframe_insert (data_path = "nodes[\" RGB\" ].outputs[0].default_value" , frame = keydata [0 ])
1432
1438
contextTrack_flag = False
1433
1439
1434
1440
elif KEYFRAME and new_chunk .ID == POS_TRACK_TAG and tracktype == 'OBJECT' : # Translation
0 commit comments