# HG changeset patch # User wycc # Date 1292687443 -28800 # Node ID 3ec0ad89e443e8ceb0f6c415d397b5ca3203ff15 # Parent 37a0f6ab2f9114ddd2e905aac47292a2807262b8 Fix the mtraix animation. diff -r 37a0f6ab2f91 -r 3ec0ad89e443 pyink/MBScene.py --- a/pyink/MBScene.py Sat Dec 18 10:00:01 2010 +0800 +++ b/pyink/MBScene.py Sat Dec 18 23:50:43 2010 +0800 @@ -276,6 +276,13 @@ addEventListener(doc,'DOMNodeInserted',self.updateUI,None) addEventListener(doc,'DOMNodeRemoved',self.updateUI,None) doc.childList() + try: + self.width = float(doc.attribute("width")) + self.height= float(doc.attribute("height")) + except: + self.width = 640 + self.height=480 + for node in doc.childList(): print node.name() if node.name() == 'svg:metadata': @@ -666,7 +673,7 @@ D=m[3] E=m[4] F=m[5] - sx = math.sqrt(m[0]*m[0]+m[2]*m[2]) + sx = math.sqrt(A*A+B*B) A = A/sx B = B/sx shear = m[0]*m[1]+m[2]*m[3] @@ -747,14 +754,17 @@ sx = ss[0]*(1-p)+dd[0]*p sy = ss[1]*(1-p)+dd[1]*p a = ss[2]*(1-p)+dd[2]*p - tx = sx*(1-p)+dx*p - ty = sy*(1-p)+dy*p + tx = ox*(1-p)+dx*p + ty = oy*(1-p)+dy*p #m = self.mulA([math.cos(a),-math.sin(a),math.sin(a),math.cos(a),0,0],[sx,0,0,sy,0,0]) - m = [sx,0,0,sy,0,0] - m = self.mulA(m,[1,0,0,1,-ox,-oy]) - m = [1,0,0,1,-ox,-oy] + #a=3.141592/2*p + m = [math.cos(a),math.sin(a),-math.sin(a),math.cos(a),0,0] + m = self.mulA([sx,0,0,sy,0,0],m) + m = self.mulA(m,[1,0,0,1,-ox,oy-self.height]) + m = self.mulA([1,0,0,1,tx,self.height-ty],m) + if dd[0] != ss[0]: - top.setAttribute("transform","matrix(%g,%g,%g,%g,%g,%g)" % (m[0],m[1],m[2],m[3],m[4],m[5])) + top.setAttribute("transform","matrix(%g,%g,%g,%g,%g,%g)" % (m[0],m[2],m[1],m[3],m[4],m[5])) else: try: sw = float(s.attribute("width")) @@ -957,19 +967,27 @@ pass def doInsertKeyScene(self,w): + self.lockui=True self.insertKeyScene() + self.lockui=False # self.grid.show_all() return def doDuplicateKeyScene(self,w): + self.lockui = True self.duplicateKeyScene() + self.lockui = False def doRemoveScene(self,w): + self.lockui = True self.removeKeyScene() + self.lockui = False return def doExtendScene(self,w): + self.lockui = True self.extendScene() + self.lockui = False #self.grid.show_all() pass def changeObjectLabel(self,w): diff -r 37a0f6ab2f91 -r 3ec0ad89e443 pyink/frameline.py --- a/pyink/frameline.py Sat Dec 18 10:00:01 2010 +0800 +++ b/pyink/frameline.py Sat Dec 18 23:50:43 2010 +0800 @@ -659,21 +659,21 @@ if key.right_tween is True: ss = rdoc.createElement("ns0:scene") node.appendChild(ss) - ss.setAttribute("start", str(key.idx+1),True) - ss.setAttribute("ref",key.ref.attribute("id"),True) - ss.setAttribute("end", str(self._keys[i+1].idx+1),True) + ss.setAttribute("start", str(key.idx+1)) + ss.setAttribute("ref",key.ref.attribute("id")) + ss.setAttribute("end", str(self._keys[i+1].idx+1)) if self._keys[i].right_tween_type == self._tween_type_none: - ss.setAttribute("type", "normal", True) + ss.setAttribute("type", "normal") elif self._keys[i].right_tween_type == self._tween_type_move: - ss.setAttribute("type", "relocate", True) + ss.setAttribute("type", "relocate") elif self._keys[i].right_tween_type == self._tween_type_shape: - ss.setAttribute("type", "scale", True) + ss.setAttribute("type", "scale") else: ss = rdoc.createElement("ns0:scene") node.appendChild(ss) - ss.setAttribute("start", str(key.idx+1),True) - ss.setAttribute("ref",key.ref.attribute("id"),True) - ss.setAttribute("type", "normal", True) + ss.setAttribute("start", str(key.idx+1)) + ss.setAttribute("ref",key.ref.attribute("id")) + ss.setAttribute("type", "normal") ## \brief Start future drawing actions diff -r 37a0f6ab2f91 -r 3ec0ad89e443 pyink/mbtest.svg --- a/pyink/mbtest.svg Sat Dec 18 10:00:01 2010 +0800 +++ b/pyink/mbtest.svg Sat Dec 18 23:50:43 2010 +0800 @@ -15,7 +15,7 @@ height="480px" id="svg2383" sodipodi:version="0.32" - inkscape:version="0.48+devel r9773 custom" + inkscape:version="0.48+devel r9774 custom" sodipodi:docname="mbtest.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape" version="1.1"> @@ -29,7 +29,7 @@ inkscape:zoom="1.6029106" inkscape:cx="304.10148" inkscape:cy="340.31842" - inkscape:current-layer="Backgrounds7058" + inkscape:current-layer="g3303" inkscape:document-units="px" showgrid="false" inkscape:window-width="1400" @@ -432,6 +432,16 @@ y1="28.009714" x2="104.68548" y2="28.009714" /> + @@ -468,7 +478,7 @@ type="scale" /> @@ -560,18 +570,18 @@ + id="g3163"> + id="g3169"> Action + transform="matrix(0.01251208,1.4317374,-1.8735908,0.00956133,563.61722,-271.29221)" + id="g3177"> + x="191.09566" + y="204.53598" /> Select + id="g3185"> + + + + + + + + + + + Action + + + + + + Select + + + + + + + +