indexing description: "Objects that ..." author: "" date: "$Date$" revision: "$Revision$" class EM3D_ACTOR inherit EM3D_SCENE_NODE redefine make_by_parent, copy, render_opengl end EM3D_RESOURCE redefine copy end EM3D_SELECTION_OBJECT rename has_object as has_selected_object undefine is_equal redefine copy end create {EM3D_MODEL_FACTORY} make_by_parent feature {EM3D_ACTOR} -- Animation make_by_parent( a_parent: like current ) is -- Init the animations do Precursor( a_parent ) create selection_event create animations.make_default end animations: DS_HASH_TABLE[ EM3D_ANIMATION_SET, STRING ] feature -- Animation add_animation( an_animation: EM3D_ANIMATION_SET; a_name: STRING ) is -- Add a new NAMED animation local a: EM3D_ANIMATION_SET c: DS_LIST_CURSOR[ EM3D_ANIMATION ] do if animations.has ( a_name ) then a := animations.item ( a_name ) c := an_animation.animations.new_cursor from c.start until c.after loop a.add ( c.item ) c.forth end else animations.force( an_animation, a_name ) end end has_animation( a_name: STRING ): BOOLEAN is -- Is there an animation named a_name? do result := animations.has ( a_name ) end animation( a_name: STRING ): EM3D_ANIMATION_SET is -- Get the animation named a_name require animation_exists: has_animation( a_name ) do result := animations.item ( a_name ) end feature -- Selection selection_event: EM_EVENT_CHANNEL[ TUPLE[DOUBLE,DOUBLE] ] feature {NONE} -- Selection selected( zn, zf: DOUBLE ) is -- The object got selected do selection_event.publish ( [zn, zf] ) end feature -- rendering render_opengl is -- Set the animation local i: DS_HASH_TABLE_CURSOR[ EM3D_ANIMATION_SET, STRING ] do if selection_event.subscriptions.count + selection_event.once_subscriptions.count > 0 then push_name end i := animations.new_cursor from i.start until i.after loop i.item.set_animation i.forth end Precursor if selection_event.subscriptions.count + selection_event.once_subscriptions.count > 0 then pop_name end end feature -- from ANY copy( other: like current ) is -- If we copy an actor we also want to copy its animations and set there new root animation local c: DS_LIST_CURSOR[ EM3D_ANIMATION ] a: EM3D_ANIMATION_SET do standard_copy( other ) create animations.make_default from other.animations.start until other.animations.after loop a := other.animations.item_for_iteration.twin a.animate(0) c := a.animations.new_cursor from c.start until c.after loop if c.item.actor = other then c.item.set_actor ( current ) end c.forth end add_animation (a, other.animations.key_for_iteration) other.animations.forth end end end