-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.py
54 lines (42 loc) · 1.85 KB
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import bpy
from .shapekey import (
update_active_collection_shapekeys,
update_all_collection_shapekeys,
)
exclusive_active_update_setting_items = False
exclusive_all_update_setting_items = False
def remove_invalid_collection_settings(context: bpy.types.Context) -> None:
if context and context.scene.yfx_exporter_settings:
export_settings = context.scene.yfx_exporter_settings.export_settings
items = export_settings.collections
remove_indices = [
i
for i, item in enumerate(items)
if item is None or item.collection_ptr is None
]
for i in remove_indices:
items.remove(i)
current_index = export_settings.collection_index
export_settings.collection_index = max(
0,
current_index - len(remove_indices),
)
def update_active_setting_items(
self: bpy.types.AnyType,
context: bpy.types.Context,
) -> None:
if context and context.scene.yfx_exporter_settings:
global exclusive_active_update_setting_items # noqa: PLW0603
if exclusive_active_update_setting_items is False:
exclusive_active_update_setting_items = True
remove_invalid_collection_settings(context)
update_active_collection_shapekeys(context)
exclusive_active_update_setting_items = False
def update_all_setting_items(context: bpy.types.Context) -> None:
if context and context.scene.yfx_exporter_settings:
global exclusive_all_update_setting_items # noqa: PLW0603
if exclusive_all_update_setting_items is False:
exclusive_all_update_setting_items = True
remove_invalid_collection_settings(context)
update_all_collection_shapekeys(context)
exclusive_all_update_setting_items = False