Hi,
I was trying to use Clutter and Mash via gobject-introspection using
python, basically implementing the viewer provided in the mash examples.
For some reason the actor created from MashModel does not show up,
although CLUTTER_DEBUG says that it is painted. Any idea?


from gi.repository import Clutter
from gi.repository import Mash

Clutter.init([])

stage = Clutter.Stage.get_default();
stage.set_size(640, 480)
stage_color = Clutter.Color()
stage_color.from_string("grey")
stage.set_color(stage_color)

model = Mash.Model()
model.new_from_file(0,"TheMonkey.ply")
model.set_size(100, 100)
model.set_position(320, 240)

vertex = Clutter.Vertex()
texture = Clutter.Texture()
texture.new_from_file("texture.png")

model.set_material(texture.get_cogl_material())

anim = Clutter.Animator()
tl = Clutter.Timeline()
tl.set_duration(3000)
tl.set_loop(True)
anim.set_timeline(tl)
anim.set_key(model, "rotation-angle-y", Clutter.AnimationMode.LINEAR,
0.0, 0.0)
anim.set_key(model, "rotation-angle-y", Clutter.AnimationMode.LINEAR,
1.0, 360.0)
anim.start()

def on_key(stage, event):
    
    if event.get_key_code()==53: #x
        Clutter.main_quit()

stage.set_reactive(True)
stage.connect("key-press-event", on_key)
stage.add_actor(model)

stage.show()

Clutter.main()





_______________________________________________
clutter-app-devel-list mailing list
clutter-app-devel-list@clutter-project.org
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to