Browse Source

weekend stuff

shuvit 3 years ago
parent
commit
82ff720fed
3 changed files with 99 additions and 57 deletions
  1. 27
    1
      colors.py
  2. 70
    55
      menuV3.py
  3. 2
    1
      scene_init.py

+ 27
- 1
colors.py View File

@@ -118,8 +118,9 @@ def main():
118 118
 main()
119 119
 
120 120
 
121
-def update_tuck_tex():
121
+def update_truck_tex():
122 122
     #deck graphic testing
123
+    #pass
123 124
     import glob
124 125
     scene = bge.logic.getCurrentScene()
125 126
     deck = scene.objects["deck"]
@@ -140,5 +141,30 @@ def update_tuck_tex():
140 141
     deck_name = deck_name.replace("\\", "")  
141 142
     print('deck texture updted to ', deck_name)
142 143
     dict['deck_name'] = deck_name
144
+    
145
+def update_shirt_tex():
146
+    #pass
147
+    #deck graphic testing
148
+    import glob
149
+    scene = bge.logic.getCurrentScene()
150
+    #deck = scene.objects["deck"]
151
+    shirt = scene.objects["Char4:Zshirtt1"]
152
+    mainDir = bge.logic.expandPath("//")
153
+    fileName2 = mainDir + "textures\\shirt\\*.png"    
154
+    shirtList = glob.glob(fileName2)
155
+    dict['shirtList'] = shirtList  
156
+    ID = texture.materialID(shirt, 'MAshirt')
157
+    shirt_texture = texture.Texture(shirt, ID)
158
+    new_source2 = texture.ImageFFmpeg(shirtList[dict["shirt_logo"]])
159
+    bge.logic.texture2 = shirt_texture
160
+    bge.logic.texture2.source = new_source2
161
+    bge.logic.texture2.refresh(False)
162
+    shirt_name = shirtList[dict['shirt_logo']]
163
+    shirt_name = shirt_name.replace(mainDir, '')
164
+    shirt_name = shirt_name.replace('textures\shirt', '' )
165
+    shirt_name = shirt_name.replace('.png', '')   
166
+    shirt_name = shirt_name.replace("\\", "")  
167
+    print('shirt texture updted to ', shirt_name)
168
+    dict['shirt_name'] = shirt_name    
143 169
 
144 170
 

+ 70
- 55
menuV3.py View File

@@ -584,71 +584,86 @@ def endpoint(funct, motion, dict, cont):
584 584
     if funct == 'deck graphic':
585 585
         if motion == 'inc':
586 586
             dict['deck_index'] = int(dict['deck_index'])
587
-            if dict['deck_index'] < len(dict['deckList']):
587
+            if dict['deck_index'] < ((len(dict['deckList']) - 1)):
588 588
                 dict['deck_index'] += 1
589
-                colors.update_tuck_tex() 
589
+                colors.update_truck_tex() 
590 590
                 
591 591
         if motion == 'dec':
592 592
             dict['deck_index'] = int(dict['deck_index'])
593 593
             if dict['deck_index'] > 0 :                
594 594
                 dict['deck_index'] -= 1                
595
-                colors.update_tuck_tex() 
595
+                colors.update_truck_tex() 
596
+                
596 597
                 
597 598
                 
598
-        
599
-        
600 599
     if funct == 'shirt logo':
601
-        logo = dict['shirt_logo']               
602
-        logo1 = shirt.meshes[0].materials[0].textures[6]
603
-        logo2 = shirt.meshes[0].materials[0].textures[7]
604
-        logo3 = shirt.meshes[0].materials[0].textures[5]        
605
-        if motion == 'inc':
606
-            if logo == 0:
607
-                logo = 1
608
-            elif logo == 1:
609
-                logo = 2   
610
-            elif logo == 2:
611
-                logo = 3
612
-            elif logo == 3:
613
-                logo = 0                                
600
+        if motion == 'inc':
601
+            dict['shirt_logo'] = int(dict['shirt_logo'])
602
+            if dict['shirt_logo'] < len(dict['shirtList']):
603
+                dict['shirt_logo'] += 1
604
+                colors.update_shirt_tex() 
605
+                
614 606
         if motion == 'dec':
