Exemple #1
0
 def __init__(self):
     try:
         log('MyBob.__init__', self.engineObj)
         self.count = 0
         self.SetActorTickEnabled(True)
     except:
         logTB()
Exemple #2
0
 def Tick(self, dt):
     self.Update(dt)
     cur = self.arm.GetRelativeRotation()
     cur.roll += 1
     self.arm.SetRelativeRotation(cur)
     if time.time() > self.created+5:
         log('DESTROYING', self)
         self.Destroy()
Exemple #3
0
 def BeginPlay(self):
     self.SuperBeginPlay()
     log('HackyWorldHookActor.BeginPlay')
Exemple #4
0
 def DoSomething(self, i):
     try:
         log('Do something!', self, i)
         self.SetActorRotation(FRotator(RR(0,360), RR(0,360), RR(0,360)))
     except:
         logTB()
Exemple #5
0
 def OnSelectionChanged(self, *args, **kwargs):
     log('ON SELCH', self, args, kwargs)
Exemple #6
0
 def HandleBeginPlay(self):
     log('MyGameState.HandleBeginPlay')
Exemple #7
0
 def Init(self):
     log('MyGameInstance.Init') # I think either InitializePlayInEditor or InitializeStandalone are called *before* this one
Exemple #8
0
 def OnHomerDead(self, sentry, reason):
     log('AAAAAAAAAAAAAAAAAA homer has died', sentry, reason)
Exemple #9
0
 def OverrideGameModeClass(self, *args):
     log('MyGameInstance.OverrideGameModeClass')
Exemple #10
0
 def __init__(self, engineObj):
     self.engineObj = engineObj
     log('MyGameInstance.__init__')
Exemple #11
0
 def StartGameInstance(self):
     log('MyGameInstance.StartGameInstance') # I think this is called in a packaged game, while StartPlayInEditorGameInstance is called in PIE (and it should just call StartGameInstance)
Exemple #12
0
 def Shutdown(self):
     log('MyGameInstance.Shutdown')
Exemple #13
0
 def OnStart(self):
     log('MyGameInstance.OnStart') # "Called when the game instance is started either normally or through PIE." - called after Init
Exemple #14
0
 def SomeAPI(self):
     log('MyBob.SomeAPI ya\'ll!!!')
Exemple #15
0
def Init():
    '''called from ue4 when this module is loaded on startup (or, in dev, when the c++ game module is recompiled'''
    log('main.Init called')
Exemple #16
0
def B2():
    for a in uepy.UGameplayStatics.GetAllActorsOfClass(uepy.GetWorld(), MyBob):
        a = uepy.ABobActor.Cast(a)
        log('A:', a) #, a.engineObj)
        a.SomeAPI()
Exemple #17
0
def OnPreBeginPIE():
    log('main.OnPreBeginPIE called')
    global myactors
    myactors = reload(myactors)
