Example #1
0
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
    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)

    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
Example #2
0
def convert_axis(axis):
    l = []
    l.append(Spyder.Coordinate(0, 0, 0))
    l.append(Spyder.Coordinate(1, 0, 0))
    l.append(Spyder.Coordinate(0, 1, 0))
    l.append(Spyder.Coordinate(0, 0, 1))

    a = Spyder.AxisSystem()
    a.origin += (0.5, 0, 0)
    a.rotateY(-90)
    c = Spyder.Cylinder(0.2, 1, axis=a, material="red")
    l.append(c)
    a = Spyder.AxisSystem()
    a.origin += (0, 0.5, 0)
    a.rotateX(90)
    c = Spyder.Cylinder(0.2, 1, axis=a, material="green")
    l.append(c)
    a = Spyder.AxisSystem()
    a.origin += (0, 0, 0.5)
    c = Spyder.Cylinder(0.2, 1, axis=a, material="blue")
    l.append(c)

    og = Spyder.ObjectGroup3D(l, axis)

    return og
Example #3
0
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")

    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)

    del a, box
Example #4
0
class myscene(myspyderframe):
    scene = bee.parameter("bee")
    canvas = bee.parameter("bee")
    mousearea = bee.parameter("bee")

    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")

    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)

    m1 = Spyder.NewMaterial("red", (255, 0, 0))
    m2 = Spyder.NewMaterial("green", (0, 255, 0))
    m3 = Spyder.NewMaterial("blue", (0, 0, 255))
    m_ax = Spyder.AxisSystem(origin=(5, -3, 0))
    m_ax2 = Spyder.AxisSystem(origin=(-5, -3, 3))
    m_ax2.rotateZ(30)
    m_ax2.rotateX(-60)

    del a, box
Example #5
0
class myscene(dragonfly.pandahive.spyderframe):
    pandaicon_ = bee.get_parameter("pandaicon")

    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")

    a = Spyder.AxisSystem()
    a *= 0.005
    pandaclass = Spyder.ActorClass3D("models/panda-model",
                                     "egg",
                                     [("walk", "models/panda-walk4", "egg")],
                                     a,
                                     actorclassname="pandaclass")

    box = box2d(50, 470, 96, 96)
    params = parameters()
    params.transparency = True
    args = canvasargs("pandaicon.png", pandaicon_, box, params)
    plugin = plugin_single_required(args)
    pattern = ("canvas", "draw", "init", ("object", "image"))
    d1 = dummydrone(plugindict={pattern: plugin})

    i1 = bee.init("mousearea")
    i1.register(pandaicon_, box)

    del a, box, params, args, plugin, pattern
Example #6
0
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")

    pandascene = generate_pandascene()(scene="scene", canvas="canvas", mousearea="mousearea")
    del a
Example #7
0
def random_matrix_generator():
    while 1:
        a = Spyder.AxisSystem()
        a.rotateZ(360 * random())
        a.origin = Spyder.Coordinate(15 * random() - 7.5, 15 * random() - 7.5,
                                     0)
        yield dragonfly.scene.matrix(a, "AxisSystem")
Example #8
0
class myscene(dragonfly.pandahive.spyderframe):
    a = Spyder.AxisSystem()
    a *= 0.25
    a.origin += (-8, 42, 0)
    env = Spyder.Model3D("models/environment", "egg", a)

    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")
        )
    )

    pandascene = generate_pandascene()(scene="scene", canvas="canvas", mousearea="mousearea")

    del a
Example #9
0
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
Example #10
0
def show_panda(c):
    cf = bee.configure("scene")
    cf.import_mesh_EGG("models/panda-model")
    a = Spyder.AxisSystem()
    a *= 0.001
    a.origin = c
    cf.add_model_SPYDER(axissystem=a)
    return cf