615
-            if logo == 0:
616
-                logo = 3
617
-            elif logo == 1:
618
-                logo = 0   
619
-            elif logo == 2:
620
-                logo = 1 
621
-            elif logo == 3:
622
-                logo = 2                                               
623
-        if logo == 1:
624
-            logo1.diffuseIntensity = 1
625
-            logo2.diffuseIntensity = 0
626
-            logo1.diffuseFactor = 1
627
-            logo2.diffuseFactor = 0
628
-            logo3.diffuseIntensity = 0
629
-            logo3.diffuseFactor = 0
630
-        if logo == 2:
631
-            logo1.diffuseIntensity = 0
632
-            logo1.diffuseFactor = 0
633
-            logo2.diffuseIntensity = 1 
634
-            logo2.diffuseFactor = 1  
635
-            logo3.diffuseIntensity = 0
636
-            logo3.diffuseFactor = 0            
637
-        if logo == 3:
638
-            logo1.diffuseIntensity = 0
639
-            logo1.diffuseFactor = 0
640
-            logo2.diffuseIntensity = 0 
641
-            logo2.diffuseFactor = 0  
642
-            logo3.diffuseIntensity = 1
643
-            logo3.diffuseFactor = 1                                 
644
-        if logo == 0:
645
-            logo1.diffuseIntensity = 0
646
-            logo2.diffuseIntensity = 0            
647
-            logo1.diffuseFactor = 0
648
-            logo2.diffuseFactor = 0
649
-            logo3.diffuseIntensity = 0
650
-            logo3.diffuseFactor = 0            
651
-        dict['shirt_logo']  = logo
607
+            dict['shirt_logo'] = int(dict['shirt_logo'])
608
+            if dict['shirt_logo'] > 0 :                
609
+                dict['shirt_logo'] -= 1                
610
+                colors.update_shirt_tex()                 
611
+                
612
+                
613
+        
614
+        
615
+#    if funct == 'shirt logo':
616
+#        logo = dict['shirt_logo']               
617
+#        logo1 = shirt.meshes[0].materials[0].textures[6]
618
+#        logo2 = shirt.meshes[0].materials[0].textures[7]
619
+#        logo3 = shirt.meshes[0].materials[0].textures[5]        
620
+#        if motion == 'inc':
621
+#            if logo == 0:
622
+#                logo = 1
623
+#            elif logo == 1:
624
+#                logo = 2   
625
+#            elif logo == 2:
626
+#                logo = 3
627
+#            elif logo == 3:
628
+#                logo = 0                                
629
+#        if motion == 'dec':
630
+#            if logo == 0:
631
+#                logo = 3
632
+#            elif logo == 1:
633
+#                logo = 0   
634
+#            elif logo == 2:
635
+#                logo = 1 
636
+#            elif logo == 3:
637
+#                logo = 2                                               
638
+#        if logo == 1:
639
+#            logo1.diffuseIntensity = 1
640
+#            logo2.diffuseIntensity = 0
641
+#            logo1.diffuseFactor = 1
642
+#            logo2.diffuseFactor = 0
643
+#            logo3.diffuseIntensity = 0
644
+#            logo3.diffuseFactor = 0
645
+#        if logo == 2:
646
+#            logo1.diffuseIntensity = 0
647
+#            logo1.diffuseFactor = 0
648
+#            logo2.diffuseIntensity = 1 
649
+#            logo2.diffuseFactor = 1  
650
+#            logo3.diffuseIntensity = 0
651
+#            logo3.diffuseFactor = 0            
652
+#        if logo == 3:
653
+#            logo1.diffuseIntensity = 0
654
+#            logo1.diffuseFactor = 0
655
+#            logo2.diffuseIntensity = 0 
656
+#            logo2.diffuseFactor = 0  
657
+#            logo3.diffuseIntensity = 1
658
+#            logo3.diffuseFactor = 1                                 
659
+#        if logo == 0:
660
+#            logo1.diffuseIntensity = 0
661
+#            logo2.diffuseIntensity = 0            
662
+#            logo1.diffuseFactor = 0
663
+#            logo2.diffuseFactor = 0
664
+#            logo3.diffuseIntensity = 0
665
+#            logo3.diffuseFactor = 0            
666
+#        dict['shirt_logo']  = logo
652 667
         
653 668
     if funct == 'brightness / contrast on':
654 669
         if motion == 'inc':

+ 2
- 1
scene_init.py View File

@@ -162,8 +162,9 @@ def main():
162 162
     own['no_grind_timer'] = 0
163 163
     own['last_jump_frame'] = 0
164 164
     
165
+    colors.update_shirt_tex() 
166
+    colors.update_truck_tex()
165 167
     
166
-    colors.update_tuck_tex() 
167 168
     print('scene init ran')
168 169
       
169 170
 main()

Loading…
Cancel
Save