Jump to content

46 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

If anyone's interested( probably not lol, since Modtools does all of this in-game anyways), I've built a small prototype CRP unpacker, so you can extract things like meshes, textures, and some metadata out of the CRP file without having to open the game. Unfortunately, since I can't import any of the Unity libraries, whoever builds the next version should probably move this over to a unity app instead of the current solution( plain old .NET app ). 

In order to use this, you'll need .NET framework 4.5, and to copy Assembly-CSharp.dll, ColossalManaged.dll, ICities.dll, and UnityEngine.dll into the app folder. Once you've done that, just drag the .crp file into CrpParser.exe, and it should output a folder containing:

Hopefully, we can get some interested people working on something for writing a standalone CRP/content packer,  so we can get pack stuff like animated textures and the like.

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Exporting the various files works fine (as far as my newbie eye can tell), but unfortunately there's nothing I can do with the .obj file that's being spit out by your tool.
Importing a new asset based on the .obj file (I have a "{obj-filename}_d.png" texture file in same folder) doesn't work - it shows up in the import list, but I get neither preview nor can I continue (button disabled), so I reckon it needs to be converted first. I've tried Autodesk's FBX Converter, but it's not working for me: I get a 'Not enough parameters' message and that's the end of it :( 

Am I missing something here?

Edit: I suspect there may be something with the exported .obj file. When I use ModTools to dump the mesh of the same prop, I can convert it to .fbx with FBX Converter without problems. However, importing that .fbx gives me nothing (still no preview, and the 'Continue' button is clickable once, then disappears...)

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

You can't convert it 1:1. The import adds some vertexes at the bottom for slopes. If you import it in 3ds max you can easily convert it to fbx.

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

