Package toon :: Module core :: Class Toonloop
[hide private]
[frames] | no frames]

Class Toonloop

source code

      object --+    
               |    
rats.render.Game --+
                   |
                  Toonloop

Toonloop is a realtime stop motion tool.

For 1 GB of RAM, one can expect to stock about 3000 images at 640x480, if having much swap memory.

Private methods starts with _. The draw method is a special one inherited from rats.render.Game. The process_events one as well.

Onion skin effect and chroma key shader are mutually exclusives.

There are a lot of services/features that are disabled by default. (web, fudi, osc, midi, etc.)

Instance Methods [hide private]
 
__init__(self, config)
Startup poutine.
source code
 
_setup_effects(self)
Set all effects up.
source code
 
effect_next(self)
Selects the next effect.
source code
 
_get_current_effect(self) source code
 
_start_services(self)
Starts the Toonloop network services.
source code
 
theme_change(self)
Pick next theme
source code
 
sampler_record(self, start=True)
Starts of stops recording a sampler.
source code
 
sampler_clear(self)
Clear the sound in current frame The sounds sampler handles this.
source code
 
_cb_midi_event(self, event)
Called when a MIDI event happens.
source code
 
_setup_background(self)
Loads initial background image.
source code
 
bgimage_load(self, path)
Replace the background image by a new image file path.
source code
 
bgimage_snap(self)
Makes the current image from the camera to be the background image.
source code
 
bgimage_glob_next(self, increment=1)
Loads the next image from the list of JPG images in a directory.
source code
 
print_stats(self)
Print statistics
source code
 
set_option_in_group(self, group, key, value)
Set an option that is in a OptionsGroup.
source code
 
print_optgroups(self) source code
 
print_help(self)
Prints help for live keyboard controls.
source code
 
_draw_hud(self)
Draws the head-up-display.
source code
 
_init_clips(self)
Creates a new project.
source code
 
clip_select(self, index=0)
Selects an other clip
source code
 
_setup_window(self)
OpenGL setup.
source code
 
_resize_window(self)
Called when we resize the window.
source code
 
_setup_camera(self)
Starts using the video camera.
source code
 
frame_add(self)
Copies the last grabbed frame to the list of images.
source code
 
writehead_move(self, steps)
Moves the writehead of the current clip.
source code
 
writehead_goto(self, index)
Moves the writehead of the current clip to the given index.
source code
 
draw(self)
Renders one frame.
source code
 
_draw_saving_progress_bar(self)
Draws the progress bar of saving of the clip, if in progress.
source code
 
_draw_white_flash(self) source code
 
_draw_edit_background(self)
Renders the background
source code
 
_draw_play_background(self) source code
 
_camera_grab_frame(self)
Image capture from the video camera.
source code
 
_draw_edit_view(self)
Renders edit view (the live camera + onion peal)
source code
 
_draw_onion_skin(self) source code
 
_draw_playback_view(self)
Renders the playback view.
source code
 
_playhead_iterate(self)
Increments the playhead position of one frame
source code
 
_clear_playback_view(self)
Sets all pixels in the playback view as black.
source code
 
_clear_onion_peal(self)
Sets all pixels in the onion peal as black.
source code
 
pause(self, val=None)
Toggles on/off the pause
source code
 
clip_reset(self)
Deletes all frames from the current animation
source code
 
clip_save(self)
Saves all images as jpeg and encodes them to a MJPEG movie.
source code
 
_slot_saver_progress(self, progress_ratio)
:param progress_ratio: float from 0 to 1
source code
 
_slot_saver_done(self, success)
:param success: boolean
source code
 
frame_remove(self)
Deletes the last frame from the current list of images.
source code
 
effect_select(self, name_or_index=None)
:param name_or_index: Either a int from 0 to n-1 or a string
source code
 
onionskin_toggle(self, val=None)
Toggles on/off the onion skin.
source code
 
framerate_increase(self, dir=1)
Increase or decreases the FPS :param dir: by how much increment it.
source code
 
