File tree Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -1947,10 +1947,12 @@ def get_all_camera_light_data(no_animation=False):
1947
1947
}
1948
1948
for light in lights :
1949
1949
light_data = get_light_data (light )
1950
- frame_lights .append (light_data )
1950
+ if light_data :
1951
+ frame_lights .append (light_data )
1951
1952
for camera in cameras :
1952
1953
camera_data = get_camera_data (camera )
1953
- frame_cameras .append (camera_data )
1954
+ if camera_data :
1955
+ frame_cameras .append (camera_data )
1954
1956
all_data .append (frame_data )
1955
1957
else :
1956
1958
time , frame = begin_timeline_scan ()
@@ -2103,13 +2105,14 @@ def get_light_data(light: RILight):
2103
2105
dir_light : RIDirectionalLight = None
2104
2106
point_light : RIPointLight = None
2105
2107
light_type = "NONE"
2106
- if type (light ) is RISpotLight :
2108
+ T = type (light )
2109
+ if T is RISpotLight :
2107
2110
spot_light = light
2108
2111
light_type = "SPOT"
2109
- elif type ( light ) is RIPointLight :
2112
+ elif T is RIPointLight :
2110
2113
point_light = light
2111
2114
light_type = "POINT"
2112
- elif type ( light ) is RIDirectionalLight :
2115
+ elif T is RIDirectionalLight :
2113
2116
dir_light = light
2114
2117
light_type = "DIR"
2115
2118
else :
@@ -2200,6 +2203,9 @@ def get_light_data(light: RILight):
2200
2203
2201
2204
2202
2205
def get_camera_data (camera : RICamera ):
2206
+ T = type (camera )
2207
+ if T is not RICamera :
2208
+ return None
2203
2209
link_id = get_link_id (camera , add_if_missing = True )
2204
2210
name = camera .GetName ()
2205
2211
time = RGlobal .GetTime ()
Original file line number Diff line number Diff line change @@ -964,7 +964,9 @@ def export_extra_data(self):
964
964
root_json = json_data .get_root_json ()
965
965
966
966
if self .light :
967
- root_json ["Object" ][self .character_id ]["Light" ] = cc .get_light_data (self .light )
967
+ light_data = cc .get_light_data (self .light )
968
+ if light_data :
969
+ root_json ["Object" ][self .character_id ]["Light" ] = light_data
968
970
969
971
if json_data is None :
970
972
utils .log_error ("No valid json data could be found for the export ..." )
Original file line number Diff line number Diff line change @@ -2897,7 +2897,8 @@ def encode_pose_frame_data(self, actors: list):
2897
2897
2898
2898
# pack animateable light data
2899
2899
light_data = cc .get_light_data (actor .object )
2900
- data += struct .pack ("!?fffffffff" ,
2900
+ if light_data :
2901
+ data += struct .pack ("!?fffffffff" ,
2901
2902
light_data ["active" ],
2902
2903
light_data ["color" ][0 ],
2903
2904
light_data ["color" ][1 ],
@@ -2913,7 +2914,8 @@ def encode_pose_frame_data(self, actors: list):
2913
2914
2914
2915
# pack animateable camera data
2915
2916
camera_data = cc .get_camera_data (actor .object )
2916
- data += struct .pack ("!f?fffffff" ,
2917
+ if camera_data :
2918
+ data += struct .pack ("!f?fffffff" ,
2917
2919
camera_data ["focal_length" ],
2918
2920
camera_data ["dof_enable" ],
2919
2921
camera_data ["dof_focus" ], # Focus Distance
@@ -2983,7 +2985,8 @@ def get_lights_data(self, actors):
2983
2985
for actor in actors :
2984
2986
if actor .is_light ():
2985
2987
light_data = cc .get_light_data (actor .get_light ())
2986
- data ["lights" ].append (light_data )
2988
+ if light_data :
2989
+ data ["lights" ].append (light_data )
2987
2990
2988
2991
return data
2989
2992
You can’t perform that action at this time.
0 commit comments