All right, thanks for the info. What I need for some new features for American RoadSigns is a set of import-ready .fbx files (road sign props) so I can create additional ones to include in the mod (basically re-textured versions of the signs already included), and I hoped to be able to achieve that with a few (simple) tools. Knowing that it takes more than that, I guess I'll have to to rethink my approach (I have a sneaking suspicion that importing and exporting with 3D Max won't be as simple as just that, which means having to spend more time for trial-and-error, reading additional resources, etc. - something I have no desire to do).

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    4 hours ago, Darf said:

    You can't convert it 1:1. The import adds some vertexes at the bottom for slopes. If you import it in 3ds max you can easily convert it to fbx.

    Similarly, importing to Blender seems to work OK for me, there are some settings you'll have to configure to make the model game-ready (as I recall, mainly just moving the center of the model ).

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Nah, you got to invert one of the axis of the pivot of the model and cut off the bottom row of vertices. You can adjust the pivot or import using the center option. You also have to split one of the maps using colorchannels.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    I have tinkered around with the code a bit. My fork mainly introduces a AssetInfo object that gets returned by parseFile and bundles the parsed data.

    So you can say

    var info = new CrpDeserializer(path).parseFile();
    var name = info.metadata["name"];
    var preview = info.images[1];

    etc.

    Here's the link: https://github.com/clausthaler-devel/crp-parser/tree/master/CRPParser

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    And some more tinkering. While above tinkerings focus the developer sense of smugness, the following changes will appeal to the common user.

    The code now contains a windows app, as well as a (now working) command line tool to extract crp files. With both you can chose the output directory.

    Also some minor improvements to the code. Oh and I added a fincy fancy belly whistely installer for the clicky people.

    screenie:bmUWz3c.png

     

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Sounds like a great optimization, but when I try to extract a .crp file, I get an ImageMagick-related error ('Could not load file or assembly 'Magick.Net-Q16-AnyCPU ....').
    Also, you accidentally linked to the 0.1 version (this is the correct url: https://github.com/clausthaler-devel/crp-parser/blob/master/Installer/CRP-Extractor-0.2-Setup.exe?raw=true - your link text is correct, the href links to the 0.1 version).

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Works fine for me. There are no references to the Magick library anymore, so they hardly can throw an error. I'm pretty sure something has been mixed up during install. Try re-installing while making sure the extractor isn't running. 

    Meh, I packed outdated files into the installer. That is now corrected.

    Also: corrected link above.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Looks great! Thanks so much for the GUI!

    A note about the ImageMagick dependency though, it's in the first revision so that the app can convert the dds textures to png, in case anyone using the app can't use a dds viewer/editor or something. Something to think about...

    On 7/6/2016 at 11:32 AM, Tailgunner said:

    And some more tinkering. I removed the dependency of the ImageMagick Library, it was 10 MB fat! Now uses byte[]. new installer: https://github.com/clausthaler-devel/crp-parser/blob/master/Installer/CRP-Extractor-0.2-Setup.exe?raw=true

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    those textures are png format anyway. turning the byte array into a usable image is as simple as

            private static BitmapImage LoadImage( byte[] imageData )
            {
                return LoadImage( new System.IO.MemoryStream( imageData ) );
            }

            private static BitmapImage LoadImage( Stream stream )
            {
                try
                {
                    var i = new BitmapImage();
                    i.BeginInit();
                    i.StreamSource = stream;
                    i.EndInit();
                    i.Freeze();
                    return i;
                }
                catch
                {
                    return null;
                }
            }

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    8 hours ago, tony56a1 said:

    Looks great! Thanks so much for the GUI!

    A note about the ImageMagick dependency though, it's in the first revision so that the app can convert the dds textures to png, in case anyone using the app can't use a dds viewer/editor or something. Something to think about...

     
    With version 0.2, some png images are not displayed and they can't be opened.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    12 hours ago, Tailgunner said:

    those textures are png format anyway. turning the byte array into a usable image is as simple as

            private static BitmapImage LoadImage( byte[] imageData )
            {
                return LoadImage( new System.IO.MemoryStream( imageData ) );
            }

            private static BitmapImage LoadImage( Stream stream )
            {
                try
                {
                    var i = new BitmapImage();
                    i.BeginInit();
                    i.StreamSource = stream;
                    i.EndInit();
                    i.Freeze();
                    return i;
                }
                catch
                {
                    return null;
                }
            }

    Depending on the version of the package(probably, I only tested like 4-5 assets[also, sort of why I'm weary about adding unit tests where the test is just parsing a file]), the textures may be stored as a DDS file, preview images are always PNGs though. You probably don't need that dependency if you want save the file as-is, but I found it inconvenient to have to open visual studio or something to verify them.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    allright i will change it to byte[] for the previews and back to magick for the textures and make it load lazy so it only croaks when somebody accesses textures and the magick lib isn't there. that way you can keep the parser slick and when somebody needs the texture stuff /(s)?he/ can add the magick lib. i'll do installers with and without.

    btw, tony if you want to  continue on, please feel free to merge my changes. I refactored quite a bit and it's quite more friendly for unit tests imho. edit: oh, and because i added one unit test already (along with the test project).

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Man this is awsome! I uploaded a asset about a week ago and then lost everything (Game Install, Asset Meshes and Textures) because of a Trojan that royally screwed my PC up. 

     

    With this tool now I have a chance of getting it back and make an update that users have asked for. 

     

    Cheers

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    7 hours ago, Frontwards said:

    Hello, are you still going to release a binary at some point? could really use that LUT feature still. Thanks.

    Pretty sure you can dump the LUT with modtools somewhere in camera controller or some kind of render manager, there is a color correction manager or properties thing.


    Ronyx rhymes with electronics...  

    Steam  //  Twitch  //  YouTube  //  Twitter  //  CSLModding.INFO

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Hello,  i could not view or edit .json  on my blender. is any way for converse .json to .fbx or .obj?

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    6 hours ago, OLFced said:

    Hello,  i could not view or edit .json  on my blender. is any way for converse .json to .fbx or .obj?

    json files are not model files. They only contain plain text properties, like descriptions. You can open them with notepad.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Hi I've been trying to use the extractor but it comes up with an error saying it "could not load file or assembly". Is there any fix to this? I notice that Judazzz has had a similar issue and something got fixed, but I still have it.

    EDIT: Forgot to mention, I tried a reinstall, and the error isn't related to ImageMagick


    Here is my city Rodenburgh, a realistic and fully detailed European city and region. Come over if you're interested!

     

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Everything seems to be unpacking correctly except I don't know what to do with this file -> Jnks Casino Lot One_Data_3_obj.bin

    I assume this is the .obj file? I don't understand the .bin

    Can't open it with anything that I have tried. Can't convert it either.

    Please help me..

     

    Jnk

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    6 minutes ago, Jnkyrd said:

    Everything seems to be unpacking correctly except I don't know what to do with this file -> Jnks Casino Lot One_Data_3_obj.bin

    There should be a seperate regular .obj file which is the mesh.


    Ronyx rhymes with electronics...  

    Steam  //  Twitch  //  YouTube  //  Twitter  //  CSLModding.INFO

    Share this post


    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account

    Sign In  

    Already have an account? Sign in here.

    Sign In Now


    ×

    Thank You for the Continued Support!

    Simtropolis relies mainly on member donations to continue operating. Without your support, we just would not be able to be entering our 20th year online!  You really help make this a great community.

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running, so that we can help keep bringing SimCity players together to share our creations.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections