9
9
import importlib
10
10
importlib .reload (apply_all )
11
11
importlib .reload (apply_multi_user )
12
+ importlib .reload (vertex_color_picker )
12
13
else :
13
14
from . import apply_all
14
15
from . import apply_multi_user
16
+ from . import vertex_color_picker
15
17
16
18
import bpy
17
19
@@ -452,6 +454,23 @@ def execute(self, context):
452
454
# raise the exception again
453
455
raise e
454
456
457
+ class VertexColorPicker (bpy .types .Operator ):
458
+ bl_idname = "object.color_picker"
459
+ bl_label = "Vertex color picker"
460
+
461
+ def execute (self , context ):
462
+ try :
463
+ self .report (
464
+ {"INFO" }, "----- ----- ----- Sougen Scripts ----- ----- -----" )
465
+ self .report ({"INFO" }, "Vertex color processing processing" )
466
+ vertex_color_picker .vertex_color_picker (self , context )
467
+ return {"FINISHED" }
468
+ except Exception as e :
469
+ print ("Something went wrong" )
470
+ self .report ({"ERROR" }, "Something went wrong" )
471
+ # raise the exception again
472
+ raise e
473
+
455
474
456
475
def curves_export (self , context ):
457
476
bpy .context .window .cursor_set ("WAIT" )
@@ -604,6 +623,16 @@ def draw(self, context):
604
623
else :
605
624
col2 .prop (context .scene , "unlit" )
606
625
626
+ box3 = layout .box ()
627
+ col3 = box3 .column ()
628
+ row3 = col3 .row ()
629
+ row4 = col3 .row ()
630
+
631
+
632
+ row3 .prop (context .scene , "color_treshold" )
633
+ row4 .operator (
634
+ "object.color_picker" , icon = "MOD_VERTEX_WEIGHT" , depress = loading
635
+ )
607
636
layout .operator (
608
637
"object.simple_operator" , icon = "VIEW_CAMERA" , depress = loading
609
638
)
@@ -620,8 +649,9 @@ def draw(self, context):
620
649
icon = "EDITMODE_HLT" , depress = loading )
621
650
622
651
652
+
623
653
blender_classes = [BakeCamera , SimpleGLTF , GLTF_Collider ,
624
- GLTF_PT_Panel , GLTF_Instance , Curves_Export , ApplyMultiUser ]
654
+ GLTF_PT_Panel , GLTF_Instance , Curves_Export , ApplyMultiUser , VertexColorPicker ]
625
655
626
656
627
657
def register ():
@@ -658,6 +688,14 @@ def register():
658
688
min = 0 ,
659
689
max = 10 ,
660
690
)
691
+ bpy .types .Scene .color_treshold = bpy .props .FloatProperty (
692
+ name = "Color threshold:" ,
693
+ description = "Vertex color treshold" ,
694
+ default = 0.2 ,
695
+ min = 0.01 ,
696
+ max = 1 ,
697
+ )
698
+
661
699
bpy .types .Scene .unlit = bpy .props .BoolProperty (
662
700
name = "Use KHR Unlit" ,
663
701
description = "Convert materials from metal/rough to unlit" ,
@@ -675,5 +713,6 @@ def unregister():
675
713
del bpy .types .Scene .filename_path
676
714
del bpy .types .Scene .draco
677
715
del bpy .types .Scene .draco_level
716
+ del bpy .types .Scene .color_treshold
678
717
del bpy .types .Scene .unlit
679
718
del bpy .types .Scene .gltf_sys
0 commit comments