Utility: python cap reader

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Sat Feb 26, 2011 11:31 pm

I made a python module to load/save cap files last saved in 0.99.96 or 0.99.97.

Here is a example that extracts all the images out of another cap:
[url:28zdvdw8]http://dl.dropbox.com/u/5426011/examples4/image%20dump.zip[/url:28zdvdw8] made in 0.99.97

I'll post more examples of the module's use here as I come up with them.

-cheers
B
79
S
24
G
54
Posts: 4,749
Reputation: 40,761

Post » Sat Feb 26, 2011 11:42 pm

Interesting! If you could make this export even a rudimentary C2 project, I think you'd gain a whole lot of fans :)
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Thu Mar 03, 2011 8:04 pm

What are the pre-requisites for this?

I have build 0.99.97, Python 2.5 but I still get an error running your example: "ImportError: no module named capreader"
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,847
Reputation: 48,295

Post » Thu Mar 03, 2011 8:26 pm

I believe you have to use Python 2.6 since Construct uses this one
B
2
S
2
G
2
Posts: 158
Reputation: 1,366

Post » Thu Mar 03, 2011 8:32 pm

It has all the required files included. Just extract all the files into a directory before running the cap. The example should be able to find "capreader" because it's in the same directory as the example cap.

Edit:
No python install should be needed. Any needed python modules are included with the Construct install with the exception of "capreader" which is included in the zip.
B
79
S
24
G
54
Posts: 4,749
Reputation: 40,761

Post » Thu Mar 03, 2011 8:44 pm

Thats what I thought. I unzipped your files to their own folder 'as-is' and ran the imagedump.cap, which is when I got the error.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,847
Reputation: 48,295

Post » Thu Mar 03, 2011 8:56 pm

Add this line to the top of the script:
sys.path.append(System.AppPath)

You could also try saving the cap. That should update the cap's folder info.
B
79
S
24
G
54
Posts: 4,749
Reputation: 40,761

Post » Thu Mar 03, 2011 9:14 pm

Appending the script sorted it :)

I wasn't particularly interested in the cap, just the way you're referencing in the python script.

Many thanks, R0J0hound.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,847
Reputation: 48,295

Post » Fri Mar 04, 2011 8:21 pm

Here is a utility to fix caps where adding a new object removes another. It also has a newer version of capreader.py with many tweaks and fixes.

[url:q1zo8vvb]http://dl.dropbox.com/u/5426011/utility/addobjfix.zip[/url:q1zo8vvb]
B
79
S
24
G
54
Posts: 4,749
Reputation: 40,761


Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 0 guests