• Welcome to SC4 Devotion Forum Archives.

how do you extract model files from .dat files?

Started by hal1979, November 11, 2008, 07:46:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hal1979

Is there a program I can use to extract model files from *.dat files so I can turn the model into a prop for use in the lot editor?? I like to make my own lots for the buildings I download so I turn all the models I get into props. I have about 76 *.dat files, but for some reason 9 of them don't show up in the plug-ins manager nor do the models show up in the lot editor prop list. Thanks in advance if anyone can help!

squidi

in this case it could be that in the dat are more than one model.
you need reader you will find the program under data modifying tools in the lex.
you open the dat in reader and if there are more than one model in the dat every model has its own group id.
sort the list by group id pick all files with same group id and copy- paste them into a new dat.
with the new dat with one model included you can make props in pluginmanager

hope that was right  :)

-paul

mrbisonm

........hm, sounds good and interesting. I didn't think that it was possible to redraw datfiles from a collective dat.......but now...ehem, how do you make a new datfile?   &mmm


....Uploading the MFP 1.... (.........Finishing the MFP1)

squidi

paste the model related files in blank.dat and than -save as-

i dont know if i told all corect but i did that often and it always worked fine for me

jestarr

You don't need to extract any model files to make them into props.  Just make a prop exempler, with the Plugin Manager, from the model that's in the dat.  The dat is then a dependency and will show up in the LE as a prop, just as the Maxis ones do in their bldg_prop01 and 02.

squidi

argh .. one short look into plugin manager and i had saved a lot of time :)

i cant believe that i didnt tried that out befor i did all that extracting work

mrbisonm

Thanks , it worked fine with the PM.....why didn't I check this before? &Thk/(


....Uploading the MFP 1.... (.........Finishing the MFP1)

hal1979

If you read my original post, I state that the 9 .dat that i am having trouble with don't show up in the plug-in manager at all. The .dat says that it is the model file, but I get nothing. I have other .dat (67, in fact) that I have made into a prop using the plugin manager, but these nine do not seem to want to co-operate.

jestarr

What exact .dats are you having a problem with?  If I knew, I could look at them and maybe see what the problem might be.

RippleJet

#9
By the sound of it, I'm pretty sure you're dealing with prop packs where the XML files have been deleted.
When using SC4Tool to merge files, there is an option to discard the XML files.
I know myself that I did that by mistake when making DragonAnime's prop packs.

Even though the standard today is to keep those XML files when merging mega packs,
there are several older packs that have the XML files removed.
Besides, I think Pegasus still purposely removes all XML files from his models.

It isn't too difficult to recreate a missing XML though.
The example below is based on BSC MEGA Props CARCH Vol 05 (which also lacks all XML files).






Open the dat file in Reader. First we need to sort the files, so that we get the models separated.
1. Click the Instance column heading
2. Click the Type column heading
3. Click the Group column heading

This will sort the internal files so that all FSH and S3D belonging to the same model (having the same Group ID) are listed after each other.
Click on the first S3D in this range (having an Instance ID ending in 0000). This will show the model for zoom 1, south view.
(If you want a better view of the building, click on the file having an Instance ID ending in 0400. This is zoom 5, south view).

Having the zoom 1 model open, click the Vert tag up on the right,
and expand Group 0 of vertices by clicking the + to the left of the green field saying Group 0.
Notice the vertices under X, Y and Z columns. You will need these values later on:








Now, we need to find an existing XML file from another SC4Model file, that we can copy into this mega pack.
Any SC4Model file would suffice, as long as it has the XML file intact (most models have, except those made by Pegasus).
The picture below shows the XML file included in the file RubberFactory-0x5ad0e817_0xeefd7c77_0x80000.SC4Model.

Locate the XML file, right-click on it and select Copy File(s) (or press Ctrl-C).



Note also the content of the XML file (shown below). It doesn't really contain too much information.
This is all the information Maxis' Plugin Manager needs to display the model.








Next, go back to the mega pack, right-click on the S3D file having the instance ID ending in 0000.
Select Paste File(s) (or click Ctrl-V):



