Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
graphics.coverter.xml
<project name="Graphics Converter" default="atlasses.and.gafs" basedir="..">
<!--путь к air sdk-->
<property name="flex.home" location="C:/Program Files (x86)/FlexSDK/AIR SDK" />
<!--путь к pvr2atf-->
<property name="atf.tool" location="${flex.home}/atftools/pvr2atf.exe" />
<!--путь к PVRTexToolCLI-->
<property name="pvr.tool" location="C:/Program Files/PowerVR/Tool/PVRTexTool/CLI/Windows_x86_32/PVRTexToolCLI.exe" />
<!--путь к атласам в формате pvr-->
<property name="atlasses.source" location="_sources/atlasses_ready" />
<!--путь к папке для атласов в формате atf-->
<property name="atlasses.destanation" location="bin/graphics" />
<!--путь к zip файлам gaf в формате png-->
<property name="gafs.source" location="_sources/gafs" />
<!--пусть к папке c готовыми zip файлам gaf в формате atf-->
<property name="gafs.destanation" location="bin/gaf" />
<property name="temp" location="_temp" />
<macrodef name="pvr2atf">
<attribute name="from" />
<attribute name="to" />
<sequential>
<apply executable="${atf.tool}">
<arg value="-r" />
<srcfile />
<arg value="-o" />
<targetfile />
<fileset dir="@{from}" includes="**/*.pvr" />
<mapper type="glob" from="*.pvr" to="@{to}/*.atf" />
</apply>
</sequential>
</macrodef>
<macrodef name="png2pvr">
<attribute name="from" />
<attribute name="to" />
<sequential>
<apply executable="${pvr.tool}">
<arg value="-i" />
<srcfile />
<arg value="-o" />
<targetfile />
<arg value="-l" />
<arg value="-f" />
<arg value="r8g8b8a8" />
<arg value="-q" />
<arg value="pvrtcbest" />
<fileset dir="@{from}" includes="**/*.png" />
<mapper type="glob" from="*.png" to="@{to}/*.pvr" />
</apply>
</sequential>
</macrodef>
<target name="-convert.atlasses.graphics" description="Convert all pvr atlasses to atf">
<delete dir="${atlasses.destanation}"/>
<mkdir dir="${atlasses.destanation}"/>
<pvr2atf from="${atlasses.source}" to="${atlasses.destanation}" />
</target>
<target name="-move.xmls" description="Move xml files to destanation">
<copy todir="${atlasses.destanation}">
<fileset dir="${atlasses.source}" includes="**/*.xml" />
</copy>
</target>
<target name="gafs" description="Convert all PNG gafs graphics to ATF">
<delete dir="${gafs.destanation}"/>
<mkdir dir="${gafs.destanation}"/>
<mkdir dir="${temp}"/>
<unzip dest="${temp}">
<fileset dir="${gafs.source}">
<include name="**/*.zip"/>
</fileset>
</unzip>
<png2pvr from="${temp}" to="${temp}" />
<pvr2atf from="${temp}" to="${temp}" />
<delete>
<fileset dir="${temp}" includes="**/*.png"/>
<fileset dir="${temp}" includes="**/*.pvr"/>
</delete>
<!-- команду зиповки для каждого gaf приходится писать отдельно -->
<zip destfile="${gafs.destanation}/gaf.s1.zip" basedir="${temp}/gaf.s1" update="true"/>
<zip destfile="${gafs.destanation}/gaf.s2.zip" basedir="${temp}/gaf.s2" update="true"/>
<zip destfile="${gafs.destanation}/gaf.s3.zip" basedir="${temp}/gaf.s3" update="true"/>
<delete dir="${temp}"/>
</target>
<target name="atlasses" depends="-convert.atlasses.graphics, -move.xmls" description="Convert atlasses from PVR to ATF" />
<target name="atlasses.and.gafs" depends="-convert.atlasses.graphics, -move.xmls, gafs" description="Convert atlasses and gafs to ATF" />
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment