@@ -1143,30 +1143,20 @@ def get_export_objects(chr_cache, include_selected = True, only_objects=None):
11431143 if obj .parent == arm :
11441144 utils .unhide (obj )
11451145 if obj not in objects :
1146+ utils .log_info (f" Found Character Object: { obj .name } " )
11461147 objects .append (obj )
11471148
11481149 child_objects = utils .get_child_objects (arm )
11491150 for obj in child_objects :
11501151 if utils .object_exists_is_mesh (obj ):
1151- # exclude rigid body colliders (parented to armature)
1152- if collider_collection and obj .name in collider_collection .objects :
1153- utils .log_info (f" Excluding Rigidbody Collider Object: { obj .name } " )
1154- continue
1155- # exclude collider proxies
1156- if chr_cache .is_collision_object (obj ):
1157- utils .log_info (f" Excluding Collider Proxy Object: { obj .name } " )
1158- continue
1159- # exclude sculpt objects
1160- if chr_cache .is_sculpt_object (obj ):
1161- utils .log_info (f" Excluding Sculpt Object: { obj .name } " )
1162- continue
11631152 # add child mesh objects
11641153 if obj not in objects :
1165- utils .log_info (f" Including Child Mesh Object: { obj .name } " )
1154+ utils .log_info (f" Found Child Mesh Object: { obj .name } " )
11661155 objects .append (obj )
11671156 elif utils .object_exists_is_empty (obj ):
1168- utils .log_info (f" Including Child Empty Transform: { obj .name } " )
1157+ utils .log_info (f" Found Child Empty Transform: { obj .name } " )
11691158 objects .append (obj )
1159+
11701160 else :
11711161 arm = utils .get_armature_from_objects (objects )
11721162 if arm :
@@ -1178,14 +1168,10 @@ def get_export_objects(chr_cache, include_selected = True, only_objects=None):
11781168 for obj in child_objects :
11791169 if utils .object_exists_is_mesh (obj ):
11801170 if obj not in objects :
1181- # exclude rigid body colliders (parented to armature)
1182- if collider_collection and obj .name in collider_collection .objects :
1183- utils .log_info (f" Excluding Rigidbody Collider Object: { obj .name } " )
1184- continue
1185- utils .log_info (f" Including Child Object: { obj .name } " )
1171+ utils .log_info (f" Found Child Object: { obj .name } " )
11861172 objects .append (obj )
11871173 elif utils .object_exists_is_empty (obj ):
1188- utils .log_info (f" Including Child Empty Transform: { obj .name } " )
1174+ utils .log_info (f" Found Child Empty Transform: { obj .name } " )
11891175 objects .append (obj )
11901176
11911177 # include selected objects last
@@ -1194,6 +1180,27 @@ def get_export_objects(chr_cache, include_selected = True, only_objects=None):
11941180 if obj not in objects :
11951181 objects .append (obj )
11961182
1183+ # exclude non-exportable objects
1184+ to_remove = []
1185+ for obj in objects :
1186+ # exclude rigid body colliders (parented to armature)
1187+ if collider_collection and obj .name in collider_collection .objects :
1188+ utils .log_info (f" Excluding Rigidbody Collider Object: { obj .name } " )
1189+ to_remove .append (obj )
1190+ continue
1191+ # exclude collider proxies
1192+ if chr_cache and chr_cache .is_collision_object (obj ):
1193+ utils .log_info (f" Excluding Collider Proxy Object: { obj .name } " )
1194+ to_remove .append (obj )
1195+ continue
1196+ # exclude sculpt objects
1197+ if chr_cache and chr_cache .is_sculpt_object (obj ):
1198+ utils .log_info (f" Excluding Sculpt Object: { obj .name } " )
1199+ to_remove .append (obj )
1200+ continue
1201+ for o in to_remove :
1202+ objects .remove (o )
1203+
11971204 # make sure all export objects are valid
11981205 clean_objects = [ obj for obj in objects
11991206 if utils .object_exists (obj ) and
@@ -1775,6 +1782,7 @@ def export_standard(self, context, chr_cache, file_path, include_selected):
17751782
17761783 # store mode state
17771784 mode_selection_state = utils .store_mode_selection_state ()
1785+ rv_state = utils .store_render_visibility_state ()
17781786
17791787 utils .log_info ("Export to: " + file_path )
17801788 utils .log_info ("Exporting as: " + ext )
@@ -1885,6 +1893,7 @@ def export_standard(self, context, chr_cache, file_path, include_selected):
18851893
18861894 # restore mode state
18871895 utils .restore_mode_selection_state (mode_selection_state )
1896+ utils .restore_render_visibility_state (rv_state )
18881897
18891898 utils .log_recess ()
18901899 utils .log_timer ("Done Character Export." )
@@ -1911,6 +1920,7 @@ def export_non_standard(self, context, file_path, include_selected):
19111920
19121921 # store mode state
19131922 mode_selection_state = utils .store_mode_selection_state ()
1923+ rv_state = utils .store_render_visibility_state ()
19141924
19151925 # export objects
19161926 objects = get_export_objects (None , include_selected )
@@ -1969,6 +1979,7 @@ def export_non_standard(self, context, file_path, include_selected):
19691979
19701980 # restore mode state
19711981 utils .restore_mode_selection_state (mode_selection_state )
1982+ utils .restore_render_visibility_state (rv_state )
19721983
19731984 utils .log_recess ()
19741985 if arp_export :
@@ -2004,6 +2015,7 @@ def export_to_unity(self, context, chr_cache, export_anim, file_path, include_se
20042015
20052016 # store mode state
20062017 mode_selection_state = utils .store_mode_selection_state ()
2018+ rv_state = utils .store_render_visibility_state ()
20072019
20082020 utils .log_info ("Export to: " + file_path )
20092021 utils .log_info ("Exporting as: " + ext )
@@ -2117,6 +2129,7 @@ def export_to_unity(self, context, chr_cache, export_anim, file_path, include_se
21172129 bones .restore_armature_settings (arm , armature_settings , include_pose = True )
21182130 # restore mode state
21192131 utils .restore_mode_selection_state (mode_selection_state )
2132+ utils .restore_render_visibility_state (rv_state )
21202133
21212134 utils .log_recess ()
21222135 utils .log_timer ("Done Character Export." )
@@ -2220,6 +2233,7 @@ def export_rigify(self, context, chr_cache, export_anim, file_path, include_sele
22202233
22212234 # store mode state
22222235 mode_selection_state = utils .store_mode_selection_state ()
2236+ rv_state = utils .store_render_visibility_state ()
22232237
22242238 utils .log_info ("Export to: " + file_path )
22252239 utils .log_info ("Exporting as: " + ext )
@@ -2337,6 +2351,7 @@ def export_rigify(self, context, chr_cache, export_anim, file_path, include_sele
23372351
23382352 # restore mode state
23392353 utils .restore_mode_selection_state (mode_selection_state )
2354+ utils .restore_render_visibility_state (rv_state )
23402355
23412356 utils .log_recess ()
23422357 utils .log_timer ("Done Rigify Export." )
@@ -2603,7 +2618,9 @@ def invoke(self, context, event):
26032618 require_valid_export = (self .param == "EXPORT_CC3" or
26042619 self .param == "EXPORT_NON_STANDARD" )
26052620 if require_export_check :
2621+ rv_state = utils .store_render_visibility_state ()
26062622 objects = get_export_objects (chr_cache , self .include_selected )
2623+ utils .restore_render_visibility_state (rv_state )
26072624 if export_format == "fbx" :
26082625 self .check_valid , self .check_warn , self .check_report = check_valid_export_fbx (chr_cache , objects )
26092626 if require_valid_export :
0 commit comments