class pandascenehive(dragonfly.pandahive.spyderframe): for name in pandadict: mode, data, box, image = pandadict[name] model, modelformat, animations, a = data if mode == "actor": obj = Spyder.ActorClass3D(model, modelformat, animations, a, actorclassname=name) elif mode == "model": model = Spyder.Model3D(model, modelformat, a) obj = Spyder.EntityClass3D(name, [model]) else: raise ValueError(mode) locals()[name + "_obj"] = obj im, transp = image locals()[name + "_icon"] = Spyder.Icon(im, name, box, transparency=transp) del name del model, modelformat, animations, a, obj del mode, data, box, image del im, transp
class myscene(dragonfly.pandahive.spyderframe): a = Spyder.AxisSystem() a *= 0.25 a.origin += (-8, 42, 0) env = Spyder.Model3D("models/environment", "egg", a) #First panda a = Spyder.AxisSystem() a *= 0.005 pandaclass = Spyder.ActorClass3D("models/panda-model", "egg", [("walk", "models/panda-walk4", "egg")], a, actorclassname="pandaclass") box = Spyder.Box2D(50, 470, 96, 96) icon = Spyder.Icon("pandaicon.png", "pandaicon", box, transparency=True) #Second panda a = Spyder.AxisSystem() a *= 0.002 pandaclass2 = Spyder.ActorClass3D("models/panda-model", "egg", [("walk", "models/panda-walk4", "egg")], a, actorclassname="pandaclass2") box = Spyder.Box2D(200, 500, 48, 48) icon2 = Spyder.Icon("pandaicon.png", "pandaicon2", box, transparency=True) #Third panda a = Spyder.AxisSystem() a *= 0.3 model = Spyder.Model3D("models/panda", "egg", a) pandaclass3 = Spyder.EntityClass3D("pandaclass3", [model]) box = Spyder.Box2D(280, 480, 144, 112) icon3 = Spyder.Icon("pandaicon2.png", "pandaicon3", box, transparency=True) camcenter = Spyder.Entity3D( "camcenter", ( Spyder.NewMaterial("white", color=(255, 255, 255)), Spyder.Block3D((1, 1, 1), material="white"), ) ) marker = Spyder.Entity3D( "marker", ( Spyder.NewMaterial("blue", color=(0, 0, 255)), Spyder.Circle(2, origin=(0, 0, 0.1), material="blue") ) ) del a, box, model
class myscene(dragonfly.pandahive.spyderframe): a = Spyder.AxisSystem() a *= 0.25 a.origin += (-8, 42, 0) env = Spyder.Model3D("models/environment", "egg", a) a = Spyder.AxisSystem() a *= 0.005 mypanda = Spyder.Actor3D("models/panda-model", "egg", [("walk", "models/panda-walk4", "egg")], a, entityname="mypanda") ##First panda class a = Spyder.AxisSystem() a *= 0.005 pandaclass = Spyder.ActorClass3D("models/panda-model", "egg", [("walk", "models/panda-walk4", "egg")], a, actorclassname="pandaclass") box = Spyder.Box2D(50, 470, 96, 96) icon = Spyder.Icon("pandaicon.png", "pandaicon", box, transparency=True) #Second panda class a = Spyder.AxisSystem() a *= 0.002 pandaclass2 = Spyder.ActorClass3D("models/panda-model", "egg", [("walk", "models/panda-walk4", "egg")], a, actorclassname="pandaclass2") box = Spyder.Box2D(200, 500, 48, 48) icon2 = Spyder.Icon("pandaicon.png", "pandaicon2", box, transparency=True) #Third panda class a = Spyder.AxisSystem() a *= 0.3 model = Spyder.Model3D("models/panda", "egg", a) pandaclass3 = Spyder.EntityClass3D("pandaclass3", [model]) box = Spyder.Box2D(280, 480, 144, 112) icon3 = Spyder.Icon("pandaicon2.png", "pandaicon3", box, transparency=True) del a, box, model
class pandasceneframe(dragonfly.pandahive.spyderframe): mode, data, box, image, hivemap = panda model, modelformat, animations, a = data if mode == "actor": obj = Spyder.ActorClass3D(model, modelformat, animations, a, actorclassname=name) elif mode == "model": model = Spyder.Model3D(model, modelformat, a) obj = Spyder.EntityClass3D(name, [model]) else: raise ValueError(mode) im, transp = image icon = Spyder.Icon(im, name, box, transparency=transp) del model, modelformat, animations, a del mode, data, box, image, hivemap del im, transp
data = "models/panda", "egg", [], a box = Spyder.Box2D(280, 480, 144, 112) image = "pandaicon2.png", True hivemap = "pandajump.web" pandadict["pandaclass3"] = ("model", data, box, image, hivemap) #Build the Spyder file from the dict mps = Spyder.MovingPandaArray() for name in sorted(pandadict.keys()): mode, data, box, image, hivemap = pandadict[name] model, modelformat, animations, a = data if mode == "actor": obj = Spyder.ActorClass3D(model, modelformat, animations, a, actorclassname=name) elif mode == "model": model = Spyder.Model3D(model, modelformat, a) obj = Spyder.EntityClass3D(name, [model]) else: raise ValueError(mode) mp = Spyder.MovingPanda( name, hivemap, mode, [obj], image[0], box, image[1], ) mps.append(mp) mps.tofile("panda-final.web")