Exemple #18
0
    def Construct(self, vboxRoot):
        log('editor_spawner.SpawnerTab.Construct:', vboxRoot)
        vboxRoot = umg.UVerticalBox.Cast(vboxRoot)

        margin = uepy.FMargin(5, 5, 5, 5)

        # Row: combo box of class names + refresh button
        hb = umg.UHorizontalBox.Cast(
            umg.CreateWidget(vboxRoot, umg.UHorizontalBox, 'hb'))
        slot = umg.UVerticalBoxSlot.Cast(vboxRoot.AddChild(hb))
        slot.SetPadding(margin)

        self.comboBox = umg.UComboBoxString.Cast(
            umg.CreateWidget(hb, umg.UComboBoxString, 'comboBox'))
        self.comboBox.SetFontSize(11)
        umg.UHorizontalBoxSlot.Cast(hb.AddChild(
            self.comboBox)).SetPadding(margin)
        self.RepopulateClassList()
        self.comboBox.BindOnSelectionChanged(self.OnSelectionChanged)

        spawnButton = umg.UButton.Cast(
            umg.CreateWidget(hb, umg.UButton, 'spawnButton'))
        umg.UHorizontalBoxSlot.Cast(
            hb.AddChild(spawnButton)).SetPadding(margin)
        label = umg.UTextBlock.Cast(
            umg.CreateWidget(spawnButton, umg.UTextBlock, 'textblock'))
        label.SetText('Spawn')
        label.SetFontSize(11)
        spawnButton.SetContent(label)
        spawnButton.BindOnClicked(self.OnSpawnClicked)

        refreshButton = umg.UButton.Cast(
            umg.CreateWidget(hb, umg.UButton, 'refreshButton'))
        umg.UHorizontalBoxSlot.Cast(
            hb.AddChild(refreshButton)).SetPadding(margin)
        label = umg.UTextBlock.Cast(
            umg.CreateWidget(refreshButton, umg.UTextBlock, 'textblock'))
        label.SetText('Refresh')
        label.SetFontSize(11)
        refreshButton.SetContent(label)
        refreshButton.BindOnClicked(self.OnRefreshClicked)

        if 0:
            # Row: checkbox (delete old instances) + text
            hb = umg.UHorizontalBox.Cast(
                umg.CreateWidget(vboxRoot, umg.UHorizontalBox, 'hb2'))
            slot = umg.UVerticalBoxSlot.Cast(vboxRoot.AddChild(hb))
            slot.SetPadding(margin)

            self.locationCheckbox = umg.UCheckBox.Cast(
                umg.CreateWidget(hb, umg.UCheckBox, 'checkbox'))
            umg.UHorizontalBoxSlot.Cast(hb.AddChild(
                self.locationCheckbox)).SetPadding(margin)
            self.locationCheckbox.SetIsChecked(True)
            self.hackCheck = self.locationCheckbox.BindOnCheckStateChanged(
                self.OnCheckStateChanged)

            label = umg.UTextBlock.Cast(
                umg.CreateWidget(hb, umg.UTextBlock, 'label'))
            slot = umg.UHorizontalBoxSlot.Cast(hb.AddChild(label))
            slot.SetVerticalAlignment(uepy.enums.EVerticalAlignment.Center)
            slot.SetPadding(margin)
            label.SetText('Delete old instances before spawning')
        else:
            # msg telling them to use sourcewatcher
            hb = umg.UHorizontalBox.Cast(
                umg.CreateWidget(vboxRoot, umg.UHorizontalBox, 'hb2'))
            slot = umg.UVerticalBoxSlot.Cast(vboxRoot.AddChild(hb))
            label.SetFontSize(11)
            slot.SetPadding(margin)

            label = umg.UTextBlock.Cast(
                umg.CreateWidget(hb, umg.UTextBlock, 'label'))
            label.SetFontSize(11)
            slot = umg.UHorizontalBoxSlot.Cast(hb.AddChild(label))
            slot.SetVerticalAlignment(uepy.enums.EVerticalAlignment.Center)
            slot.SetPadding(margin)
            label.SetText(
                'Instead of using this spawner, ask dave about using sourcewatcher!'
            )
Exemple #19
0
        log('HackyWorldHookActor.BeginPlay')

    def Tick(self, dt):
        self.watcher.Check()

def Boom():
    for a in uepy.UGameplayStatics.GetAllActorsOfClass(uepy.GetWorld(), MySO):
        p = uepy.PyInst(a)
        p.angle = p.angleTarget = 0

class ABobActor_PGLUE(uepy.AActor_PGLUE):
    def SomeAPI(self): self.engineObj.SomeAPI()
uepy.CPROPS(ABobActor_PGLUE ,'bpProp', 'cProp')

bases = [b for b in ABobActor_PGLUE.__bases__ if b != object]
log('BOB PGLUE:', type(ABobActor_PGLUE) is uepy.PyGlueMetaclass, bases)

class MyBob(ABobActor_PGLUE):
    def __init__(self):
        try:
            log('MyBob.__init__', self.engineObj)
            self.count = 0
            self.SetActorTickEnabled(True)
        except:
            logTB()

    def Tick(self, dt):
        self.count += 1
        #if not self.count % 100:
        #    log('TICKING', self.count, self.bpProp, self.cProp)
Exemple #20
0
 def OnCheckStateChanged(self, *args, **kwargs):
     log('ON CHECK', self, args, kwargs)
Exemple #21
0
 def __init__(self, engineObj):
     self.engineObj = engineObj
     log('MyGameState.__init__')