MadButterfly

changeset 1535:9aff42a7e2b9 tip

Fix issue of add/remove a frame at a scene before all key frames of a layer.

When you added or removed a frame at a scene before all key frames of
a layer, frameline was not updated correctly. It seems nothing
happened, but domview is updated. This changeset fix this issue by
correcting logic for boundary case.
author Thinker K.F. Li <thinker@codemud.net>
date Fri Sep 30 22:07:28 2011 +0800 (2011-09-30)
parents 199ba528fd4a
children
files pyink/frameline.py
line diff
     1.1 --- a/pyink/frameline.py	Fri Sep 30 14:17:35 2011 +0800
     1.2 +++ b/pyink/frameline.py	Fri Sep 30 22:07:28 2011 +0800
     1.3 @@ -694,19 +694,22 @@
     1.4  	    else:
     1.5  		pos = pos + 1
     1.6  		pass
     1.7 -
     1.8 -	    while pos < len(self._keys):
     1.9 -		key = self._keys[pos]
    1.10 -		key.idx = key.idx - 1
    1.11 -		pos = pos + 1
    1.12 -		pass
    1.13 +	    pass
    1.14 +	else:
    1.15 +	    pos = 0
    1.16 +	    pass
    1.17 +	
    1.18 +	while pos < len(self._keys):
    1.19 +	    key = self._keys[pos]
    1.20 +	    key.idx = key.idx - 1
    1.21 +	    pos = pos + 1
    1.22  	    pass
    1.23  
    1.24  	self._draw_all_frames()
    1.25  	self._draw_active_frame()
    1.26  	pass
    1.27  
    1.28 -    ## \brief Inser a frame before given frame.
    1.29 +    ## \brief Insert a frame before given frame.
    1.30      #
    1.31      # All frame at and after given frame position move to tail in one position.
    1.32      # It means to add one to positions of all key frames at/after given frame.
    1.33 @@ -718,12 +721,15 @@
    1.34  	    if key.idx != idx:
    1.35  		pos = pos + 1
    1.36  		pass
    1.37 -	    
    1.38 -	    while pos < len(self._keys):
    1.39 -		key = self._keys[pos]
    1.40 -		key.idx = key.idx + 1
    1.41 -		pos = pos + 1
    1.42 -		pass
    1.43 +	    pass
    1.44 +	else:
    1.45 +	    pos = 0
    1.46 +	    pass
    1.47 +	
    1.48 +	while pos < len(self._keys):
    1.49 +	    key = self._keys[pos]
    1.50 +	    key.idx = key.idx + 1
    1.51 +	    pos = pos + 1
    1.52  	    pass
    1.53  
    1.54  	self._draw_all_frames()