-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathproperties.py
3311 lines (2792 loc) · 136 KB
/
properties.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# BEGIN LICENSE & COPYRIGHT BLOCK.
#
# Copyright (C) 2022-2024 Kiril Strezikozin
# BakeMaster Blender Add-on (version 2.7.0)
#
# This file is a part of BakeMaster Blender Add-on, a plugin for texture
# baking in open-source Blender 3d modelling software.
# The author can be contacted at <[email protected]>.
#
# Redistribution and use for any purpose including personal, educational, and
# commercial, with or without modification, are permitted provided
# that the following conditions are met:
#
# 1. The current acquired License allows copies/redistributions of this
# software be made to UNLIMITED END USER SEATS (OPEN SOURCE LICENSE).
# 2. Redistributions of this source code or partial usage of this source code
# must follow the terms of this license and retain the above copyright
# notice, and the following disclaimer.
# 3. The name of the author may be used to endorse or promote products derived
# from this software. In such a case, a prior written permission from the
# author is required.
#
# This program is free software and is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE
# AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# You should have received a copy of the GNU General Public License in the
# GNU.txt file along with this program. If not,
# see <http://www.gnu.org/licenses/>.
#
# END LICENSE & COPYRIGHT BLOCK.
import bpy
from .utils import *
from .labels import BM_Labels
#################################################
### Apply Lastly Edited Prop Props ###
#################################################
class BM_ALEP_Object(bpy.types.PropertyGroup):
object_name : bpy.props.StringProperty(
name="Object name",
default="")
use_affect : bpy.props.BoolProperty(
name="Apply",
description="Apply property for this object",
default=True)
class BM_ALEP_Map(bpy.types.PropertyGroup):
map_name : bpy.props.StringProperty(
name="Map name",
default="")
use_affect : bpy.props.BoolProperty(
name="Apply",
description="Apply property for this map",
default=True)
class BM_CAUC_Object(bpy.types.PropertyGroup):
object_name : bpy.props.StringProperty(
name="Object name",
default="")
use_include : bpy.props.BoolProperty(
name="Inlcude as Lowpoly",
description="Include this object as a regular or Lowpoly Object in new Artificial Container",
default=False,
update=BM_CAUC_Object_use_include_Update)
is_highpoly : bpy.props.BoolProperty(
name="Include as Highpoly",
description="Include this object as a Highpoly Object in new Artificial Container",
default=False,
update=BM_CAUC_Object_is_highpoly_Update)
is_cage : bpy.props.BoolProperty(
name="Include as Cage",
description="Include this object as a Highpoly Object in new Artificial Container",
default=False,
update=BM_CAUC_Object_is_cage_Update)
class BM_FMR_Item(bpy.types.PropertyGroup):
image_name : bpy.props.StringProperty(
name="Image Texture name",
default="Image")
socket_and_node_name : bpy.props.StringProperty(
name="Plugged into",
default="*Not plugged*")
image_res : bpy.props.StringProperty(
name="Resolution",
default="")
image_height : bpy.props.IntProperty(default=1)
image_width : bpy.props.IntProperty(default=1)
#################################################
### GLOBAL SCENE PROPS ###
#################################################
class BM_SceneProps_TextureSet_Object_SubObject(bpy.types.PropertyGroup):
global_object_name : bpy.props.StringProperty(
name="Container's Lowpoly Object")
global_object_index : bpy.props.IntProperty()
global_object_include_in_texset : bpy.props.BoolProperty(
name="Include in Texture Set",
description="Include Container's Lowpoly Object in the current Texture Set",
default=True)
global_source_object_index : bpy.props.IntProperty(default=-1)
class BM_SceneProps_TextureSet_Object(bpy.types.PropertyGroup):
global_object_name : bpy.props.EnumProperty(
name="Choose Object",
description="Object from BakeMaster Table of Objects to inlcude in the current Texture Set.\nIf Container's chosen, all it's lowpoly objects will be added to the Texture Set",
items=BM_TEXSET_OBJECT_PROPS_global_object_name_Items,
update=BM_TEXSET_OBJECT_PROPS_global_object_name_Update)
global_object_index : bpy.props.IntProperty()
global_source_object_index : bpy.props.IntProperty(default=-1)
global_object_name_old : bpy.props.StringProperty(default='-1')
global_object_name_include : bpy.props.StringProperty()
global_object_name_subitems_active_index : bpy.props.IntProperty(
name="Container's Lowpoly Object")
global_object_name_subitems : bpy.props.CollectionProperty(type=BM_SceneProps_TextureSet_Object_SubObject)
class BM_SceneProps_TextureSet(bpy.types.PropertyGroup):
global_textureset_name : bpy.props.StringProperty(
name="Texture Set Name.\nTexture Set is a set of objects that share the same image texture file for each map",
default="Texture Set")
global_textureset_index : bpy.props.IntProperty()
uvp_use_uv_repack : bpy.props.BoolProperty(
name="UV Repack",
description="Enable UV Repacking for Texture Set Objects.\nWarning: if Objects have materials that depend on UV Layout, enabling this option might change the result of these materials",
default=False)
uvp_use_islands_rotate : bpy.props.BoolProperty(
name="Rotate",
description="Rotate islands for best fit",
default=False)
uvp_pack_margin : bpy.props.FloatProperty(
name="Margin",
description="Space between packed islands",
default=0.01,
min=0.0,
max=1.0)
uvp_use_average_islands_scale : bpy.props.BoolProperty(
name="Average Islands Scale",
description="Average the size of separate UV islands, based on their area in 3D space. It is recommended to apply object(s) scale beforehand",
default=True)
global_textureset_naming : bpy.props.EnumProperty(
name="Naming",
description="Choose output Image texture naming format",
default='TEXSET_NAME',
items=[('EACH_OBJNAME', "Each Object Name", "Include each texture set object name in the output texture set image"),
('TEXSET_INDEX', "Texture Set Index", "Name output texture set image in the format: TextureSet_index"),
('TEXSET_NAME', "Texture Set Name", "Output texture name will be as Texture Set name")])
global_textureset_table_of_objects : bpy.props.CollectionProperty(type=BM_SceneProps_TextureSet_Object)
global_textureset_table_of_objects_active_index : bpy.props.IntProperty(
name="Object",
default=0)
class BM_SceneProps(bpy.types.PropertyGroup):
global_active_index : bpy.props.IntProperty(
name="Mesh Object to bake maps for",
default=0,
update=BM_ActiveIndexUpdate)
# Name Matching
global_use_name_matching : bpy.props.BoolProperty(
name="Toggle Name Matching",
description="If on, High, Lowpoly, and Cage objects will be grouped by their matched names.\nProperties like Highpoly object and Cage will be set automatically if possible, maps and other settings can be configured by the top-parent container",
default=False,
update=BM_SCENE_PROPS_global_use_name_matching_Update)
# Color Management
cm_color_space : bpy.props.EnumProperty(
name="Color Space",
description="Baked textures Color Space. Bake won't be able to proceed if none of these color spaces are available",
items=BM_SCENE_PROPS_cm_color_space_Items)
# Texture settings
cm_aces_texture_color_space : bpy.props.EnumProperty(
name="Color",
description="Color Space of baked color textures containing color data (e.g. Diffuse, Albedo, Base Color, ColorIDs maps etc.)",
items=BM_SCENE_PROPS_cm_texture_color_space_Items)
cm_aces_texture_color_space_custom: bpy.props.StringProperty(
name="Custom Color",
description="Enter custom Color Space for baked color textures",
default="")
cm_aces_texture_file_format : bpy.props.EnumProperty(
name="File Format",
description="Default image file format for color textures",
items=BM_SCENE_PROPS_texture_file_format_Items,
update=BM_SCENE_PROPS_cm_aces_texture_file_format_Update)
cm_aces_texture_bit_depth : bpy.props.EnumProperty(
name="Color Depth",
description="Default image color depth for color textures",
items=BM_SCENE_PROPS_cm_aces_texture_bit_depth_Items)
cm_aces_data_color_space : bpy.props.EnumProperty(
name="Data",
description="Color Space of baked data textures containing non-color data (e.g. Normal, Metalness, Roughness, Displacement, AO maps etc.)",
items=BM_SCENE_PROPS_cm_data_color_space_Items)
cm_aces_data_color_space_custom: bpy.props.StringProperty(
name="Custom Data",
description="Enter custom Color Space for baked data textures",
default="")
cm_aces_data_file_format : bpy.props.EnumProperty(
name="File Format",
description="Default image file format for data textures",
items=BM_SCENE_PROPS_data_file_format_Items,
update=BM_SCENE_PROPS_cm_aces_data_file_format_Update)
cm_aces_data_bit_depth : bpy.props.EnumProperty(
name="Color Depth",
description="Default image color depth for data textures",
items=BM_SCENE_PROPS_cm_aces_data_bit_depth_Items)
cm_aces_linear_color_space : bpy.props.EnumProperty(
name="Linear",
description="Color Space of baked data textures containing linear color data. Used for EXR file formats if Linear EXR is ticked below",
items=BM_SCENE_PROPS_cm_linear_color_space_Items)
cm_aces_linear_color_space_custom: bpy.props.StringProperty(
name="Custom Linear",
description="Enter custom Color Space for baked linear textures",
default="")
cm_aces_linear_file_format : bpy.props.EnumProperty(
name="File Format",
description="Default image file format for linear textures",
items=BM_SCENE_PROPS_linear_file_format_Items,
update=BM_SCENE_PROPS_cm_aces_linear_file_format_Update)
cm_aces_linear_bit_depth : bpy.props.EnumProperty(
name="Color Depth",
description="Default image color depth for linear textures",
items=BM_SCENE_PROPS_cm_aces_linear_bit_depth_Items)
cm_srgb_texture_color_space : bpy.props.EnumProperty(
name="Color",
description="Color Space of baked color textures containing color data (e.g. Diffuse, Albedo, Base Color, ColorIDs maps etc.)",
items=BM_SCENE_PROPS_cm_texture_color_space_Items)
cm_srgb_texture_color_space_custom: bpy.props.StringProperty(
name="Custom Color",
description="Enter custom Color Space for baked color textures",
default="")
cm_srgb_texture_file_format : bpy.props.EnumProperty(
name="File Format",
description="Default image file format for color textures",
items=BM_SCENE_PROPS_texture_file_format_Items,
update=BM_SCENE_PROPS_cm_srgb_texture_file_format_Update)
cm_srgb_texture_bit_depth : bpy.props.EnumProperty(
name="Color Depth",
description="Default image color depth for color textures",
items=BM_SCENE_PROPS_cm_srgb_texture_bit_depth_Items)
cm_srgb_data_color_space : bpy.props.EnumProperty(
name="Data",
description="Color Space of baked data textures containing non-color data (e.g. Normal, Metalness, Roughness, Displacement, AO maps etc.)",
items=BM_SCENE_PROPS_cm_data_color_space_Items)
cm_srgb_data_color_space_custom: bpy.props.StringProperty(
name="Custom Data",
description="Enter custom Color Space for baked data textures",
default="")
cm_srgb_data_file_format : bpy.props.EnumProperty(
name="File Format",
description="Default image file format for data textures",
items=BM_SCENE_PROPS_data_file_format_Items,
update=BM_SCENE_PROPS_cm_srgb_data_file_format_Update)
cm_srgb_data_bit_depth : bpy.props.EnumProperty(
name="Color Depth",
description="Default image color depth for data textures",
items=BM_SCENE_PROPS_cm_srgb_data_bit_depth_Items)
cm_srgb_linear_color_space : bpy.props.EnumProperty(
name="Linear",
description="Color Space of baked data textures containing linear color data. Used for EXR file formats if Linear EXR is ticked below",
items=BM_SCENE_PROPS_cm_linear_color_space_Items)
cm_srgb_linear_color_space_custom: bpy.props.StringProperty(
name="Custom Linear",
description="Enter custom Color Space for baked linear textures",
default="")
cm_srgb_linear_file_format : bpy.props.EnumProperty(
name="File Format",
description="Default image file format for linear textures",
items=BM_SCENE_PROPS_linear_file_format_Items,
update=BM_SCENE_PROPS_cm_srgb_linear_file_format_Update)
cm_srgb_linear_bit_depth : bpy.props.EnumProperty(
name="Color Depth",
description="Default image color depth for linear textures",
items=BM_SCENE_PROPS_cm_srgb_linear_bit_depth_Items)
cm_xyz_texture_color_space : bpy.props.EnumProperty(
name="Color",
description="Color Space of baked color textures containing color data (e.g. Diffuse, Albedo, Base Color, ColorIDs maps etc.)",
items=BM_SCENE_PROPS_cm_texture_color_space_Items)
cm_xyz_texture_color_space_custom: bpy.props.StringProperty(
name="Custom Color",
description="Enter custom Color Space for baked color textures",
default="")
cm_xyz_texture_file_format : bpy.props.EnumProperty(
name="File Format",
description="Default image file format for color textures",
items=BM_SCENE_PROPS_texture_file_format_Items,
update=BM_SCENE_PROPS_cm_xyz_texture_file_format_Update)
cm_xyz_texture_bit_depth : bpy.props.EnumProperty(
name="Color Depth",
description="Default image color depth for color textures",
items=BM_SCENE_PROPS_cm_xyz_texture_bit_depth_Items)
cm_xyz_data_color_space : bpy.props.EnumProperty(
name="Data",
description="Color Space of baked data textures containing non-color data (e.g. Normal, Metalness, Roughness, Displacement, AO maps etc.)",
items=BM_SCENE_PROPS_cm_data_color_space_Items)
cm_xyz_data_color_space_custom: bpy.props.StringProperty(
name="Custom Data",
description="Enter custom Color Space for baked data textures",
default="")
cm_xyz_data_file_format : bpy.props.EnumProperty(
name="File Format",
description="Default image file format for data textures",
items=BM_SCENE_PROPS_data_file_format_Items,
update=BM_SCENE_PROPS_cm_xyz_data_file_format_Update)
cm_xyz_data_bit_depth : bpy.props.EnumProperty(
name="Color Depth",
description="Default image color depth for data textures",
items=BM_SCENE_PROPS_cm_xyz_data_bit_depth_Items)
cm_xyz_linear_color_space : bpy.props.EnumProperty(
name="Linear",
description="Color Space of baked data textures containing linear color data. Used for EXR file formats if Linear EXR is ticked below",
items=BM_SCENE_PROPS_cm_linear_color_space_Items)
cm_xyz_linear_color_space_custom: bpy.props.StringProperty(
name="Custom Linear",
description="Enter custom Color Space for baked linear textures",
default="")
cm_xyz_linear_file_format : bpy.props.EnumProperty(
name="File Format",
description="Default image file format for linear textures",
items=BM_SCENE_PROPS_linear_file_format_Items,
update=BM_SCENE_PROPS_cm_xyz_linear_file_format_Update)
cm_xyz_linear_bit_depth : bpy.props.EnumProperty(
name="Color Depth",
description="Default image color depth for linear textures",
items=BM_SCENE_PROPS_cm_xyz_linear_bit_depth_Items)
cm_default_texture_color_space : bpy.props.EnumProperty(
name="Color",
description="Color Space of baked color textures containing color data (e.g. Diffuse, Albedo, Base Color, ColorIDs maps etc.)",
items=BM_SCENE_PROPS_cm_texture_color_space_Items)
cm_default_texture_color_space_custom: bpy.props.StringProperty(
name="Custom Color",
description="Enter custom Color Space for baked color textures",
default="")
cm_default_texture_file_format : bpy.props.EnumProperty(
name="File Format",
description="Default image file format for color textures",
items=BM_SCENE_PROPS_texture_file_format_Items,
update=BM_SCENE_PROPS_cm_default_texture_file_format_Update)
cm_default_texture_bit_depth : bpy.props.EnumProperty(
name="Color Depth",
description="Default image color depth for color textures",
items=BM_SCENE_PROPS_cm_default_texture_bit_depth_Items)
cm_default_data_color_space : bpy.props.EnumProperty(
name="Data",
description="Color Space of baked data textures containing non-color data (e.g. Normal, Metalness, Roughness, Displacement, AO maps etc.)",
items=BM_SCENE_PROPS_cm_data_color_space_Items)
cm_default_data_color_space_custom: bpy.props.StringProperty(
name="Custom Data",
description="Enter custom Color Space for baked data textures",
default="")
cm_default_data_file_format : bpy.props.EnumProperty(
name="File Format",
description="Default image file format for data textures",
items=BM_SCENE_PROPS_data_file_format_Items,
update=BM_SCENE_PROPS_cm_default_data_file_format_Update)
cm_default_data_bit_depth : bpy.props.EnumProperty(
name="Color Depth",
description="Default image color depth for data textures",
items=BM_SCENE_PROPS_cm_default_data_bit_depth_Items)
cm_default_linear_color_space : bpy.props.EnumProperty(
name="Linear",
description="Color Space of baked data textures containing linear color data. Used for EXR file formats if Linear EXR is ticked below",
items=BM_SCENE_PROPS_cm_linear_color_space_Items)
cm_default_linear_color_space_custom: bpy.props.StringProperty(
name="Custom Linear",
description="Enter custom Color Space for baked linear textures",
default="")
cm_default_linear_file_format : bpy.props.EnumProperty(
name="File Format",
description="Default image file format for linear textures",
items=BM_SCENE_PROPS_linear_file_format_Items,
update=BM_SCENE_PROPS_cm_default_linear_file_format_Update)
cm_default_linear_bit_depth : bpy.props.EnumProperty(
name="Color Depth",
description="Default image color depth for linear textures",
items=BM_SCENE_PROPS_cm_default_linear_bit_depth_Items)
###
cm_use_linear_exr : bpy.props.BoolProperty(
name="Linear EXR",
description="Save OpenEXR images in a Linear color space",
default=True)
cm_use_linear_srgb : bpy.props.BoolProperty(
name="Linear sRGB",
description="Save linear textures in linearized sRGB color space (sRGB without gamma correction). For this to work, set default linear color space for either Color, Data, or Linear texture above",
default=False)
cm_use_apply_scene : bpy.props.BoolProperty(
name="Apply Scene",
description="Apply scene render color management settings configured in the properties tab to all baked textures. For display image formats like PNG, apply view and display transform. For intermediate image formats like OpenEXR, use the default render output color space",
default=False,
update=BM_SCENE_PROPS_cm_use_apply_scene_Update)
cm_use_compositor : bpy.props.BoolProperty(
name="Compositor",
description="Apply Compositor color management to all baked textures",
default=False)
###
p_ln_fullobj: bpy.props.StringProperty(
name="Last used Full Object preset or new preset name",
default="New Preset",
maxlen=64)
p_master_fullobj: bpy.props.StringProperty(
name="Mark as Default",
description="Default preset is automatically executed every time a new item is added",
default="",
maxlen=64)
p_ln_obj: bpy.props.StringProperty(
name="Last used Object preset or new preset name",
default="New Preset",
maxlen=64)
p_master_obj: bpy.props.StringProperty(
name="Mark as Default",
description="Default preset is automatically executed every time a new item is added",
default="",
maxlen=64)
p_ln_decal: bpy.props.StringProperty(
name="Last used Decal preset or new preset name",
default="New Preset",
maxlen=64)
p_master_decal: bpy.props.StringProperty(
name="Mark as Default",
description="Default preset is automatically executed every time a new item is added",
default="",
maxlen=64)
p_ln_hl: bpy.props.StringProperty(
name="Last used High to Lowpoly preset or new preset name",
default="New Preset",
maxlen=64)
p_master_hl: bpy.props.StringProperty(
name="Mark as Default",
description="Default preset is automatically executed every time a new item is added",
default="",
maxlen=64)
p_ln_uv: bpy.props.StringProperty(
name="Last used UV preset or new preset name",
default="New Preset",
maxlen=64)
p_master_uv: bpy.props.StringProperty(
name="Mark as Default",
description="Default preset is automatically executed every time a new item is added",
default="",
maxlen=64)
p_ln_csh: bpy.props.StringProperty(
name="Last used Shading preset or new preset name",
default="New Preset",
maxlen=64)
p_master_csh: bpy.props.StringProperty(
name="Mark as Default",
description="Default preset is automatically executed every time a new item is added",
default="",
maxlen=64)
p_ln_out: bpy.props.StringProperty(
name="Last used Format preset or new preset name",
default="New Preset",
maxlen=64)
p_master_out: bpy.props.StringProperty(
name="Mark as Default",
description="Default preset is automatically executed every time a new item is added",
default="",
maxlen=64)
p_ln_fullmap: bpy.props.StringProperty(
name="Last used Full Map preset or new preset name",
default="New Preset",
maxlen=64)
p_master_fullmap: bpy.props.StringProperty(
name="Mark as Default",
description="Default preset is automatically executed every time a new item is added",
default="",
maxlen=64)
p_ln_map: bpy.props.StringProperty(
name="Last used Map preset or new preset name",
default="New Preset",
maxlen=64)
p_master_map: bpy.props.StringProperty(
name="Mark as Default",
description="Default preset is automatically executed every time a new item is added",
default="",
maxlen=64)
p_ln_chnlp: bpy.props.StringProperty(
name="Last used Channel Pack preset or new preset name",
default="New Preset",
maxlen=64)
p_master_chnlp: bpy.props.StringProperty(
name="Mark as Default",
description="Default preset is automatically executed every time a new item is added",
default="",
maxlen=64)
p_ln_bake: bpy.props.StringProperty(
name="Last used Bake Output preset or new preset name",
default="New Preset",
maxlen=64)
p_master_bake: bpy.props.StringProperty(
name="Mark as Default",
description="Default preset is automatically executed every time a new item is added",
default="",
maxlen=64)
p_ln_cm: bpy.props.StringProperty(
name="Last used Color Management preset or new preset name",
default="New Preset",
maxlen=64)
p_master_cm: bpy.props.StringProperty(
name="Mark as Default",
description="Default preset is automatically executed every time a new item is added",
default="",
maxlen=64)
###
global_last_edited_prop : bpy.props.StringProperty(default="")
global_last_edited_prop_name : bpy.props.StringProperty(default="")
global_last_edited_prop_value : bpy.props.StringProperty(default="")
global_last_edited_prop_type : bpy.props.StringProperty(default="")
global_last_edited_prop_is_map : bpy.props.BoolProperty(default=False)
global_matrestore_instruction: bpy.props.StringProperty(default="")
# Apply Lastly Edited Prop Props
global_alep_objects : bpy.props.CollectionProperty(type=BM_ALEP_Object)
global_alep_objects_active_index : bpy.props.IntProperty(
name="Object",
default=0)
global_alep_maps : bpy.props.CollectionProperty(type=BM_ALEP_Map)
global_alep_maps_active_index : bpy.props.IntProperty(
name="Map",
default=0)
global_alep_affect_objects : bpy.props.BoolProperty(
name="Affect Objects",
description="Apply property to all maps of chosen objects",
default=False)
# Create Artificial Universal Container Props
global_cauc_objects : bpy.props.CollectionProperty(type=BM_CAUC_Object)
global_cauc_objects_active_index : bpy.props.IntProperty(
name="Detached Object",
default=0)
# Format Match Resolution Props
global_fmr_items : bpy.props.CollectionProperty(type=BM_FMR_Item)
global_fmr_items_active_index : bpy.props.IntProperty(
name="Resolution, Image name, Plugged into",
default=0)
# Global Panels Props
global_is_decal_panel_expanded : bpy.props.BoolProperty(
name="Expand/Collapse Decal Settings panel",
default=False)
global_is_hl_panel_expanded : bpy.props.BoolProperty(
name="Expand/Collapse High to Lowpoly Settings panel",
default=False)
global_is_uv_panel_expanded : bpy.props.BoolProperty(
name="Expand/Collapse UV Settings panel",
default=False)
global_is_csh_panel_expanded : bpy.props.BoolProperty(
name="Expand/Collapse Shading Settings panel",
default=False)
global_is_format_panel_expanded : bpy.props.BoolProperty(
name="Expand/Collapse Format Settings panel",
default=False)
global_is_chnlpack_panel_expanded : bpy.props.BoolProperty(
name="Expand/Collapse Channel Packing panel",
default=False)
global_is_bakeoutput_panel_expanded : bpy.props.BoolProperty(
name="Expand/Collapse Bake Output Settings panel",
default=False)
global_is_colormanagement_panel_expanded : bpy.props.BoolProperty(
name="Expand/Collapse Color Management Settings panel",
default=False)
local_is_hl_panel_expanded : bpy.props.BoolProperty(
name="Expand/Collapse High to Lowpoly Settings panel",
default=False)
local_is_uv_panel_expanded : bpy.props.BoolProperty(
name="Expand/Collapse UV Settings panel",
default=False)
local_is_batchname_panel_expanded : bpy.props.BoolProperty(
name="Expand/Collapse Batch Naming panel",
default=False)
# Global Bake-related Props
global_bake_use_save_log : bpy.props.BoolProperty(
name="Save Log",
description="Save log of time used to bake each map and a short summary of all baked maps for all baked objects into a .txt file",
default=False)
global_use_bake_overwrite : bpy.props.BoolProperty(
name="Overwrite",
description="Overwrite previously baked files in the output directories and this .blend file if their file names match the ones that will be baked",
default=False)
global_use_bakemaster_reset : bpy.props.BoolProperty(
name="Reset BakeMaster",
description="Remove baked objects from BakeMaster Table of Objects after the bake",
default=False)
global_bake_instruction : bpy.props.StringProperty(
name="Bake Operator Instruction",
default="Short Bake Instruction",
description=BM_Labels.OPERATOR_ITEM_BAKE_FULL_DESCRIPTION)
global_bake_available : bpy.props.BoolProperty(
default=True)
# GLobal Texture Sets Props
global_texturesets_table : bpy.props.CollectionProperty(type=BM_SceneProps_TextureSet)
global_texturesets_active_index : bpy.props.IntProperty(
name="Texture Set.\nTexture Set is a set of objects that share the same image texture file for each map",
default=0)
# Addon Preferences Props
global_lowpoly_tag : bpy.props.StringProperty(
name="Lowpoly Tag",
description="What keyword to search for in Object name to determine if it's a Lowpoly Object",
default="low")
global_highpoly_tag : bpy.props.StringProperty(
name="Highpoly Tag",
description="What keyword to search for in Object name to determine if it's a Highpoly Object",
default="high")
global_cage_tag : bpy.props.StringProperty(
name="Cage Tag",
description="What keyword to search for in Object name to determine if it's a Cage Object",
default="cage")
global_decal_tag : bpy.props.StringProperty(
name="Decal Tag",
description="What keyword to search for in Object name to determine if it's a Decal Object",
default="decal")
global_bake_uv_layer_tag : bpy.props.StringProperty(
name="UVMap Tag",
description="What UVMap name should include for BakeMaster to see it as UVMap for bake",
default="bake")
global_use_hide_notbaked : bpy.props.BoolProperty(
name="Hide not baked",
description="Hide all Objects in the scene that are not proceeded in the bake, so that they do not affect it",
default=False)
global_bake_match_maps_type : bpy.props.EnumProperty(
name="Maps Match type",
description="How to determine what maps should be baked onto the same image files",
default='MAP_PREFIX',
items=[('MAP_PREFIX', "Maps Prefixes", "If Objects are in the texture set for ex., maps with identical prefixes will be baked onto the same image file"),
('MAP_TYPE', "Maps Types", "If Objects are in the texture set for ex., maps of identical types will be baked onto the same image file"),
('MAP_PREFIX_AND_TYPE', "Both Type and Prefix", "If Objects are in the texture set for ex., maps with identical prefixes will be baked onto the same image file.\nIf no identical prefixes found, BakeMaster will try to match maps of the same type")])
global_cage_color_solid: bpy.props.FloatVectorProperty(
name="Face", # noqa: F405
description="Face color for real-time cage preview",
default=(1, 0.5, 0, 0.1),
size=4,
min=0,
max=1,
precision=3,
subtype='COLOR') # noqa: F405
global_cage_color_wire: bpy.props.FloatVectorProperty(
name="Wireframe", # noqa: F405
description="Wireframe color for real-time cage preview",
default=(0.95, 0.45, 0, 0.1),
size=4,
min=0,
max=1,
precision=3,
subtype='COLOR') # noqa: F405
global_bake_use_map_strength: bpy.props.BoolProperty(
name="Map Strength Baked in",
description=(
"Emission Strength, Strength and Scale socket values will be baked"
" into texture maps like Emission, Normal, Displacement. Texture "
"map's data will be multiplied by the values of these sockets"
),
default=True)
global_bake_use_nno: bpy.props.BoolProperty(
name="Bake Named Node Ouputs",
description=(
"Inspect and use Node outputs that represent bakeable data. For "
"example, if Node Group has output named 'Albedo', 'Bake Albedo' "
" etc. and map to bake is Albedo, BakeMaster will stop searching "
"node tree further and will bake this named output immidieately "
"even if it is not used in the current shader node tree setup"),
default=True)
global_bake_nno_use_linked: bpy.props.BoolProperty(
name="Linked", # noqa: F405
description=(
"Use both linked and unlinked named outputs. If disabled, only "
"unlinked are used"
),
default=False)
global_bake_nno_use_all_nodes: bpy.props.BoolProperty(
name="All Node Types",
description=(
"Search all node types for baking named outputs. "
"If disabled, only final Node Group outputs are searched"
),
default=False)
global_bake_nno_use_named_bake: bpy.props.BoolProperty(
name="Named for Bake only",
description=(
"Use only those named outputs, names of which include the word "
"'Bake'. If disabled, all named outputs matching the map name to "
"bake are used"
),
default=True)
global_use_collapse_nodes: bpy.props.BoolProperty(
name="Collapse Nodes",
description="Collapse added shader nodes in baked materials",
default=False)
global_use_preset_more_options: bpy.props.BoolProperty(
name="More Options",
description="Enable Update buttons next to each preset and active preset visualization",
default=True)
global_presets_use_default: bpy.props.BoolProperty(
name="Default Presets",
description="Enable the ability to mark default presets that will be automatically executed every time a new item is added",
default=True)
##################################################
### MAP PROPS ###
##################################################
class BM_Map_Highpoly(bpy.types.PropertyGroup):
global_object_name : bpy.props.EnumProperty(
name="Highpoly",
description="Choose Highpoly for the Object from the list\n(Highpoly should be added to BakeMaster Table of Objects)",
items=BM_ITEM_PROPS_hl_highpoly_Items,
update=BM_ITEM_PROPS_hl_highpoly_Update)
global_holder_index : bpy.props.IntProperty(default=-1)
global_item_index : bpy.props.IntProperty()
global_highpoly_name_old : bpy.props.StringProperty()
global_highpoly_object_index : bpy.props.IntProperty(default=-1)
global_highpoly_object_include : bpy.props.StringProperty(default="")
class BM_Map(bpy.types.PropertyGroup):
global_use_bake : bpy.props.BoolProperty(
name="Include/exclude map in the bake",
default=True,
update=BM_MAP_PROPS_global_use_bake_Update)
global_map_type : bpy.props.EnumProperty(
name="Choose Map Type",
description="Set map type for the current pass",
items=BM_MAP_PROPS_map_type_Items,
update=BM_MAP_PROPS_global_map_type_Update)
global_map_index : bpy.props.IntProperty()
global_map_object_index : bpy.props.IntProperty(default=-1)
# Map High to Lowpoly props:
hl_highpoly_table : bpy.props.CollectionProperty(type=BM_Map_Highpoly)
hl_highpoly_table_active_index : bpy.props.IntProperty(
name="Highpoly Object",
default=0)
hl_use_cage : bpy.props.BoolProperty(
name="Use Cage Object",
description="Cast rays to Object from cage",
default=False,
update=BM_ITEM_PROPS_hl_use_cage_Update)
hl_cage_type : bpy.props.EnumProperty(
name="Cage type",
description="Type of Cage properties to use",
items=[('STANDARD', "Standard", "Standard Cage properties of Cycles Bake.\nSet extrusion, ray distance, and choose cage object"),
('SMART', "Smart", "Auto cage creation using lowpoly mesh displace. Saves time with simple cage")],
update=BM_MAP_PROPS_hl_cage_type_Update)
hl_cage_extrusion : bpy.props.FloatProperty(
name="Cage Extrusion",
description="Inflate by the specified distance to create cage",
default=0,
min=0,
soft_max=1,
precision=2,
subtype='DISTANCE',
update=BM_MAP_PROPS_hl_cage_extrusion_Update)
hl_max_ray_distance : bpy.props.FloatProperty(
name="Max Ray Distance",
description="The maximum ray distance for matching points between the high and lowpoly. If zero, there is no limit",
default=0,
min=0,
soft_max=1,
precision=2,
subtype='DISTANCE',
update=BM_MAP_PROPS_hl_max_ray_distance_Update)
hl_cage : bpy.props.EnumProperty(
name="Cage Object",
description="Object to use as cage instead of calculating with cage extrusion",
items=BM_ITEM_PROPS_hl_cage_Items,
update=BM_ITEM_PROPS_hl_cage_Update)
hl_cage_name_old : bpy.props.StringProperty()
hl_cage_object_index : bpy.props.IntProperty(default=-1)
hl_cage_object_include : bpy.props.StringProperty(default="")
# Map UV Props:
uv_bake_data : bpy.props.EnumProperty(
name="Bake Data",
description="Choose data type to use for baking",
default='OBJECT_MATERIALS',
items=[('OBJECT_MATERIALS', "Object/Materials", "Use Object and Materials data for baking regular maps"),
('VERTEX_COLORS', "Vertex Colors", "Bake VertexColor Layers to Image Textures")],
update=BM_MAP_PROPS_uv_bake_data_Update)
uv_bake_target : bpy.props.EnumProperty(
name="Bake Target",
description="Choose Baked Maps output target",
items=BM_ITEM_PROPS_uv_bake_target_Items,
update=BM_MAP_PROPS_uv_bake_target_Update)
uv_active_layer : bpy.props.EnumProperty(
name="UVMap for bake",
description="Choose a UVMap layer to use in the bake.\nIf mesh has got no UV layers and at least one map to be baked to image texture, auto UV unwrap will be proceeded",
items=BM_ITEM_PROPS_uv_active_layer_Items)
uv_type : bpy.props.EnumProperty(
name = "UV Map Type",
description = "Set the chosen Active UV Map type",
items = BM_ITEM_PROPS_uv_type_Items,
update=BM_MAP_PROPS_uv_type_Update)
uv_snap_islands_to_pixels : bpy.props.BoolProperty(
name="Snap UV to pixels",
description="Make chosen UV Layer pixel perfect by aligning UV Coordinates to pixels' corners/edges",
update=BM_MAP_PROPS_uv_snap_islands_to_pixels_Update)
# uv_use_auto_unwrap : bpy.props.BoolProperty(
# name="Auto Unwrap",
# description="Auto UV Unwrap object using smart project",
# update=BM_ITEM_PROPS_UVSettings_Update)
# uv_auto_unwrap_angle_limit : bpy.props.IntProperty(
# name="Angle Limit",
# description="The angle at which to place seam on the mesh for unwrapping",
# default=66,
# min=0,
# max=89,
# subtype='ANGLE',
# update=BM_ITEM_PROPS_UVSettings_Update)
# uv_auto_unwrap_island_margin : bpy.props.FloatProperty(
# name="Island Margin",
# description="Set distance between adjacent UV islands",
# default=0.01,
# min=0,
# max=1,
# update=BM_ITEM_PROPS_UVSettings_Update)
# uv_auto_unwrap_use_scale_to_bounds : bpy.props.BoolProperty(
# name="Scale to Bounds",
# description="Scale UV coordinates to bounds to fill the whole UV tile area",
# default=True,
# update=BM_ITEM_PROPS_UVSettings_Update)
# Map Output Props:
out_use_denoise : bpy.props.BoolProperty(
name="Denoise",
description="Denoise and Discpeckle baked maps as a post-process filter. For external bake only",
default=False,