-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaterial_manager.py
More file actions
2291 lines (2007 loc) · 85 KB
/
Copy pathmaterial_manager.py
File metadata and controls
2291 lines (2007 loc) · 85 KB
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
bl_info = {
"name": "Material Manager Pro",
"author": "qwe2528068-a11y",
"version": (1, 0, 0),
"blender": (4, 0, 0),
"location": "3D Viewport > Sidebar > Material Mgr",
"description": "材质管理插件 — 预设材质库 + 自定义属性编辑",
"category": "Material",
}
import os
import json
import bpy
from bpy.types import Panel, Operator, PropertyGroup, Menu, UIList
from bpy.props import (
StringProperty, FloatProperty, FloatVectorProperty,
EnumProperty, BoolProperty, IntProperty, PointerProperty, CollectionProperty
)
# ═══════════════════════════════════════════════════════════
# 预设材质库
# 数值为 Blender 4.x Principled BSDF 的标量近似预设,参考常见 PBR/IOR 资料。
# ═══════════════════════════════════════════════════════════
PRESET_MATERIALS = {
# ── 金属类 ──
"黄金": {
"category": "金属", "base_color": (1.0, 0.766, 0.336, 1.0),
"roughness": 0.15, "metallic": 1.0, "specular": 0.5, "specular_tint": 0.2,
},
"玫瑰金": {
"category": "金属", "base_color": (1.0, 0.599, 0.552, 1.0),
"roughness": 0.18, "metallic": 1.0, "specular": 0.5, "specular_tint": 0.15,
},
"白银": {
"category": "金属", "base_color": (0.972, 0.96, 0.915, 1.0),
"roughness": 0.1, "metallic": 1.0, "specular": 0.5, "specular_tint": 0.0,
},
"铂金": {
"category": "金属", "base_color": (0.92, 0.895, 0.86, 1.0),
"roughness": 0.08, "metallic": 1.0, "specular": 0.55, "specular_tint": 0.0,
},
"紫铜": {
"category": "金属", "base_color": (0.955, 0.637, 0.538, 1.0),
"roughness": 0.2, "metallic": 1.0, "specular": 0.5, "specular_tint": 0.1,
},
"黄铜": {
"category": "金属", "base_color": (0.887, 0.789, 0.434, 1.0),
"roughness": 0.22, "metallic": 1.0, "specular": 0.5, "specular_tint": 0.05,
},
"青铜": {
"category": "金属", "base_color": (0.714, 0.428, 0.181, 1.0),
"roughness": 0.32, "metallic": 1.0, "specular": 0.45, "specular_tint": 0.3,
},
"铸铁": {
"category": "金属", "base_color": (0.56, 0.57, 0.58, 1.0),
"roughness": 0.45, "metallic": 1.0, "specular": 0.4, "specular_tint": 0.0,
},
"钨钢": {
"category": "金属", "base_color": (0.58, 0.59, 0.62, 1.0),
"roughness": 0.18, "metallic": 1.0, "specular": 0.45, "specular_tint": 0.0,
},
"铝": {
"category": "金属", "base_color": (0.913, 0.921, 0.925, 1.0),
"roughness": 0.28, "metallic": 1.0, "specular": 0.5, "specular_tint": 0.0,
},
"钛合金": {
"category": "金属", "base_color": (0.672, 0.637, 0.585, 1.0),
"roughness": 0.24, "metallic": 1.0, "specular": 0.5, "specular_tint": 0.0,
},
"铬": {
"category": "金属", "base_color": (0.55, 0.556, 0.554, 1.0),
"roughness": 0.03, "metallic": 1.0, "specular": 0.5, "specular_tint": 0.0,
},
"生锈铁": {
"category": "金属", "base_color": (0.55, 0.2, 0.08, 1.0),
"roughness": 0.82, "metallic": 0.25, "specular": 0.18, "specular_tint": 0.4,
},
# ── 玻璃类 ──
"透明玻璃": {
"category": "玻璃", "base_color": (1.0, 1.0, 1.0, 1.0),
"roughness": 0.0, "metallic": 0.0, "specular": 0.5,
"transmission": 1.0, "ior": 1.45, "alpha": 0.0,
},
"光学水晶": {
"category": "玻璃", "base_color": (1.0, 1.0, 1.0, 1.0),
"roughness": 0.0, "metallic": 0.0, "specular": 0.5,
"transmission": 1.0, "ior": 1.5, "alpha": 0.0,
},
"铅玻璃": {
"category": "玻璃", "base_color": (1.0, 1.0, 1.0, 1.0),
"roughness": 0.0, "metallic": 0.0, "specular": 0.55,
"transmission": 0.95, "ior": 1.7, "alpha": 0.0,
},
"磨砂玻璃": {
"category": "玻璃", "base_color": (1.0, 1.0, 1.0, 1.0),
"roughness": 0.25, "metallic": 0.0, "specular": 0.4,
"transmission": 0.9, "ior": 1.45, "alpha": 0.05,
},
"着色玻璃": {
"category": "玻璃", "base_color": (0.3, 0.6, 0.8, 1.0),
"roughness": 0.05, "metallic": 0.0, "specular": 0.5,
"transmission": 0.85, "ior": 1.45, "alpha": 0.05,
},
"琥珀玻璃": {
"category": "玻璃", "base_color": (0.8, 0.5, 0.15, 1.0),
"roughness": 0.05, "metallic": 0.0, "specular": 0.5,
"transmission": 0.75, "ior": 1.5, "alpha": 0.05,
},
"翡翠玻璃": {
"category": "玻璃", "base_color": (0.15, 0.65, 0.35, 1.0),
"roughness": 0.03, "metallic": 0.0, "specular": 0.5,
"transmission": 0.7, "ior": 1.52, "alpha": 0.05,
},
"彩虹玻璃": {
"category": "玻璃", "base_color": (0.95, 0.95, 1.0, 1.0),
"roughness": 0.02, "metallic": 0.0, "specular": 0.5,
"transmission": 0.9, "ior": 1.5, "alpha": 0.02,
"clearcoat": 0.8, "clearcoat_roughness": 0.02,
},
"裂纹玻璃": {
"category": "玻璃", "base_color": (0.95, 0.95, 0.95, 1.0),
"roughness": 0.15, "metallic": 0.0, "specular": 0.4,
"transmission": 0.8, "ior": 1.45, "alpha": 0.08,
"clearcoat": 0.3, "clearcoat_roughness": 0.5,
},
"可见玻璃": {
"category": "玻璃", "base_color": (0.55, 0.75, 0.85, 1.0),
"roughness": 0.08, "metallic": 0.0, "specular": 0.5,
"transmission": 0.55, "ior": 1.45, "alpha": 0.25,
"clearcoat": 0.2, "clearcoat_roughness": 0.05,
},
"茶色玻璃": {
"category": "玻璃", "base_color": (0.55, 0.35, 0.18, 1.0),
"roughness": 0.06, "metallic": 0.0, "specular": 0.5,
"transmission": 0.5, "ior": 1.45, "alpha": 0.3,
"clearcoat": 0.15, "clearcoat_roughness": 0.05,
},
"墨绿玻璃": {
"category": "玻璃", "base_color": (0.08, 0.25, 0.15, 1.0),
"roughness": 0.1, "metallic": 0.0, "specular": 0.45,
"transmission": 0.45, "ior": 1.5, "alpha": 0.35,
},
# ── 塑料类 ──
"光面塑料": {
"category": "塑料", "base_color": (0.8, 0.2, 0.2, 1.0),
"roughness": 0.15, "metallic": 0.0, "specular": 0.5, "clearcoat": 0.3,
},
"哑光塑料": {
"category": "塑料", "base_color": (0.5, 0.5, 0.5, 1.0),
"roughness": 0.6, "metallic": 0.0, "specular": 0.5,
},
"粗糙塑料": {
"category": "塑料", "base_color": (0.3, 0.7, 0.3, 1.0),
"roughness": 0.8, "metallic": 0.0, "specular": 0.3,
},
"亚克力": {
"category": "塑料", "base_color": (1.0, 1.0, 1.0, 1.0),
"roughness": 0.05, "metallic": 0.0, "specular": 0.55,
"transmission": 0.3, "ior": 1.49, "clearcoat": 0.5,
},
"ABS塑料": {
"category": "塑料", "base_color": (0.15, 0.15, 0.15, 1.0),
"roughness": 0.4, "metallic": 0.0, "specular": 0.45,
},
"PVC": {
"category": "塑料", "base_color": (0.85, 0.85, 0.8, 1.0),
"roughness": 0.3, "metallic": 0.0, "specular": 0.4,
},
"软胶": {
"category": "塑料", "base_color": (0.2, 0.5, 0.8, 1.0),
"roughness": 0.35, "metallic": 0.0, "specular": 0.35, "subsurface": 0.1,
},
"半透明塑料": {
"category": "塑料", "base_color": (0.9, 0.5, 0.2, 1.0),
"roughness": 0.2, "metallic": 0.0, "specular": 0.4,
"transmission": 0.4, "subsurface": 0.15, "alpha": 0.6,
},
# ── 木材类 ──
"橡木": {
"category": "木材", "base_color": (0.55, 0.35, 0.15, 1.0),
"roughness": 0.5, "metallic": 0.0, "specular": 0.4,
"sheen": 0.5, "sheen_tint": 0.3,
},
"胡桃木": {
"category": "木材", "base_color": (0.3, 0.15, 0.05, 1.0),
"roughness": 0.4, "metallic": 0.0, "specular": 0.35,
"sheen": 0.6, "sheen_tint": 0.4,
},
"松木": {
"category": "木材", "base_color": (0.75, 0.6, 0.3, 1.0),
"roughness": 0.55, "metallic": 0.0, "specular": 0.35,
"sheen": 0.4, "sheen_tint": 0.2,
},
"红木": {
"category": "木材", "base_color": (0.5, 0.15, 0.05, 1.0),
"roughness": 0.35, "metallic": 0.0, "specular": 0.4,
"sheen": 0.7, "sheen_tint": 0.5, "clearcoat": 0.3,
},
"樱桃木": {
"category": "木材", "base_color": (0.6, 0.25, 0.12, 1.0),
"roughness": 0.4, "metallic": 0.0, "specular": 0.4,
"sheen": 0.55, "sheen_tint": 0.35,
},
"黑檀木": {
"category": "木材", "base_color": (0.08, 0.05, 0.02, 1.0),
"roughness": 0.3, "metallic": 0.0, "specular": 0.45,
"sheen": 0.5, "sheen_tint": 0.2, "clearcoat": 0.4,
},
"竹子": {
"category": "木材", "base_color": (0.5, 0.55, 0.2, 1.0),
"roughness": 0.5, "metallic": 0.0, "specular": 0.3,
"sheen": 0.3, "sheen_tint": 0.1,
},
"枫木": {
"category": "木材", "base_color": (0.85, 0.7, 0.45, 1.0),
"roughness": 0.5, "metallic": 0.0, "specular": 0.35,
"sheen": 0.35, "sheen_tint": 0.2,
},
"柚木": {
"category": "木材", "base_color": (0.45, 0.3, 0.15, 1.0),
"roughness": 0.45, "metallic": 0.0, "specular": 0.35,
"sheen": 0.45, "sheen_tint": 0.3,
},
"白蜡木": {
"category": "木材", "base_color": (0.72, 0.58, 0.38, 1.0),
"roughness": 0.45, "metallic": 0.0, "specular": 0.38,
"sheen": 0.4, "sheen_tint": 0.25,
},
"桦木": {
"category": "木材", "base_color": (0.88, 0.78, 0.55, 1.0),
"roughness": 0.5, "metallic": 0.0, "specular": 0.35,
"sheen": 0.3, "sheen_tint": 0.15,
},
"紫檀木": {
"category": "木材", "base_color": (0.28, 0.08, 0.04, 1.0),
"roughness": 0.3, "metallic": 0.0, "specular": 0.45,
"sheen": 0.7, "sheen_tint": 0.45, "clearcoat": 0.35,
},
"水曲柳": {
"category": "木材", "base_color": (0.62, 0.48, 0.3, 1.0),
"roughness": 0.48, "metallic": 0.0, "specular": 0.36,
"sheen": 0.42, "sheen_tint": 0.28,
},
"铁力木": {
"category": "木材", "base_color": (0.15, 0.08, 0.03, 1.0),
"roughness": 0.28, "metallic": 0.0, "specular": 0.48,
"sheen": 0.55, "sheen_tint": 0.25, "clearcoat": 0.3,
},
"榉木": {
"category": "木材", "base_color": (0.65, 0.45, 0.25, 1.0),
"roughness": 0.5, "metallic": 0.0, "specular": 0.35,
"sheen": 0.38, "sheen_tint": 0.22,
},
"红杉木": {
"category": "木材", "base_color": (0.55, 0.28, 0.18, 1.0),
"roughness": 0.52, "metallic": 0.0, "specular": 0.32,
"sheen": 0.45, "sheen_tint": 0.3,
},
"橡木深色": {
"category": "木材", "base_color": (0.35, 0.2, 0.1, 1.0),
"roughness": 0.42, "metallic": 0.0, "specular": 0.42,
"sheen": 0.55, "sheen_tint": 0.35, "clearcoat": 0.2,
},
"花梨木": {
"category": "木材", "base_color": (0.42, 0.18, 0.07, 1.0),
"roughness": 0.33, "metallic": 0.0, "specular": 0.43,
"sheen": 0.65, "sheen_tint": 0.4, "clearcoat": 0.25,
},
"桃花心木": {
"category": "木材", "base_color": (0.48, 0.2, 0.12, 1.0),
"roughness": 0.38, "metallic": 0.0, "specular": 0.4,
"sheen": 0.5, "sheen_tint": 0.35,
},
"梣木": {
"category": "木材", "base_color": (0.78, 0.65, 0.42, 1.0),
"roughness": 0.47, "metallic": 0.0, "specular": 0.37,
"sheen": 0.38, "sheen_tint": 0.22,
},
"鸡翅木": {
"category": "木材", "base_color": (0.2, 0.12, 0.06, 1.0),
"roughness": 0.35, "metallic": 0.0, "specular": 0.4,
"sheen": 0.5, "sheen_tint": 0.3, "clearcoat": 0.3,
},
# ── 石材类 ──
"大理石": {
"category": "石材", "base_color": (0.92, 0.9, 0.85, 1.0),
"roughness": 0.2, "metallic": 0.0, "specular": 0.5, "subsurface": 0.15,
},
"花岗岩": {
"category": "石材", "base_color": (0.35, 0.33, 0.3, 1.0),
"roughness": 0.35, "metallic": 0.0, "specular": 0.4,
"clearcoat": 0.5, "clearcoat_roughness": 0.3,
},
"砂岩": {
"category": "石材", "base_color": (0.7, 0.55, 0.35, 1.0),
"roughness": 0.6, "metallic": 0.0, "specular": 0.2,
},
"板岩": {
"category": "石材", "base_color": (0.25, 0.25, 0.27, 1.0),
"roughness": 0.5, "metallic": 0.0, "specular": 0.25,
"clearcoat": 0.15, "clearcoat_roughness": 0.4,
},
"石灰石": {
"category": "石材", "base_color": (0.78, 0.75, 0.68, 1.0),
"roughness": 0.45, "metallic": 0.0, "specular": 0.3,
},
"玉石": {
"category": "石材", "base_color": (0.55, 0.7, 0.45, 1.0),
"roughness": 0.1, "metallic": 0.0, "specular": 0.5,
"subsurface": 0.25, "transmission": 0.15, "ior": 1.3,
},
"黑曜石": {
"category": "石材", "base_color": (0.05, 0.05, 0.05, 1.0),
"roughness": 0.08, "metallic": 0.0, "specular": 0.6,
"clearcoat": 0.7, "clearcoat_roughness": 0.02,
},
"鹅卵石": {
"category": "石材", "base_color": (0.5, 0.48, 0.45, 1.0),
"roughness": 0.3, "metallic": 0.0, "specular": 0.35,
"clearcoat": 0.2, "clearcoat_roughness": 0.2,
},
# ── 陶瓷类 ──
"白瓷": {
"category": "陶瓷", "base_color": (0.95, 0.93, 0.9, 1.0),
"roughness": 0.1, "metallic": 0.0, "specular": 0.6,
"clearcoat": 0.4, "subsurface": 0.1,
},
"细瓷": {
"category": "陶瓷", "base_color": (0.9, 0.88, 0.85, 1.0),
"roughness": 0.05, "metallic": 0.0, "specular": 0.7,
"clearcoat": 0.6, "subsurface": 0.15,
},
"红陶": {
"category": "陶瓷", "base_color": (0.65, 0.3, 0.18, 1.0),
"roughness": 0.5, "metallic": 0.0, "specular": 0.25,
},
"青瓷": {
"category": "陶瓷", "base_color": (0.6, 0.75, 0.65, 1.0),
"roughness": 0.08, "metallic": 0.0, "specular": 0.6,
"clearcoat": 0.5, "subsurface": 0.1,
},
"骨瓷": {
"category": "陶瓷", "base_color": (0.93, 0.9, 0.85, 1.0),
"roughness": 0.03, "metallic": 0.0, "specular": 0.65,
"transmission": 0.15, "subsurface": 0.2,
},
"粗陶": {
"category": "陶瓷", "base_color": (0.55, 0.35, 0.2, 1.0),
"roughness": 0.65, "metallic": 0.0, "specular": 0.15,
},
"紫砂": {
"category": "陶瓷", "base_color": (0.4, 0.18, 0.1, 1.0),
"roughness": 0.45, "metallic": 0.0, "specular": 0.2,
"subsurface": 0.05,
},
# ── 橡胶类 ──
"黑色橡胶": {
"category": "橡胶", "base_color": (0.05, 0.05, 0.05, 1.0),
"roughness": 0.85, "metallic": 0.0, "specular": 0.1,
},
"彩色橡胶": {
"category": "橡胶", "base_color": (0.15, 0.4, 0.7, 1.0),
"roughness": 0.75, "metallic": 0.0, "specular": 0.15,
},
"硅胶": {
"category": "橡胶", "base_color": (0.9, 0.9, 0.9, 1.0),
"roughness": 0.55, "metallic": 0.0, "specular": 0.2, "subsurface": 0.15,
},
"泡沫": {
"category": "橡胶", "base_color": (0.85, 0.85, 0.82, 1.0),
"roughness": 0.9, "metallic": 0.0, "specular": 0.05, "sheen": 1.0, "sheen_tint": 0.5,
},
"轮胎橡胶": {
"category": "橡胶", "base_color": (0.03, 0.03, 0.03, 1.0),
"roughness": 0.6, "metallic": 0.0, "specular": 0.08,
},
"半透明硅胶": {
"category": "橡胶", "base_color": (0.95, 0.9, 0.85, 1.0),
"roughness": 0.4, "metallic": 0.0, "specular": 0.25,
"subsurface": 0.25, "transmission": 0.1, "alpha": 0.7,
},
# ── 织物类 ──
"天鹅绒": {
"category": "织物", "base_color": (0.6, 0.1, 0.1, 1.0),
"roughness": 0.7, "metallic": 0.0, "specular": 0.1,
"sheen": 8.0, "sheen_tint": 0.5,
},
"棉布": {
"category": "织物", "base_color": (0.9, 0.9, 0.85, 1.0),
"roughness": 0.9, "metallic": 0.0, "specular": 0.05,
"sheen": 2.0, "sheen_tint": 0.3,
},
"丝绸": {
"category": "织物", "base_color": (0.15, 0.15, 0.55, 1.0),
"roughness": 0.25, "metallic": 0.0, "specular": 0.5,
"sheen": 6.0, "sheen_tint": 0.6, "clearcoat": 0.3,
},
"皮革": {
"category": "织物", "base_color": (0.35, 0.15, 0.05, 1.0),
"roughness": 0.4, "metallic": 0.0, "specular": 0.3,
"sheen": 0.5, "sheen_tint": 0.3, "subsurface": 0.1,
},
"牛仔布": {
"category": "织物", "base_color": (0.15, 0.2, 0.45, 1.0),
"roughness": 0.85, "metallic": 0.0, "specular": 0.05,
"sheen": 1.0, "sheen_tint": 0.2,
},
"羊毛": {
"category": "织物", "base_color": (0.7, 0.65, 0.55, 1.0),
"roughness": 0.95, "metallic": 0.0, "specular": 0.03,
"sheen": 3.0, "sheen_tint": 0.4,
},
"绒面革": {
"category": "织物", "base_color": (0.55, 0.35, 0.2, 1.0),
"roughness": 0.75, "metallic": 0.0, "specular": 0.08,
"sheen": 4.0, "sheen_tint": 0.5,
},
"麻布": {
"category": "织物", "base_color": (0.75, 0.68, 0.55, 1.0),
"roughness": 0.9, "metallic": 0.0, "specular": 0.05,
"sheen": 1.5, "sheen_tint": 0.25,
},
# ── 发光类 ──
"红色霓虹": {
"category": "发光", "base_color": (1.0, 0.05, 0.05, 1.0),
"roughness": 0.3, "metallic": 0.0, "specular": 0.2,
"emission_color": (1.0, 0.05, 0.05, 1.0), "emission_strength": 15.0,
},
"蓝色霓虹": {
"category": "发光", "base_color": (0.05, 0.1, 1.0, 1.0),
"roughness": 0.3, "metallic": 0.0, "specular": 0.2,
"emission_color": (0.05, 0.1, 1.0, 1.0), "emission_strength": 15.0,
},
"绿色霓虹": {
"category": "发光", "base_color": (0.05, 1.0, 0.1, 1.0),
"roughness": 0.3, "metallic": 0.0, "specular": 0.2,
"emission_color": (0.05, 1.0, 0.1, 1.0), "emission_strength": 15.0,
},
"粉色霓虹": {
"category": "发光", "base_color": (1.0, 0.1, 0.5, 1.0),
"roughness": 0.3, "metallic": 0.0, "specular": 0.2,
"emission_color": (1.0, 0.1, 0.5, 1.0), "emission_strength": 12.0,
},
"白色LED": {
"category": "发光", "base_color": (1.0, 1.0, 1.0, 1.0),
"roughness": 0.2, "metallic": 0.0, "specular": 0.1,
"emission_color": (1.0, 1.0, 1.0, 1.0), "emission_strength": 5.0,
},
"暖黄灯": {
"category": "发光", "base_color": (1.0, 0.85, 0.5, 1.0),
"roughness": 0.2, "metallic": 0.0, "specular": 0.1,
"emission_color": (1.0, 0.75, 0.3, 1.0), "emission_strength": 5.0,
},
"冷白灯": {
"category": "发光", "base_color": (0.8, 0.85, 1.0, 1.0),
"roughness": 0.2, "metallic": 0.0, "specular": 0.1,
"emission_color": (0.8, 0.85, 1.0, 1.0), "emission_strength": 8.0,
},
"橙色警示灯": {
"category": "发光", "base_color": (1.0, 0.4, 0.05, 1.0),
"roughness": 0.3, "metallic": 0.0, "specular": 0.15,
"emission_color": (1.0, 0.4, 0.05, 1.0), "emission_strength": 10.0,
},
# ── 车漆类 ──
"红色金属漆": {
"category": "车漆", "base_color": (0.8, 0.1, 0.1, 1.0),
"roughness": 0.05, "metallic": 0.3, "specular": 0.5,
"clearcoat": 1.0, "clearcoat_roughness": 0.03,
},
"珍珠白车漆": {
"category": "车漆", "base_color": (0.9, 0.9, 0.95, 1.0),
"roughness": 0.05, "metallic": 0.5, "specular": 0.5,
"clearcoat": 1.0, "clearcoat_roughness": 0.02, "specular_tint": 0.4,
},
"蓝色金属漆": {
"category": "车漆", "base_color": (0.1, 0.2, 0.7, 1.0),
"roughness": 0.05, "metallic": 0.35, "specular": 0.5,
"clearcoat": 1.0, "clearcoat_roughness": 0.03,
},
"哑光黑漆": {
"category": "车漆", "base_color": (0.05, 0.05, 0.05, 1.0),
"roughness": 0.4, "metallic": 0.0, "specular": 0.3,
"clearcoat": 0.5, "clearcoat_roughness": 0.5,
},
"变色龙漆": {
"category": "车漆", "base_color": (0.3, 0.15, 0.5, 1.0),
"roughness": 0.05, "metallic": 0.6, "specular": 0.5,
"clearcoat": 1.0, "clearcoat_roughness": 0.02, "specular_tint": 0.6,
},
"赛车绿": {
"category": "车漆", "base_color": (0.05, 0.2, 0.08, 1.0),
"roughness": 0.05, "metallic": 0.25, "specular": 0.5,
"clearcoat": 1.0, "clearcoat_roughness": 0.03,
},
"亮黄色车漆": {
"category": "车漆", "base_color": (0.95, 0.75, 0.05, 1.0),
"roughness": 0.05, "metallic": 0.2, "specular": 0.5,
"clearcoat": 1.0, "clearcoat_roughness": 0.03,
},
# ── 有机类 ──
"皮肤": {
"category": "有机", "base_color": (0.85, 0.65, 0.55, 1.0),
"roughness": 0.55, "metallic": 0.0, "specular": 0.35, "subsurface": 0.3,
},
"象牙": {
"category": "有机", "base_color": (0.95, 0.88, 0.72, 1.0),
"roughness": 0.15, "metallic": 0.0, "specular": 0.4, "subsurface": 0.2,
},
"蜜蜡": {
"category": "有机", "base_color": (0.8, 0.55, 0.2, 1.0),
"roughness": 0.25, "metallic": 0.0, "specular": 0.3,
"subsurface": 0.35, "transmission": 0.2,
},
"骨头": {
"category": "有机", "base_color": (0.88, 0.82, 0.7, 1.0),
"roughness": 0.3, "metallic": 0.0, "specular": 0.3, "subsurface": 0.15,
},
"珍珠母": {
"category": "有机", "base_color": (0.9, 0.85, 0.78, 1.0),
"roughness": 0.1, "metallic": 0.0, "specular": 0.55,
"clearcoat": 0.6, "subsurface": 0.15, "specular_tint": 0.3,
},
"珊瑚": {
"category": "有机", "base_color": (0.9, 0.3, 0.25, 1.0),
"roughness": 0.3, "metallic": 0.0, "specular": 0.3, "subsurface": 0.2,
},
# ── 液体类 ──
"清水": {
"category": "液体", "base_color": (0.98, 0.98, 1.0, 1.0),
"roughness": 0.0, "metallic": 0.0, "specular": 0.5,
"transmission": 0.95, "ior": 1.33, "alpha": 0.0,
},
"海水": {
"category": "液体", "base_color": (0.1, 0.4, 0.65, 1.0),
"roughness": 0.05, "metallic": 0.0, "specular": 0.5,
"transmission": 0.7, "ior": 1.34, "alpha": 0.05,
},
"蜂蜜": {
"category": "液体", "base_color": (0.75, 0.45, 0.08, 1.0),
"roughness": 0.1, "metallic": 0.0, "specular": 0.4,
"transmission": 0.5, "ior": 1.5, "subsurface": 0.2, "alpha": 0.1,
},
"牛奶": {
"category": "液体", "base_color": (0.95, 0.93, 0.88, 1.0),
"roughness": 0.15, "metallic": 0.0, "specular": 0.35,
"subsurface": 0.5, "transmission": 0.15, "ior": 1.35, "alpha": 0.3,
},
"油": {
"category": "液体", "base_color": (0.7, 0.55, 0.15, 1.0),
"roughness": 0.05, "metallic": 0.0, "specular": 0.45,
"transmission": 0.6, "ior": 1.47, "alpha": 0.05,
},
"水银": {
"category": "液体", "base_color": (0.75, 0.75, 0.78, 1.0),
"roughness": 0.02, "metallic": 1.0, "specular": 0.55,
"ior": 1.6, "alpha": 0.0,
},
"红酒": {
"category": "液体", "base_color": (0.35, 0.02, 0.05, 1.0),
"roughness": 0.05, "metallic": 0.0, "specular": 0.4,
"transmission": 0.55, "ior": 1.34, "alpha": 0.08,
},
"可乐": {
"category": "液体", "base_color": (0.15, 0.05, 0.02, 1.0),
"roughness": 0.05, "metallic": 0.0, "specular": 0.4,
"transmission": 0.45, "ior": 1.34, "alpha": 0.1,
},
# ── 冰雪类 ──
"冰块": {
"category": "冰雪", "base_color": (0.92, 0.95, 0.98, 1.0),
"roughness": 0.08, "metallic": 0.0, "specular": 0.5,
"transmission": 0.9, "ior": 1.31, "alpha": 0.0, "clearcoat": 0.2,
},
"新雪": {
"category": "冰雪", "base_color": (0.98, 0.98, 0.98, 1.0),
"roughness": 0.7, "metallic": 0.0, "specular": 0.15,
"sheen": 4.0, "sheen_tint": 0.2, "subsurface": 0.3,
},
"积雪": {
"category": "冰雪", "base_color": (0.92, 0.93, 0.94, 1.0),
"roughness": 0.6, "metallic": 0.0, "specular": 0.2,
"subsurface": 0.25, "sheen": 2.0, "sheen_tint": 0.1,
},
"冰霜": {
"category": "冰雪", "base_color": (0.85, 0.9, 0.95, 1.0),
"roughness": 0.35, "metallic": 0.0, "specular": 0.3,
"transmission": 0.3, "ior": 1.31, "alpha": 0.15,
"clearcoat": 0.1, "clearcoat_roughness": 0.4,
},
"极地冰": {
"category": "冰雪", "base_color": (0.78, 0.85, 0.95, 1.0),
"roughness": 0.05, "metallic": 0.0, "specular": 0.5,
"transmission": 0.85, "ior": 1.31, "alpha": 0.02, "subsurface": 0.1,
},
# ── 宝石类 ──
"钻石": {
"category": "宝石", "base_color": (1.0, 1.0, 1.0, 1.0),
"roughness": 0.0, "metallic": 0.0, "specular": 0.6,
"transmission": 0.95, "ior": 2.42, "alpha": 0.0,
},
"红宝石": {
"category": "宝石", "base_color": (0.85, 0.05, 0.1, 1.0),
"roughness": 0.02, "metallic": 0.0, "specular": 0.55,
"transmission": 0.75, "ior": 1.77, "alpha": 0.02,
},
"蓝宝石": {
"category": "宝石", "base_color": (0.05, 0.1, 0.7, 1.0),
"roughness": 0.02, "metallic": 0.0, "specular": 0.55,
"transmission": 0.75, "ior": 1.77, "alpha": 0.02,
},
"祖母绿": {
"category": "宝石", "base_color": (0.05, 0.55, 0.15, 1.0),
"roughness": 0.02, "metallic": 0.0, "specular": 0.55,
"transmission": 0.7, "ior": 1.58, "alpha": 0.02,
},
"紫水晶": {
"category": "宝石", "base_color": (0.45, 0.15, 0.55, 1.0),
"roughness": 0.03, "metallic": 0.0, "specular": 0.55,
"transmission": 0.7, "ior": 1.55, "alpha": 0.03,
},
"黄水晶": {
"category": "宝石", "base_color": (0.75, 0.5, 0.05, 1.0),
"roughness": 0.03, "metallic": 0.0, "specular": 0.55,
"transmission": 0.7, "ior": 1.55, "alpha": 0.03,
},
"石榴石": {
"category": "宝石", "base_color": (0.55, 0.02, 0.05, 1.0),
"roughness": 0.03, "metallic": 0.0, "specular": 0.5,
"transmission": 0.65, "ior": 1.73, "alpha": 0.03,
},
"蛋白石": {
"category": "宝石", "base_color": (0.85, 0.8, 0.9, 1.0),
"roughness": 0.05, "metallic": 0.0, "specular": 0.55,
"transmission": 0.4, "ior": 1.45, "alpha": 0.05,
"subsurface": 0.2, "clearcoat": 0.5,
},
# ── 食物类 ──
"黑巧克力": {
"category": "食物", "base_color": (0.15, 0.06, 0.02, 1.0),
"roughness": 0.35, "metallic": 0.0, "specular": 0.3, "subsurface": 0.1,
},
"牛奶巧克力": {
"category": "食物", "base_color": (0.35, 0.18, 0.08, 1.0),
"roughness": 0.3, "metallic": 0.0, "specular": 0.3, "subsurface": 0.15,
},
"焦糖": {
"category": "食物", "base_color": (0.55, 0.25, 0.05, 1.0),
"roughness": 0.15, "metallic": 0.0, "specular": 0.35, "subsurface": 0.3,
},
"面包皮": {
"category": "食物", "base_color": (0.55, 0.3, 0.1, 1.0),
"roughness": 0.7, "metallic": 0.0, "specular": 0.1,
"sheen": 1.5, "sheen_tint": 0.3,
},
"奶酪": {
"category": "食物", "base_color": (0.9, 0.7, 0.15, 1.0),
"roughness": 0.25, "metallic": 0.0, "specular": 0.3, "subsurface": 0.35,
},
"黄油": {
"category": "食物", "base_color": (0.95, 0.85, 0.3, 1.0),
"roughness": 0.2, "metallic": 0.0, "specular": 0.35,
"subsurface": 0.4, "transmission": 0.1,
},
"草莓酱": {
"category": "食物", "base_color": (0.65, 0.05, 0.05, 1.0),
"roughness": 0.2, "metallic": 0.0, "specular": 0.3,
"subsurface": 0.35, "transmission": 0.1, "alpha": 0.5,
},
"生肉": {
"category": "食物", "base_color": (0.6, 0.15, 0.1, 1.0),
"roughness": 0.4, "metallic": 0.0, "specular": 0.25, "subsurface": 0.3,
},
# ── 纸张类 ──
"打印纸": {
"category": "纸张", "base_color": (0.95, 0.95, 0.93, 1.0),
"roughness": 0.65, "metallic": 0.0, "specular": 0.1,
"sheen": 1.0, "sheen_tint": 0.2,
},
"牛皮纸": {
"category": "纸张", "base_color": (0.65, 0.5, 0.3, 1.0),
"roughness": 0.7, "metallic": 0.0, "specular": 0.08,
"sheen": 0.5, "sheen_tint": 0.3,
},
"硬纸板": {
"category": "纸张", "base_color": (0.5, 0.38, 0.22, 1.0),
"roughness": 0.8, "metallic": 0.0, "specular": 0.05,
"sheen": 0.3, "sheen_tint": 0.2,
},
"铜版纸": {
"category": "纸张", "base_color": (0.92, 0.9, 0.85, 1.0),
"roughness": 0.2, "metallic": 0.0, "specular": 0.35,
"sheen": 1.5, "sheen_tint": 0.1, "clearcoat": 0.2,
},
"旧报纸": {
"category": "纸张", "base_color": (0.72, 0.65, 0.45, 1.0),
"roughness": 0.75, "metallic": 0.0, "specular": 0.05,
"sheen": 0.4, "sheen_tint": 0.4,
},
"餐巾纸": {
"category": "纸张", "base_color": (0.93, 0.92, 0.88, 1.0),
"roughness": 0.85, "metallic": 0.0, "specular": 0.03,
"sheen": 3.0, "sheen_tint": 0.3, "alpha": 0.8,
},
# ── 涂层类 ──
"清漆": {
"category": "涂层", "base_color": (1.0, 1.0, 1.0, 1.0),
"roughness": 0.03, "metallic": 0.0, "specular": 0.55,
"clearcoat": 0.9, "transmission": 0.15, "ior": 1.5, "alpha": 0.1,
},
"哑光漆": {
"category": "涂层", "base_color": (0.9, 0.9, 0.9, 1.0),
"roughness": 0.5, "metallic": 0.0, "specular": 0.3,
"clearcoat": 0.6, "clearcoat_roughness": 0.5,
},
"珐琅": {
"category": "涂层", "base_color": (0.15, 0.25, 0.45, 1.0),
"roughness": 0.05, "metallic": 0.0, "specular": 0.6,
"clearcoat": 0.8, "clearcoat_roughness": 0.02, "subsurface": 0.1,
},
"镀锌": {
"category": "涂层", "base_color": (0.75, 0.75, 0.75, 1.0),
"roughness": 0.2, "metallic": 0.9, "specular": 0.45,
"clearcoat": 0.1, "clearcoat_roughness": 0.3,
},
"氧化层": {
"category": "涂层", "base_color": (0.5, 0.45, 0.35, 1.0),
"roughness": 0.5, "metallic": 0.6, "specular": 0.2,
"sheen": 1.0, "sheen_tint": 0.5,
},
"粉末涂层": {
"category": "涂层", "base_color": (0.15, 0.15, 0.18, 1.0),
"roughness": 0.35, "metallic": 0.0, "specular": 0.25,
"sheen": 0.5, "sheen_tint": 0.1, "clearcoat": 0.15,
},
"皱纹漆": {
"category": "涂层", "base_color": (0.2, 0.2, 0.2, 1.0),
"roughness": 0.6, "metallic": 0.0, "specular": 0.15,
"clearcoat": 0.1, "clearcoat_roughness": 0.7, "sheen": 2.0, "sheen_tint": 0.3,
},
# ── 镜子类 ──
"银镜": {
"category": "镜子", "base_color": (0.95, 0.95, 0.97, 1.0),
"roughness": 0.02, "metallic": 1.0, "specular": 0.5,
},
"镀铬镜": {
"category": "镜子", "base_color": (0.88, 0.9, 0.95, 1.0),
"roughness": 0.01, "metallic": 1.0, "specular": 0.5, "clearcoat": 0.1,
},
"铜镜": {
"category": "镜子", "base_color": (0.9, 0.55, 0.35, 1.0),
"roughness": 0.04, "metallic": 1.0, "specular": 0.48,
},
"金镜": {
"category": "镜子", "base_color": (0.95, 0.75, 0.2, 1.0),
"roughness": 0.03, "metallic": 1.0, "specular": 0.5,
},
"玻璃镜": {
"category": "镜子", "base_color": (0.92, 0.94, 0.95, 1.0),
"roughness": 0.01, "metallic": 1.0, "specular": 0.5,
"clearcoat": 0.5, "clearcoat_roughness": 0.01,
},
"黑镜": {
"category": "镜子", "base_color": (0.15, 0.15, 0.18, 1.0),
"roughness": 0.02, "metallic": 1.0, "specular": 0.5,
},
"复古镜": {
"category": "镜子", "base_color": (0.85, 0.82, 0.75, 1.0),
"roughness": 0.08, "metallic": 1.0, "specular": 0.45,
"sheen": 0.5, "sheen_tint": 0.4,
},
"烟熏镜": {
"category": "镜子", "base_color": (0.4, 0.4, 0.45, 1.0),
"roughness": 0.03, "metallic": 1.0, "specular": 0.5,
},
}
CUSTOM_PRESETS = {} # 从 JSON 加载的自定义预设
_PRESETS_DIR = os.path.dirname(os.path.realpath(__file__))
_PRESETS_FILE = os.path.join(_PRESETS_DIR, "material_manager_presets.json")
def _load_custom_presets():
"""从 JSON 文件加载自定义预设"""
global CUSTOM_PRESETS
if os.path.exists(_PRESETS_FILE):
try:
with open(_PRESETS_FILE, "r", encoding="utf-8") as f:
data = json.load(f)
for name, preset in data.items():
# 恢复 tuple
for key in ("base_color", "emission_color"):
if key in preset:
preset[key] = tuple(preset[key])
CUSTOM_PRESETS[name] = preset
except (json.JSONDecodeError, OSError):
pass
def _save_custom_presets():
"""保存自定义预设到 JSON 文件"""
data = {}
for name, preset in CUSTOM_PRESETS.items():
entry = dict(preset)
for key in ("base_color", "emission_color"):
if key in entry and hasattr(entry[key], "__iter__"):
entry[key] = list(entry[key])
data[name] = entry
try:
with open(_PRESETS_FILE, "w", encoding="utf-8") as f:
json.dump(data, f, ensure_ascii=False, indent=2)
except OSError:
pass
def _get_all_presets():
"""合并内置预设 + 自定义预设"""
merged = dict(PRESET_MATERIALS)
merged.update(CUSTOM_PRESETS)
return merged
def get_categories(self, context):
cats = sorted(set(p["category"] for p in PRESET_MATERIALS.values()))
custom_cats = sorted(set(p["category"] for p in CUSTOM_PRESETS.values()))
for c in custom_cats:
if c not in cats:
cats.append(c)
items = [("ALL", "全部", "显示所有预设")]
for c in cats:
items.append((c, c, f"{c}类材质"))
return items
PBR_ASSET_ROOT_DEFAULT = "D:/blenderwork/material-assets"
PBR_MANIFEST_FILENAME = "manifest.json"
_PBR_MANIFEST_CACHE = {}
def _normalize_asset_root(asset_root):
root = asset_root.strip() if asset_root else PBR_ASSET_ROOT_DEFAULT
return bpy.path.abspath(root)
def _load_pbr_manifest(asset_root):
"""读取真实 PBR 材质库 manifest。"""
root = _normalize_asset_root(asset_root)
manifest_path = os.path.join(root, PBR_MANIFEST_FILENAME)
if not os.path.exists(manifest_path):
return {"version": 1, "root": root, "materials": []}
try:
mtime = os.path.getmtime(manifest_path)
except OSError:
mtime = None
cached = _PBR_MANIFEST_CACHE.get(manifest_path)
if cached and cached.get("mtime") == mtime:
return cached["data"]
try:
with open(manifest_path, "r", encoding="utf-8") as f:
data = json.load(f)
except (json.JSONDecodeError, OSError):
data = {"version": 1, "root": root, "materials": []}
data.setdefault("materials", [])
_PBR_MANIFEST_CACHE[manifest_path] = {"mtime": mtime, "data": data}
return data
def _get_pbr_asset_root(context):
props = getattr(context.scene, "matmgr_props", None) if context and context.scene else None
if props and getattr(props, "pbr_asset_root", ""):
return _normalize_asset_root(props.pbr_asset_root)
return PBR_ASSET_ROOT_DEFAULT
def _resolve_asset_path(asset_root, relative_path):
if not relative_path:
return ""
if os.path.isabs(relative_path):
return relative_path
return os.path.normpath(os.path.join(_normalize_asset_root(asset_root), relative_path))
def _validate_pbr_asset_entry(entry, asset_root):
maps = entry.get("maps", {}) if isinstance(entry, dict) else {}
if not entry.get("id") or not maps:
return False
for rel_path in maps.values():
if rel_path and os.path.exists(_resolve_asset_path(asset_root, rel_path)):
return True
return False
def _get_pbr_materials(context):
asset_root = _get_pbr_asset_root(context)
manifest = _load_pbr_manifest(asset_root)
materials = []
for entry in manifest.get("materials", []):
if _validate_pbr_asset_entry(entry, asset_root):
materials.append(entry)
return materials
def _get_pbr_categories(self, context):
materials = _get_pbr_materials(context)
cats = sorted(set(entry.get("category", "其他") for entry in materials))
items = [("ALL", "全部", "显示所有真实材质")]
for c in cats:
items.append((c, c, f"{c}类真实材质"))
return items
# ═══════════════════════════════════════════════════════════
# 属性组 — 自定义材质参数
# ═══════════════════════════════════════════════════════════
class MaterialParamsProperty(PropertyGroup):
"""存储自定义材质参数"""
name: StringProperty(name="名称", default="New Material")
base_color: FloatVectorProperty(
name="基础色", subtype="COLOR",
default=(0.8, 0.8, 0.8, 1.0), size=4,
min=0.0, max=1.0,
)
roughness: FloatProperty(
name="粗糙度", default=0.4,
min=0.0, max=1.0, precision=3,
)
metallic: FloatProperty(
name="金属度", default=0.0,
min=0.0, max=1.0, precision=3,
)
specular: FloatProperty(
name="高光强度", default=0.5,
min=0.0, max=1.0, precision=3,
)
specular_tint: FloatProperty(
name="高光染色", default=0.0,
min=0.0, max=1.0, precision=3,
)
transmission: FloatProperty(
name="透射", default=0.0,
min=0.0, max=1.0, precision=3,
)
ior: FloatProperty(
name="折射率(IOR)", default=1.45,
min=1.0, max=3.0, precision=3,
)
subsurface: FloatProperty(
name="次表面散射", default=0.0,
min=0.0, max=1.0, precision=3,
)
clearcoat: FloatProperty(
name="清漆层", default=0.0,
min=0.0, max=1.0, precision=3,
)
clearcoat_roughness: FloatProperty(
name="清漆粗糙度", default=0.03,
min=0.0, max=1.0, precision=3,
)
sheen: FloatProperty(
name="光泽", default=0.0,
min=0.0, max=100.0, precision=1,
)
sheen_tint: FloatProperty(
name="光泽染色", default=0.5,
min=0.0, max=1.0, precision=3,
)
emission_color: FloatVectorProperty(
name="自发光颜色", subtype="COLOR",
default=(0.0, 0.0, 0.0, 1.0), size=4,
min=0.0, max=1.0,
)
emission_strength: FloatProperty(
name="自发光强度", default=0.0,
min=0.0, max=1000.0, precision=1,
)
alpha: FloatProperty(
name="透明度", default=1.0,
min=0.0, max=1.0, precision=3,
)
# ═══════════════════════════════════════════════════════════
# 辅助函数
# ═══════════════════════════════════════════════════════════
# ── 输入名 → (属性名, 默认值, 转换函数) ──
# 转换函数: None=直接赋值, "rgba_from_float"=float→RGBA, "float_from_rgba"=RGBA→float
_PRINCIPLED_INPUTS = {
"Base Color": ("base_color", (0.8, 0.8, 0.8, 1.0), None),
"Roughness": ("roughness", 0.4, None),
"Metallic": ("metallic", 0.0, None),
"Specular IOR Level": ("specular", 0.5, None),