Godot-Python quick guide

Pubblicato il: 29 ottobre 2022
sul canale di: Average Godot Enjoyer
5,133
124

0:00 Intro
1:02 Installing Godot-Python
2:30 Restarting Godot
3:25 Creating A Python Script
4:03 Creating a Function
5:00 Signal via Editor
7:00 Signals via Code
9:00 Node Functions
9:35 Node Attributes
10:22 Tkinter Module Test
12:00 Godot Webcam
18:00 Installing via PIP
19:27 No module named pip error
20:55 Wowee! It works

Below is the webcam Script:




from godot import exposed, export
from godot import *

import cv2

@exposed
class FirstScene(Spatial):

member variables here, example:
a = export(int)
b = export(str, default='foo')

def _ready(self):
self.set_process(False)
cv2.namedWindow("preview")
self.vc = cv2.VideoCapture(0)
print("hello")
self.cam_open=False
self.set_process(True)


def _process(self, delta):
if self.cam_open:
cv2.imshow("preview", self.frame)
self.rval, self.frame = self.vc.read()

def _on_Button_pressed(self):
if self.cam_open:
self.cam_open = False
self.vc.release()
cv2.destroyWindow("preview")
else:
self.cam_open = True
if self.vc.isOpened(): # try to get the first frame
self.rval, self.frame = self.vc.read()





This is the signal script:

from godot import exposed, export
from godot import *


@exposed
class Signals(Spatial):

def _ready(self):
button = self.get_node("Button")
self.my_var=10
list=self.get_children()
list[0].set_visible(False)
list[0].visible=True
button.connect("pressed", self, "button_pressed")
def _process(self, delta):
print(self.my_var)

def button_pressed(self):
print("You have pressed the Button")


In questa pagina del sito puoi guardare il video online Godot-Python quick guide della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Average Godot Enjoyer 29 ottobre 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 5,133 volte e gli è piaciuto 124 spettatori. Buona visione!