toggle_fullscreen(self)
Toggles from window to fullscreen view.
source code
 
process_events(self, events)
Processes pygame events.
source code
 
quit(self)
Quits the application in a short while.
source code
 
_quit(self) source code
 
direction_change(self, direction=None)
Changes the direction of the current clip's playback.
source code
 
autosave_toggle(self, val=None)
Toggles on/off the autosave
source code
 
intervalometer_toggle(self, val=None)
Toggles on/off the intervalometer / timelapse / auto mode.
source code
 
intervalometer_rate_increase(self, dir=1)
Increase or decreases the intervalometer rate.
source code
 
_intervalometer_frame_add(self)
Called when it is time to automatically grab an image.
source code
 
_autosave(self)
Called when it is time to automatically save a movie
source code
 
cleanup(self)
Called by the rats.render.Renderer before quitting the application.
source code
 
config_set(name, value)
Changes a configuration option.
source code
 
config_save(self)
Saves the current config to a file.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  TEXTURE_MOST_RECENT = 0
  TEXTURE_PLAYBACK = 1
  TEXTURE_ONION = 2
  TEXTURE_BACKGROUND = 3
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, config)
(Constructor)

source code 

Startup poutine.

Reads config. Starts pygame, the camera, the clips list. Creates the window. Hides the mouse. Start services (OSC, web and FUDI) Enables the effects or the onion peal.

Overrides: object.__init__

_start_services(self)

source code 

Starts the Toonloop network services.

Called once the Twisted reactor has been started. 

Implemented services : 
 * web server with Media RSS and Restructured text
 * FUDI protocol with PureData
 * MIDI input (not quite a service, but we start it here)

sampler_record(self, start=True)

source code 

Starts of stops recording a sampler. The sounds sampler handles this.

_cb_midi_event(self, event)

source code 

Called when a MIDI event happens. If MIDI is enabled, of course.

bgimage_glob_next(self, increment=1)

source code 

Loads the next image from the list of JPG images in a directory.

lowercase .jpg extension.

set_option_in_group(self, group, key, value)

source code 

Set an option that is in a OptionsGroup. See toon.optgroup.OptionsGroup.

Might raise ToonloopError of OptionGroupError :param group: Name of the group. :param key: Name of the option. :param value: str with the value.

_draw_hud(self)

source code 

Draws the head-up-display. Numbers, text, etc. overlayed on top of images.

_resize_window(self)

source code 

Called when we resize the window. (fullscreen on/off)

The OpenGL coordinates go from -4 to 4 horizontally and -3 to 3 vertically. (ratio is 4:3)

writehead_move(self, steps)

source code 

Moves the writehead of the current clip. :param steps: How many frames in which direction. To move to the left, give a steps value of 1. To move to the right, give a steps value of -1.

writehead_goto(self, index)

source code 

Moves the writehead of the current clip to the given index. :param index: int -1 for the end. 0 for the beginning

draw(self)

source code 

Renders one frame. Called from the event loop. (twisted)

Overrides: rats.render.Game.draw

clip_save(self)

source code 

Saves all images as jpeg and encodes them to a MJPEG movie.

See _write_next_image

onionskin_toggle(self, val=None)

source code 

Toggles on/off the onion skin. (see most recent frame grabbed in transparency)

process_events(self, events)

source code 

Processes pygame events. :param events: got them using pygame.event.get()

Overrides: rats.render.Game.process_events

direction_change(self, direction=None)

source code 

Changes the direction of the current clip's playback.

If direction param is None, will cycle through the available directions. :param direction: int with the value of the constant DIRECTION_FORWARD or DIRECTION_BACKWARD

intervalometer_rate_increase(self, dir=1)

source code 

Increase or decreases the intervalometer rate. (in seconds) :param dir: by how much increment it.

_intervalometer_frame_add(self)

source code 

Called when it is time to automatically grab an image.

The auto mode is like an intervalometer to create timelapse animations.

cleanup(self)

source code 

Called by the rats.render.Renderer before quitting the application.

Overrides: rats.render.Game.cleanup