Mercurial > MadButterfly
changeset 1131:3ec0ad89e443
Fix the mtraix animation.
author | wycc |
---|---|
date | Sat, 18 Dec 2010 23:50:43 +0800 |
parents | 37a0f6ab2f91 |
children | 3de972a43d46 |
files | pyink/MBScene.py pyink/frameline.py pyink/mbtest.svg |
diffstat | 3 files changed, 164 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- 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):
--- 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
--- 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" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3211-0-5-5" + id="linearGradient3189" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(158.65467,189.3155)" + x1="31.940987" + y1="28.009714" + x2="104.68548" + y2="28.009714" /> </defs> <metadata id="metadata2388"> @@ -468,7 +478,7 @@ type="scale" /> <ns0:scene start="16" - ref="Backgrounds7058" + ref="Backgrounds7378" type="normal" /> </ns0:scenes> </metadata> @@ -560,18 +570,18 @@ </g> <g inkscape:label="action1" - id="Backgrounds7058" - style="" + id="Backgrounds7378" + style="display:none" inkscape:groupmode="layer"> <g transform="translate(-0.898833,11.981842)" - id="g3173"> + id="g3163"> <rect y="-10.98185" x="0.93578684" height="481.62387" width="641.95721" - id="rect3175" + id="rect3165" style="fill:#00ffff;fill-opacity:1;stroke:#000000;stroke-opacity:1;display:inline" /> <rect ry="10" @@ -580,21 +590,21 @@ x="6.8625164" height="46.789886" width="624.48901" - id="rect3177" + id="rect3167" style="fill:#ffcc1d;fill-opacity:1;stroke:none" /> </g> <g transform="translate(-0.898833,11.981842)" - id="g3179"> + id="g3169"> <rect y="15.22048" x="32.440987" height="25.57847" width="71.744492" - id="rect3181" + id="rect3171" style="fill:url(#linearGradient4897);fill-opacity:1;stroke:none;filter:url(#filter3295-1-3)" /> <text - id="text3183" + id="text3173" y="33.312569" x="39.927368" style="font-size:24px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans" @@ -602,37 +612,37 @@ style="font-size:16px" y="33.312569" x="39.927368" - id="tspan3185" + id="tspan3175" sodipodi:role="line">Action</tspan></text> </g> <g - id="g3695" - transform="matrix(1.3828119,0,0,2.7979599,-41.967781,-47.414913)"> + transform="matrix(0.01251208,1.4317374,-1.8735908,0.00956133,563.61722,-271.29221)" + id="g3177"> <rect - style="fill:url(#linearGradient3700);fill-opacity:1;stroke:none;filter:url(#filter3295-1-3-2)" - id="rect3189" + style="fill:url(#linearGradient3189);fill-opacity:1;stroke:none;filter:url(#filter3295-1-3-2)" + id="rect3179" width="71.744492" height="25.57847" - x="111.24092" - y="27.982151" /> + x="191.09566" + y="204.53598" /> <text xml:space="preserve" style="font-size:24px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans" - x="118.72729" - y="46.074238" - id="text3191"><tspan + x="198.58203" + y="222.62807" + id="text3181"><tspan sodipodi:role="line" - id="tspan3193" - x="118.72729" - y="46.074238" + id="tspan3183" + x="198.58203" + y="222.62807" style="font-size:16px">Select</tspan></text> </g> <g transform="translate(-0.898833,11.981842)" - id="g3195"> + id="g3185"> <rect style="fill:#000000;fill-opacity:1" - id="rect3197" + id="rect3187" width="67.377434" height="29.321661" x="180.92088" @@ -640,6 +650,99 @@ transform="translate(15.128732,-2.0275737)" /> </g> </g> + <g + inkscape:label="dup" + id="g4809"> + <g + id="g4811"> + <g + transform="translate(-0.898833,11.981842)" + id="g4813"> + <rect + y="-10.98185" + x="0.93578684" + height="481.62387" + width="641.95721" + id="rect4815" + style="fill:#00ffff;fill-opacity:1;stroke:#000000;stroke-opacity:1;display:inline" /> + <rect + ry="10" + rx="10" + y="5.8625031" + x="6.8625164" + height="46.789886" + width="624.48901" + id="rect4817" + style="fill:#ffcc1d;fill-opacity:1;stroke:none" /> + </g> + </g> + <g + id="g4819"> + <g + transform="translate(-0.898833,11.981842)" + id="g4821"> + <rect + y="15.22048" + x="32.440987" + height="25.57847" + width="71.744492" + id="rect4823" + style="fill:url(#linearGradient4897);fill-opacity:1;stroke:none;filter:url(#filter3295-1-3)" /> + <text + id="text4825" + y="33.312569" + x="39.927368" + style="font-size:24px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans" + xml:space="preserve"><tspan + style="font-size:16px" + y="33.312569" + x="39.927368" + id="tspan4827" + sodipodi:role="line">Action</tspan></text> + </g> + </g> + <g + id="g4829" + transform="matrix(0.0125121,1.43174,-1.87359,0.00956133,231.497,-154.368)"> + <g + transform="translate(-80.478599,-177.80156)" + id="g4831"> + <rect + style="fill:url(#linearGradient3170);fill-opacity:1;stroke:none;filter:url(#filter3295-1-3-2)" + id="rect4833" + width="71.744492" + height="25.57847" + x="191.09566" + y="204.53598" /> + <text + xml:space="preserve" + style="font-size:24px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans" + x="198.58203" + y="222.62807" + id="text4835"><tspan + sodipodi:role="line" + id="tspan4837" + x="198.58203" + y="222.62807" + style="font-size:16px">Select</tspan></text> + </g> + </g> + <g + id="g4839"> + <g + transform="translate(-0.898833,11.981842)" + id="g4841"> + <rect + style="fill:#000000;fill-opacity:1" + id="rect4843" + width="67.377434" + height="29.321661" + x="180.92088" + y="14.596627" + transform="translate(15.128732,-2.0275737)" /> + </g> + </g> + </g> </g> <g inkscape:groupmode="layer" @@ -711,7 +814,7 @@ </g> <g id="s6546" - style="display:none"> + style=""> <rect x="0" y="0"