<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.thedarkmod.com/index.php?action=history&amp;feed=atom&amp;title=InstallASEScript</id>
	<title>InstallASEScript - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.thedarkmod.com/index.php?action=history&amp;feed=atom&amp;title=InstallASEScript"/>
	<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=InstallASEScript&amp;action=history"/>
	<updated>2026-04-18T19:15:47Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.thedarkmod.com/index.php?title=InstallASEScript&amp;diff=6830&amp;oldid=prev</id>
		<title>OrbWeaver: Added content</title>
		<link rel="alternate" type="text/html" href="https://wiki.thedarkmod.com/index.php?title=InstallASEScript&amp;diff=6830&amp;oldid=prev"/>
		<updated>2008-08-23T09:13:03Z</updated>

		<summary type="html">&lt;p&gt;Added content&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This is a small convenience script written in Python that can be used to quickly install an exported ASE while automatically making texture replacements, avoiding the time-consuming process of manually editing texture paths with a text editor after export.&lt;br /&gt;
&lt;br /&gt;
The texture replacements are stored in a file with the same name as the &amp;#039;&amp;#039;&amp;#039;.ase&amp;#039;&amp;#039;&amp;#039; but with &amp;#039;&amp;#039;&amp;#039;.tex&amp;#039;&amp;#039;&amp;#039; appended, such as &amp;#039;&amp;#039;&amp;#039;myobject.ase.tex&amp;#039;&amp;#039;&amp;#039;. This is a simple text file which can be stored in the directory that Blender exports to, from which the ASE is then installed into the model hierarchy using the Python script. The replacement file format is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/exported/texture/name //base/textures/doom3/texture/name&lt;br /&gt;
/exported/texture/name2 //base/textures/doom3/texture/name2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Python script is then invoked like:&lt;br /&gt;
&lt;br /&gt;
 $ install-ase.py blender/export/myobject.ase ~/.doom3/darkmod/models/mymodels/&lt;br /&gt;
&lt;br /&gt;
in order to install the exported ASE into the models hierarchy. In this case the replacement file would be &amp;#039;&amp;#039;&amp;#039;blender/export/myobject.ase.tex&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; So far I have only tested this on Linux. Python does work on Windows but the pathname processing stuff might be different.&lt;br /&gt;
&lt;br /&gt;
=The script=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import sys&lt;br /&gt;
import os.path&lt;br /&gt;
&lt;br /&gt;
if len(sys.argv) != 3:&lt;br /&gt;
    print &amp;quot;Usage: install-ase.py &amp;lt;filename.ase&amp;gt; &amp;lt;destination-dir&amp;gt;&amp;quot;&lt;br /&gt;
    print &amp;quot;   A replacement file named &amp;lt;filename.ase.tex&amp;gt; must be present in &amp;quot;&lt;br /&gt;
    print &amp;quot;   the source directory.&amp;quot;&lt;br /&gt;
    sys.exit(1)&lt;br /&gt;
&lt;br /&gt;
# Check we can open the .ase file and its associated .ase.tex file containing&lt;br /&gt;
# texture replacements&lt;br /&gt;
try:&lt;br /&gt;
    aseFile = open(sys.argv[1], &amp;#039;r&amp;#039;)&lt;br /&gt;
except IOError:&lt;br /&gt;
    print &amp;quot;Unable to open input file: %s&amp;quot; % sys.argv[1]&lt;br /&gt;
    sys.exit(2)&lt;br /&gt;
&lt;br /&gt;
# Build replacement mappings&lt;br /&gt;
texReplacements = { }&lt;br /&gt;
try:&lt;br /&gt;
    # Read the tex file&lt;br /&gt;
    texFile = open(sys.argv[1] + &amp;#039;.tex&amp;#039;, &amp;#039;r&amp;#039;)&lt;br /&gt;
    for line in texFile:&lt;br /&gt;
        (first, second) = line.split()&lt;br /&gt;
        texReplacements[first] = second&lt;br /&gt;
&lt;br /&gt;
    print &amp;quot;+ Making %d texture replacement(s):&amp;quot; % len(texReplacements.keys())&lt;br /&gt;
    for (k, v) in texReplacements.items():&lt;br /&gt;
        print &amp;quot;+   %s -&amp;gt; %s&amp;quot; % (k, v)&lt;br /&gt;
except IOError:&lt;br /&gt;
    print &amp;quot;+ No replacement file&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Open the destination file&lt;br /&gt;
srcFileName = os.path.split(aseFile.name)[1]&lt;br /&gt;
destFileName = os.path.join(sys.argv[2], srcFileName)&lt;br /&gt;
print &amp;quot;+ Installing as %s&amp;quot; % destFileName&lt;br /&gt;
destFile = open(destFileName, &amp;#039;w&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
# Copy the source file to the destination, making replacements&lt;br /&gt;
for line in aseFile:&lt;br /&gt;
    for (old, new) in texReplacements.items():&lt;br /&gt;
        line = line.replace(old, new)&lt;br /&gt;
    destFile.write(line)&lt;br /&gt;
destFile.close()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>OrbWeaver</name></author>
	</entry>
</feed>