def tod3d7ref(): if npython.exists("/sys/share/display/21]"): if npython.exists("/sys/servers/gfx"): npython.delete("/sys/servers/gfx") gfx = npython.new("nd3d7server", "/sys/servers/gfx") npython.set("/sys/servers/gfx.setdisplaymode", "dev(21)-w(580)-h(420)") init_gfxserver() else: pass
def testSetCommand(self): # Returns an opaque 'Nebula Object' object = npython.new('n3dnode','four') # Select the object npython.sel('four') # Set a value on the object npython.set('txyz',0,30,0) # Clean up and delete object npython.sel('..') npython.delete('four')
def tod3d7tnlhal(): if npython.exists("/sys/servers/gfx"): npython.delete("/sys/servers/gfx") gfx = npython.new("nd3d7server", "/sys/servers/gfx") if npython.exists("/sys/share/display/10]"): npython.set("/sys/servers/gfx.setdisplaymode", "dev(10)-w(580)-h(420)") else: # puts ('"d3d','hardware','tl','not','supported!"') npython.set("/sys/servers/gfx.setdisplaymode", "w(580)-h(420)") init_gfxserver()
def menuCall(self): vars = ('lookat.txyz', 'lookat.rxyz', 'camera.tz') s = self.scripts[self.demo.get()] self.currentDemo.set(s.name) try: self.loadScript(s.file, s.brightness) for (var, val) in zip(vars, s.args): if val: npython.set('/usr/%s' % (var,), *val) except: traceback.print_exc()
def main(): demo = TekDemo() observerlib.init_observer() npython.set('/observer.setsleep', 0.02) npython.set('/observer.setgrid', 0) npython.set('/observer.startsinglestep') demo.menuCall() try: while not demo.stopRunning: npython.set('/observer.rendersinglestep') demo.update() except KeyboardInterrupt: pass
def loadScript(self, script, brightness): npython.sel('/') npython.delete('/usr/scene') npython.new('n3dnode', '/usr/scene') npython.set('/sys/servers/console.unwatch') npython.set('/sys/servers/time.starttime') npython.set('/sys/servers/shadow.setcastshadows', 0) if self.execNamespace.has_key('tl'): self.execNamespace['tl'].destroy() del self.execNamespace['tl'] npython.set('/sys/servers/time.lockdeltat', 0.0) gfx = npython.sel('/sys/servers/gfx') apply(gfx.setclearcolor, ((brightness),) * 4) self.execNamespace['bg'] = brightness print 'Executing', script execfile(script, self.execNamespace) observerlib.orig()
def toggleConsole(self): npython.set('/sys/servers/console.toggle')
def tod3d7emu(): if npython.exists("/sys/servers/gfx"): npython.delete("/sys/servers/gfx") gfx = npython.new("nd3d7server", "/sys/servers/gfx") npython.set("/sys/servers/gfx.setdisplaymode", "dev(20)-w(580)-h(420)") init_gfxserver()
def map_input(): cwd = npython.psel() npython.sel("/sys/servers/input") npython.set("beginmap") npython.set("map", "keyb0:shift.pressed", "dolly") npython.set("map", "keyb0:ctrl.pressed", "orbit") npython.set("map", "mouse0:btn0.pressed", "pan") npython.set("map", "mouse0:btn1.pressed", "orbit") npython.set("map", "mouse0:btn2.pressed", "dolly") npython.set("map", "keyb0:space.down", "script:orig()") npython.set("map", "keyb0:j.down", "script:janaview()") npython.set("map", "keyb0:esc.down", "script:npython.set('/sys/servers/console.toggle')") npython.set("endmap") npython.sel(cwd)
def init_gfxserver(): npython.set("/sys/servers/gfx.setviewvolume", -0.1, +0.1, -0.075, +0.075, +0.1, +2500) npython.set("/sys/servers/gfx.setclearcolor", 0.5, 0.5, 0.5, 0.5) npython.set("/sys/servers/gfx.opendisplay")
def looks(): npython.set("/usr/lookat.txyz", 0, 0, 10) npython.set("/usr/lookat.rxyz", 0, 90, 0) npython.set("/usr/camera.tz", 5)
def lookn(): npython.set("/usr/lookat.txyz", 0, 0, 10) npython.set("/usr/lookat.rxyz", 0, 0, 0) npython.set("/usr/camera.txyz", 0, 100, 20)
def janaview(): # puts ('"janaview"') npython.set("/usr/lookat.txyz", 0, 30, 0) npython.set("/usr/lookat.rxyz", -15, 0, 0) npython.set("/usr/camera.tz", 35)
def orig(): npython.set("/usr/lookat.txyz", 0, 0, 0) npython.set("/usr/lookat.rxyz", -25, 45, 0) npython.set("/usr/camera.tz", 5)
def togl(): if npython.exists("/sys/servers/gfx"): npython.delete("/sys/servers/gfx") gfx = npython.new("nglserver", "/sys/servers/gfx/") npython.set("/sys/servers/gfx.setdisplaymode", "w(580)-h(420)") init_gfxserver()