mirror of
https://forge.apps.education.fr/blender-edutech/ropy.git
synced 2024-01-27 08:23:20 +01:00
Finalisation de la fonction couleur.
This commit is contained in:
parent
2f844078ad
commit
2f9c122eaa
BIN
ropy-23.blend
BIN
ropy-23.blend
Binary file not shown.
33
rp_cmd.py
33
rp_cmd.py
@ -56,17 +56,32 @@ def commandes():
|
||||
# print ("fini")
|
||||
|
||||
mrp_avancer()
|
||||
rp_couleur("Balise", (1, 0.003, 0.012, 1))
|
||||
|
||||
rp_couleur("Rover 1", (1, 0.003, 0.012, 1))
|
||||
mrp_avancer()
|
||||
mrp_avancer()
|
||||
mrp_avancer()
|
||||
for i in range(10):
|
||||
rp_couleur("Balise", (1, 0.503, 0.018, 1))
|
||||
rp_tempo(0.1)
|
||||
rp_couleur("Balise", (1, 0.003, 0.012, 1))
|
||||
rp_tempo(0.1)
|
||||
rp_couleur("Rover 2", (1, 0.003, 0.012, 1))
|
||||
rp_couleur("Rover 3", (1, 0.003, 0.012, 1))
|
||||
|
||||
rp_couleur("Station 1", (1, 0.003, 0.012, 1))
|
||||
rp_couleur("Station 2", (1, 0.003, 0.012, 1))
|
||||
rp_couleur("Station 3", (1, 0.003, 0.012, 1))
|
||||
rp_couleur("Station 4", (1, 0.003, 0.012, 1))
|
||||
|
||||
rp_couleur("Station cube 1", (1, 0.003, 0.012, 1))
|
||||
rp_couleur("Station cube 2", (1, 0.003, 0.012, 1))
|
||||
|
||||
for i in range(20):
|
||||
mrp_avancer()
|
||||
for i in range(20):
|
||||
rp_couleur("Balise "+str(i), (1, 1-i/19, 1-i/19, 1))
|
||||
rp_droite()
|
||||
|
||||
# rp_couleur_init("Station 1")
|
||||
# rp_couleur_init("Station 2")
|
||||
# rp_couleur_init("Station 3")
|
||||
# rp_couleur_init("Station 4")
|
||||
|
||||
# rp_couleur_init()
|
||||
|
||||
# rp_marquer()
|
||||
# rp_gauche()
|
||||
# rp_avancer()
|
||||
|
@ -1,11 +1,11 @@
|
||||
<data>
|
||||
<config>
|
||||
<speed>1.0</speed>
|
||||
<speed>4.0</speed>
|
||||
<sound>False</sound>
|
||||
<cam>
|
||||
<worldPosition.x>-4.301222801208496</worldPosition.x>
|
||||
<worldPosition.y>-16.72665786743164</worldPosition.y>
|
||||
<worldPosition.z>17.38153076171875</worldPosition.z>
|
||||
<worldPosition.x>-0.6072205305099487</worldPosition.x>
|
||||
<worldPosition.y>-28.834430694580078</worldPosition.y>
|
||||
<worldPosition.z>22.768606185913086</worldPosition.z>
|
||||
</cam>
|
||||
</config>
|
||||
<mission>
|
||||
|
@ -87,7 +87,11 @@ card_description.update({"speed-card" : [rp_speed_title, rp_speed_text, rp_speed
|
||||
|
||||
# Paint - Peinture
|
||||
rp_paint_title="Peinture"
|
||||
rp_paint_text="FIXME"
|
||||
# rp_paint_text=" L'amélioration \"Peinture\" permet de \n changer la couleur des objets. \n\n"
|
||||
rp_paint_text=" rp_couleur(objets, couleur) \n -> Change la couleur du groupe \n d'objets 3d. \n"
|
||||
rp_paint_text=rp_paint_text + " - La couleur est un tuple au format \n (R,V,B,Alpha) avec des valeurs de 0 à 1.\n"
|
||||
rp_paint_text=rp_paint_text + " - objets peut être : \"Rover 1\",\n \"Rover 2\", \"Rover 3\", \"Station 1\", \n \"Station 2\", \"Station 3\", \"Station 4\", \n \"Balises\" ou \"Balise 1\" à \"Balise 200\".\n\n"
|
||||
rp_paint_text=rp_paint_text + " rp_couleur_init(objets) \n -> Réinitialise la couleur des objets.\n rp_couleur_init() réinitialise tout !\n"
|
||||
rp_paint_type="upgrade"
|
||||
card_description.update({"paint-card" : [rp_paint_title, rp_paint_text, rp_paint_type]})
|
||||
|
||||
|
48
rp_lib.py
48
rp_lib.py
@ -504,7 +504,6 @@ color_yellow = (1, 0.503, 0.018, 1)
|
||||
color_black = (0.019794, 0.032076, 0.037408, 1)
|
||||
color_white = (0.799, 0.799, 0.799, 1)
|
||||
color_windows_red = (0.617, 0.037, 0.019, 1)
|
||||
color_area_red = (1, 0.003, 0.012, 1) # Balise
|
||||
color_light_red = (1, 0.003, 0.012, 1) # Balise
|
||||
color_stone = (0.191, 0.227, 0.246, 1)
|
||||
color_wooddark = (0.153, 0.117, 0.107, 1)
|
||||
@ -512,7 +511,7 @@ color_metal = (0.401, 0.478, 0.518, 1)
|
||||
|
||||
# Objets 3D par groupe
|
||||
paint_part ={}
|
||||
all_group_part = ("Rover 1", "Rover 2", "Rover 3", "Station 1", "Station 2", "Station 3", "Station cube 1", "Station cube 2", "Balise", "Stone", "Metal", "Black", "Red windows")
|
||||
all_group_part = ("Rover 1", "Rover 2", "Rover 3", "Station 1", "Station 2", "Station 3", "Station 4", "Station cube 1", "Station cube 2", "Stone", "Metal", "Black", "Red windows")
|
||||
paint_part.update({"Stone" : [['Rv-Wheel-left-front', 'Rv-Wheel-right-front','Rv-Wheel-left-mid', 'Rv-Wheel-right-mid', 'Rv-Wheel-left-rear', 'Rv-Wheel-right-rear'],color_stone]}) # Stone
|
||||
paint_part.update({"Metal" : [['Rv-Power source', 'Rv-Mast-arm', 'Rv-Antenna-1', 'St-Sheath'],color_metal]}) # Metal
|
||||
paint_part.update({"Black" : [['St-Block1-foot1','St-Block1-foot2','St-Block1-foot3', 'St-Door-2', 'St-Stair-2','St-Cable1','St-Cable2'],color_black]}) # Black
|
||||
@ -524,7 +523,7 @@ rover_partlist =['Rover (Rv-Body-1)', 'Rv-Body-2', 'Rv-Body-3', 'Rv-Body-4', 'Rv
|
||||
'Rv-Power source', 'Rv-Power source-2', 'Rv-Power source-3', 'Rv-Power source-4', 'Rv-Power source-5',
|
||||
'Rv-Wheel-left-front', 'Rv-Wheel-right-front','Rv-Wheel-left-mid', 'Rv-Wheel-right-mid', 'Rv-Wheel-left-rear', 'Rv-Wheel-right-rear']
|
||||
paint_part.update({"Rover 1" : [['Rv-Body-2', 'Rv-Body-7', 'Rv-Power source-2', 'Rv-Power source-5', 'Rv-Mast-3', 'Rv-Mast-4', 'Rv-Mast-cap', 'Rv-Antenna-2'],color_yellow]}) # Jaune
|
||||
paint_part.update({"Rover 2" : [['Rover', 'Rv-Mast', 'Rv-Antenna-3'],color_white]}) # Blanc
|
||||
paint_part.update({"Rover 2" : [['Rover', 'Rv-Body-6', 'Rv-Mast', 'Rv-Antenna-3'],color_white]}) # Blanc
|
||||
paint_part.update({"Rover 3" : [['Rv-Body-3', 'Rv-Body-4', 'Rv-Power source-3', 'Rv-Power source-4','Rv-Mast-2'],color_wooddark]}) # WoodDark
|
||||
|
||||
# Station
|
||||
@ -532,28 +531,34 @@ station_partlist =['St-Block1', 'St-Block2', 'St-Block3',
|
||||
'St-Block1-side1', 'St-Block1-side2', 'St-Block1-roof', 'St-Block1-foot1', 'St-Block1-foot2','St-Block1-foot3',
|
||||
'St-Door', 'St-Door-2', 'St-Block1-window', 'St-Stair', 'St-Stair-2', 'St-Stair-3','St-Block1-panel-support',
|
||||
'St-Block2-side', 'St-Block2-window', 'St-Block2-roof',
|
||||
'Block3-side', 'St-Block3-greenhouse', 'St-Block3-greenhouse-base', 'St-Tunnel', 'St-Tube', 'St-Cable1', 'St-Cable2', 'St-Sheath']
|
||||
'St-Block3-side', 'St-Block3-greenhouse', 'St-Block3-greenhouse-base', 'St-Tunnel', 'St-Tube', 'St-Cable1', 'St-Cable2', 'St-Sheath']
|
||||
paint_part.update({"Station 1" : [[ 'St-Door','St-Block1-side1','St-Block2-side','St-Block2-roof'],color_yellow]}) # Jaune
|
||||
paint_part.update({"Station 2" : [[ 'St-Block1','St-Block2','St-Block3','St-Tunnel','St-Tube'],color_white]}) # Blanc
|
||||
paint_part.update({"Station 3" : [[ 'St-Block1-roof', 'St-Block1-side2'],color_stone]}) # Stone
|
||||
paint_part.update({"Station 2" : [[ 'St-Block1','St-Block2','St-Block3','St-Block3-side2','St-Tunnel','St-Tube'],color_white]}) # Blanc
|
||||
paint_part.update({"Station 3" : [[ 'St-Block1-roof', 'St-Block1-side2', 'St-Block3-side1'],color_stone]}) # Stone
|
||||
paint_part.update({"Station 4" : [[ 'St-Stair'],color_metal]}) # Metal
|
||||
paint_part.update({"Station cube 1" : [[ 'St-Cube1-hole','St-Cube2-hole','St-Cube3-hole', 'St-Cube4-hole'],color_yellow]}) # Jaune
|
||||
paint_part.update({"Station cube 2" : [[ 'St-Cubes','St-Cube2','St-Cube3', 'St-Cube4'],color_white]}) # Blanc
|
||||
|
||||
# Balise
|
||||
beacon_partlist =['Beacon_antenne', 'Beacon_sphere']
|
||||
paint_part.update({"Balise" : [['Beacon_antenne', 'Beacon_sphere'],color_light_red]}) # Rouge
|
||||
# Balise : Objet lors de l'initialisation
|
||||
# beacon_partlist =['Beacon_antenne', 'Beacon_sphere']
|
||||
# paint_part.update({"Balise" : [['Beacon_antenne', 'Beacon_sphere'],color_light_red]}) # Rouge
|
||||
|
||||
# Mise en couleur
|
||||
def rp_couleur (group_part, new_color):
|
||||
if scene.objects['Points']['upgrade_paint']:
|
||||
if (debug_mvt):
|
||||
print ("Nouvelle couleur :", str(new_color),"->", group_part)
|
||||
if group_part != "Balise":
|
||||
if "Balise" not in group_part :
|
||||
for i in range (len(paint_part[group_part][0])):
|
||||
scene.objects[paint_part[group_part][0][i]].color = new_color
|
||||
else:
|
||||
for i in range (200):
|
||||
beacon = scene.objects["Beacon-"+str(i)]
|
||||
if group_part=="Balises":
|
||||
for i in range (200):
|
||||
beacon = scene.objects["Beacon-"+str(i)]
|
||||
beacon.children[0].color = new_color
|
||||
beacon.children[1].color = new_color
|
||||
elif "Balise " in group_part :
|
||||
beacon = scene.objects[group_part.replace("Balise ", "Beacon-")]
|
||||
beacon.children[0].color = new_color
|
||||
beacon.children[1].color = new_color
|
||||
|
||||
@ -561,7 +566,7 @@ def rp_couleur_detail (part, new_color):
|
||||
if scene.objects['Points']['upgrade_paint']:
|
||||
if (debug_mvt):
|
||||
print ("Nouvelle couleur :", str(new_color),"->", part)
|
||||
scene.objects[part].color = new_color
|
||||
scene.objects[part].color = new_color
|
||||
|
||||
# Initialisation de la couleur
|
||||
def rp_couleur_init (group_part=None):
|
||||
@ -575,24 +580,21 @@ def rp_couleur_init (group_part=None):
|
||||
else:
|
||||
for i in range (len(all_group_part)):
|
||||
for j in range (len(paint_part[all_group_part[i]][0])):
|
||||
print(paint_part[all_group_part[i]])
|
||||
scene.objects[paint_part[all_group_part[i]][0][j]].color = paint_part[all_group_part[i]][1]
|
||||
|
||||
# def rp_couleur_init_detail (element):
|
||||
# if scene.objects['Points']['upgrade_paint']:
|
||||
# if (debug_mvt):
|
||||
# print ("Réinitialisation couleur ->", element)
|
||||
# scene.objects[element].color = init_color
|
||||
for i in range (200):
|
||||
beacon = scene.objects["Beacon-"+str(i)]
|
||||
beacon.children[0].color = color_light_red
|
||||
beacon.children[1].color = color_light_red
|
||||
|
||||
# Affichage de la liste des composants 3D
|
||||
def rp_couleur_listedetail (element, new_color):
|
||||
if scene.objects['Points']['upgrade_paint']:
|
||||
if element=="Rover":
|
||||
print ("Composants 3D du Rover :", rover_partlist)
|
||||
print ("Mise en couleur : composants 3D du Rover :", rover_partlist)
|
||||
if element=="Station":
|
||||
print ("Composants 3D de la Station :", station_partlist)
|
||||
print ("Mise en couleur : composants 3D de la Station :", station_partlist)
|
||||
if element=="Balise":
|
||||
print ("Composants 3D d'une Balise :", beacon_partlist)
|
||||
print ("Mise en couleur : composants 3D des balises : Beacon-0.children[0|1] à Beacon-200.children[0|1].")
|
||||
|
||||
##
|
||||
# Changer la vitesse
|
||||
|
@ -42,7 +42,7 @@ storecard_description.update({"Store-speed-card" : [sc_speed_title, sc_speed_tex
|
||||
|
||||
# Paint - Peinture
|
||||
sc_paint_title="Peinture"
|
||||
sc_paint_text="Permet de changer la \ncouleur des objets."
|
||||
sc_paint_text="On refait la déco ?"
|
||||
storecard_description.update({"Store-paint-card" : [sc_paint_title, sc_paint_text]})
|
||||
|
||||
# Battery + - Batterie +
|
||||
|
Loading…
x
Reference in New Issue
Block a user