This will insert the XML file right after that model file.
However, since we now have the files sorted after Group/Type/Instance, it won't appear in the listing at this position.






In order to find the XML file now, be sure you still have the model file selected (file Num 67).
Now, press the Num heading in order the resort the files in order of appearance.

The XML file will now appear as File Num 68, immediately after your model file.
Now comes the important step of correcting the Group and Instance address for this XML file:

1. Click the File Info button on top, and the Edit button in the File Info window.
2. Edit the Group and Instance ID's to match those for the model file above. Do not edit the Type!
3. Click OK to close the Edit window, and the red cross to close the File Info window.



To verify that the Group and Instance ID's are correct, select another file (e.g. the model), and then select the XML file again.
Reader won't update the address until it has reloaded that file.






Now, only one thing remains to be done. The editing of the XML file's content.
When the XML file is selected, click the Edit button on top of its content.



Edit the following content:

1. Name=""
Insert the name of the building between the quotes.
If you know the name the creator used, insert that one.
Otherwise, you will have to come up with your own name.

2. ResKey=""
The first number (Type) remains unchanged, but the next two numbers must be edited,
to match the Group ID and Instance ID of the model file (the one having an Instance ID ending in 0000).

3. Width=""
Now you need to go back to the table of vertices shown in the first picture in this thread.
The width is the difference between the smallest and largest X-values (precision with no more than three decimals).
In this case 23.75 + 23.801323 = 47.551

4. Height=""
The height is the difference between the smallest and largest Y-values (precision with no more than three decimals).
In this case 59.803837 + 0.200001 = 60

5. Depth=""
The depth is the difference between the smallest and largest Z-values (precision with no more than three decimals).
In this case 23.223610 + 23.323608 = 46.547



When you've edited all values, do remember to click the Apply button on top. Otherwise nothing will be saved.






After this you should also right-click and Reindex the model file / mega pack:



Finally, click the Save button to save the whole dat file (the mega pack).






And just to verify that this model is now seen by Plugin Manager:








Now just follow the same procedure for all other models in the pack... ::)

kuehmary

I followed the tutorial exactly but the models will not show up in PM. What should I do?

BarbyW

1. Make sure that the dat you want to make a prop out of is in the root of plugins not in a sub-folder.
2. If it still isn't showing in PM, repeat the tutorial.
3. Wait patiently for SC4PIM.
Inside every old person is a young person wondering what happened. TP



Barbypedia: More alive than the original

kuehmary

Thanks for the advice. I tried the tutorial again and it worked.

Leodido

Thanks for this tutorial!

Also I was wondering what is the use of the "Generate XML files from Exemplars" under the tool menu, doesn't it do exactly that?

Omnia, my first MD. Check it out!

RippleJet

Quote from: Leodido on July 31, 2009, 12:07:52 AM
Also I was wondering what is the use of the "Generate XML files from Exemplars" under the tool menu, doesn't it do exactly that?

Not quite...
That generates the XML file that PluginManager generates when descriptor files (SC4Desc) are made.
It's probably used by LotEditor, but isn't even needed. LE can still use descriptor files, even id you delete that XML file.

ponnie

Thank you so much, RippleJet, for this great tutorial  &apls.

One thing I would like to mention is to reindex the megapack (on the left screen ) before saving it in Reader. Otherwise you might end up with one screwed up megapack (this happened to me with MJB's, so all BLS farmfields turned into boxes. After reindexing everything was once again working fine).

RippleJet

Quote from: ponnie on August 27, 2009, 06:29:02 AM
One thing I would like to mention is to reindex the megapack (on the left screen ) before saving it in Reader. Otherwise you might end up with one screwed up megapack (this happened to me with MJB's, so all BLS farmfields turned into boxes. After reindexing everything was once again working fine).

Good point and thank you for reminding me, ponnie! :)

Added that to the tutorial. ;)

ponnie

Quote from: RippleJet on August 27, 2009, 07:08:41 AM
Good point and thank you for reminding me, ponnie! :)

Added that to the tutorial. ;)

Don't mention it. I'm glad I could make a tiny contribution to this great community ()stsfd().