Example #11
0
class myscene(bee.frame):
    pandaclassname_ = bee.get_parameter("pandaclassname")
    pandaname_ = bee.get_parameter("pandaname")
    pandaicon_ = bee.get_parameter("pandaicon")

    c1 = bee.configure("scene")
    c1.import_mesh_EGG("models/environment")
    a = Spyder.AxisSystem()
    a *= 0.25
    a.origin += (-8, 42, 0)
    c1.add_model_SPYDER(axissystem=a)

    c2 = bee.configure("scene")
    c2.import_mesh_EGG("models/panda-model")
    a = Spyder.AxisSystem()
    a *= 0.005
    c2.add_actor_SPYDER(axissystem=a, entityname=pandaname_)
    c2.import_mesh_EGG("models/panda-walk4")
    c2.add_animation("walk")

    c3 = bee.configure("scene")
    c3.import_mesh_EGG("models/panda-model")
    a = Spyder.AxisSystem()
    a *= 0.005
    c3.add_actorclass_SPYDER(axissystem=a, actorclassname=pandaclassname_)
    c3.import_mesh_EGG("models/panda-walk4")
    c3.add_animation("walk")

    box = box2d(50, 470, 96, 96)
    params = parameters()
    params.transparency = True
    args = canvasargs("pandaicon.png", pandaicon_, box, params)
    plugin = plugin_single_required(args)
    pattern = ("canvas", "draw", "init", ("object", "image"))
    d1 = dummydrone(plugindict={pattern: plugin})

    i1 = bee.init("mousearea")
    i1.register(pandaicon_, box)

    del a, box, params, args, plugin, pattern
Example #12
0
class myscene(myspyderframe):
    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")

    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)

    m1 = Spyder.NewMaterial("red", (255, 0, 0))
    m2 = Spyder.NewMaterial("green", (0, 255, 0))
    m3 = Spyder.NewMaterial("blue", (0, 0, 255))
    m4 = Spyder.NewMaterial("white", (255, 255, 255))
    m_ax = Spyder.AxisSystem(origin=(5, -3, 0))
    m_ax2 = Spyder.AxisSystem(origin=(-5, -3, 3))
    m_ax2.rotateZ(30)
    m_ax2.rotateX(-60)

    m = Spyder.World3D(materials=[m1, m2, m3, m4], objects=[m_ax, m_ax2])
    m.tofile("m.web")

    del m
    del a, box
Example #13
0
from pandalib import myhive, myscene, pandalogichive, pandalogicframe, load_hive, camerabind
import bee, dragonfly
from bee import connect
import Spyder

camerahive = "camera.web"

pandadict = {}  # global variable...

# First panda class
a = Spyder.AxisSystem()
a *= 0.005
data = "models/panda-model", "egg", [("walk", "models/panda-walk4", "egg")], a
box = Spyder.Box2D(50, 470, 96, 96)
image = "pandaicon.png", True
hivemap = "pandawalk.web"
pandadict["pandaclass"] = ("actor", data, box, image, hivemap)

#Second panda class
a = Spyder.AxisSystem()
a *= 0.002
data = "models/panda-model", "egg", [("walk", "models/panda-walk4", "egg")], a
box = Spyder.Box2D(200, 500, 48, 48)
image = "pandaicon.png", True
hivemap = "pandawalk2.web"
pandadict["pandaclass2"] = ("actor", data, box, image, hivemap)

#Third panda class
a = Spyder.AxisSystem()
a *= 0.3
data = "models/panda", "egg", [], a
Example #14
0
import bee
from bee.segments import *
import libcontext
from libcontext.socketclasses import *
from libcontext.pluginclasses import *

from .matrix import matrix

import Spyder

matrix0 = matrix(Spyder.AxisSystem(), "AxisSystem")


class spawn_actor_or_entity(bee.worker):
    actorclassname = antenna("pull", "id")
    b_actorclassname = buffer("pull", "id")
    connect(actorclassname, b_actorclassname)
    v_actorname = variable("id")
    v_matrix = variable(("object", "matrix"))

    @modifier
    def do_spawn(self):
        try:
            self.actorspawnfunc(self.b_actorclassname, self.v_actorname)
        except KeyError:
            self.entspawnfunc(self.b_actorclassname, self.v_actorname)
        axis = self.v_matrix.get_copy("AxisSystem")
        ent = self.get_entity(self.v_actorname)
        ent.set_axissystem(axis)
        ent.commit()
Example #15
0
def convert_to_panda(c):
    a = Spyder.AxisSystem()
    a *= 0.001
    a.origin = c
    p = Spyder.Model3D("models/panda-model", "egg", a)
    return p
Example #16
0
def convert_to_sphere(c):
    a = Spyder.AxisSystem()
    a.origin = c
    s = Spyder.Sphere3D(0.25, 2, a, material="white")
    return s