• Welcome to SC4 Devotion Forum Archives.

SC4 Model Tweaker Development/Support thread

Started by cogeo, April 11, 2009, 02:54:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.



When I perform the "Move" Function,Program Crash!
Err Info is below:

  问题事件名称:   APPCRASH
  应用程序名:   SC4MDT.exe
  应用程序时间戳:   4ba66d74
  故障模块名称:   StackHash_984e
  故障模块版本:   6.1.7601.17514
  故障模块时间戳:   4ce7ba58
  异常代码:   c0000374
  异常偏移:   000ce653
  OS 版本:   6.1.7601.
  区域设置 ID:   2052
  其他信息 1:   984e
  其他信息 2:   984e9e3e6bb420cd2f30a40472c6fd3d
  其他信息 3:   13b3
  其他信息 4:   13b339f56fc5705509f32445ffca56fc




Quote from: cogeo on October 08, 2011, 10:40:43 AMGetting the data needed for the preview from either zoom 3 or zoom 5 is the same, programming-wise.

When I said zoom 3, I meant Instance, not the in-game zooms.  It would be easier to just display a FSH, rather than the texture placed onto the model.  If you are going to do that, I think zoom 3 would be easier than zoom 4, as many models have multiple zoom 4 FSH (though I imagine the could have multiple zoom 3 as well).  If you aren't going to display an image, don't worry about it.

Quote from: Lowkee33 on October 05, 2011, 06:23:14 AM
-Models have a check-box next to them to decide what gets edited.
Hmmm, I have only seen this in web, not desktop applications.

Now that I think about it, I haven't seen this either.  I only bring this up in the case that you have an image of the model.  If people are going through the list for models to tweak, then I think there should be a way to store selections.

Quote from: Lowkee33 on October 05, 2011, 06:23:14 AM
-Notepad.txt support.  Select models based on a list.
While this feature wouldn't be hard to implement, I have some doubts about its usufulness.

This would be very useful to me, but I already have the script needed to make such a list.

Maybe it would help the NAM team?  I don't know.  If someone has a set of models that they know they will override, then a list might help.  Then again, they would probably all be in one .dat, so they don't really have to look...

Quote from: Lowkee33 on October 05, 2011, 06:23:14 AM
Now, my OS script no longer works after I re-orient.  My script looks at two specific Vertices and gets the OS from that.
I could take a look at this script. Btw what do you mean by OS?


The Reorient operation only changes the instance IDs of the 20 views (S3Ds) of the model. It doesn't renumber the materials, neither changes anything inside the model, just renumbers the S3D instance IDs (in a cyclic manner), and that's why this operation doesn't suffer any crashes.

I can tell you right away this will make my script not work.  The script looks at a zoom 0 S3D, and then two specific Vertices within it.  From this I can calculate the Occupant Size (OS).  Re-ordering the instances of the S3Ds will certainly make my script not work.  The vertices in each rotation are in different orders.  This picture might help:

For this case, my script looks at point 1&2 and caclulates the Occupant Size.  Occupant Size from point 1&2 in rotation 0 works, but it does not in rotation 1.  I will just make my script a little better.


Hi again,

As mentioned some time ago, a new Model TWeaker version is under development. Below is a screenshot:

New or updated features:

1. Merge Models opearation (not ready yet).
2. Added a new column in the list, displaying the Model Name. This is taken from the model's material list. It is meant to help the user identify the models more easily.
3. Added a new column, displaying the Changes performed. It shows a tooltip when hovered. As the S3D format is a "spec" (it cannot be changed), the contents of this column are of course discarded when the file is closed. That is, it displays the changes performed in the current editing session.
4. The columns in the list now display a small arrow next to the title, indicating the sorting column and order.
5. Added a command implementing selection of models, based on a list stored in the Clipboard (a request by Lowkee33). Also implemented its counterpart (copy selection-list to the Clipboard).
6. Increased the size of the most recently used files to 10 (was 5).
7. Fixed the bug with the Find/Replace masks in the Replace Textures operation, as well as a minor bug in the Reorient operation.

As for the crashes under Win7, I still don't have enough input. Does this problem occur on Win7 32-bit or Vista 32-bit as well?

Haven't worked on the crashes issue yet, and in this version the problem may be even worse, ie causing a crash as soon as you open a file, as the program now performs operations on S3D files on opening (retrieving the model name). Most probably I will have to update the S3D library, which is quite a bit of work. It may even be possible to make a 64-bit version, however this would require examining the code in the s3D library almost line-by-line, as the code may not be compatible.

At this point I can give away test-versions. Pls get the updated version from the link in this post.
There is currently no installer, neither documentation about the new features. Therefore you will have to copy the executable over an existing installation. You can find installation instructions here.

Happy testing!


I have been tested under Windows Vista. I open the program, then open a file and after a few seconds the program crash.
However I could not follow the installation instructions because I don't know how to overwrite the application. I tried deleting SC4ModelTweaker version 2.20 but I didn't see the program in the list of "uninstall programs". Sorry as I am not expert and maybe I do something wrong. &mmm

Anyway the news columns with Model names and change are a great addition.

                                    Links to SC4 websites


Works on an XP :)

The copy/paste to/from clipboard will certainly save me some time.  Thanks.  I am trying to get my Reader script in a shareable format.  Although it works, there are some issues with Reader.  Namely, it cant print many things at once without crashing (for me).  So, when I run my find wide models script, I have to do it in pieces that only print 10 models at a time.  This means copy/pasting to notepad and doing a bunch of Replace Alls.  There are also issues with Reader printing TGIs as integers, but for now I read RKT from prop exemplars.  :-\

Perhaps people will eventually share lists for resizing/moving certain models for better consistency. 

I like the Material ID listed.  This will be especially helpful for knowing who made what inside of a DatPack.


Hi Cogeo,

Not sure if this is the right place to ask, and also if this question is answered already... (please don't ban me).

Is it possible to give the tweaked model a different IID, so that I can use the unchanged and the changed model next to each other? Like an original version and a resized one of several ploppable terrain props (Heblems sands etc)?
My guess was that I need to change the IID's of all exemplars I see when I open the Readere, but this is new terrain for me.



@FrankU: Hmmm, everything is possible to implement, the only problem is the amount of work needed. As for the Model Tweaker, it is deisgned not to create new models (copies of the originals) nor change the items' IDs. Adding such capabilities would be a fundamental update, requiring extensive changes. More details in the program's help (check the Introduction section). So the procedure is copy/paste the 20 (or 1) model files and assign them a new instance ID, by using the reader's TGI Editor tool (you can change them massively and fast). No need to copy the FSH files if you don't change the Group ID. The section Further Modding Information describes how to do this.

You have given me an idea though, ie create a new file with copied models. I'll look into adding this feature in this release if possible. But I hope you understand that the crashes issue is of higher priority though. Btw are you experiencing crashes? What OS are you running it under?


This is really a great tool, thank you cogeo!  &apls

Quote from: Lowkee33 on November 20, 2011, 10:24:59 AM
Although it works, there are some issues with Reader.  Namely, it cant print many things at once without crashing (for me).  So, when I run my find wide models script, I have to do it in pieces that only print 10 models at a time.

A workaround would be to write the whole TGI list to a textfile:

-- declare an empty string variable
TGI_list = ""

-- loop through the entries and fill the variable (\n will print a newline character)
while .... do
    T, G, I = reader:entry_GetTGI(entry)
    TGI_list = TGI_list..T.." "..G.." "..I.."\n"

-- open a file handle and write the variable to the file
file = io.open("path/to/your/file.txt","w+")


Hi Cogeo,

I tried to use the tweaker this weekend for the first time. I had a Win7 (x64? not even sure) machine, but after the first action it crashed. I got this Win7 warning that gave me the option to run the program differently but this gave me no solution. Yesterday I did a small action during lunch hour at the office. Not even sure which OS on the network. I guess Win XP. It worked. That is all my experience with it.
What I was asking for was not to implement the option in Tweaker, althoug I won't stop you if you did.
I was thinking of editing in Reader indeed. The question could be rephrased into: What should I do in Reader to give the tweaked model its own IID. Is it enough to raise the IID values of all S3D exemplars of the original model by 1? Or is there more to it?

And then there is this question: when I use someone's model, change it and upload it this is considered fraud, isn't it?
I would like to use some models out there, but use them rescaled on lots. I want to upload these lots, but want to do it without fraud. So is there a possibility that I add some kind of information or file to my upload that makes the model rescaled like I want, but in such a way that the original model is still a dependecy? Something like a new prop exemplar: this needs the original model, althoug I can make it seasonal, floating in air and other options that are different than the original maker intended? I guess not?
Sureluy I can ask the original model maker to give permission, but what to do when he or she does not answer?

Thank you in advance,


I thought I answered this already: Link.  Anyway, all you have to do is clone the model's S3Ds, and change one of the first 4 digits of the instance.  It gets a little tricky, because you can't make an S3D have an Instance that is the same as a Maxis' S3D Instance.  You will have to go through Reader to find good spots.


@toja: Thanks!

@Carl: Thanks for explaining.

@FrankU: Carl already replied, now let's be a little more specific.

First of all, if you are going to release modified versions of other peoples' work, you should definitely make new models and exemplars and keep the originals, because other lotmakers may be using them in their original form. And it would be best to ask the creator's permission anyway, because they may not want them modified, who knows?

Here is an example:
If the model's ID is 0x5ad0e817,0x12345678,0x00030000, you can copy the 20 0x00030##0 S3D models, paste them into another (new) datfile, and renumber them to, say, 0x00031##0. This is an IID that neither Maxis, nor any BAT-exported model will ever be using, so it's almost certainly unique (unless someone else uses the same technique and number). Renumbering is done by using the reader's TGI Editor tool, and takes just seconds, as it can renumber all models at once. Then you can modify them with the Tweaker. Making the exemplar can be a little more troublesome, as the PM may not recognize such a model (ideally you could make a copy of the XML file too, and set the correct/updated dimensions in there, but this is just additional work). Better create the exemplar using the original model and then modify it in the reader - you need to set the new TGI IDs in the RKT1 property, as well as the new Occupant Size (if you have resized it).

Now if you are going to release these, you should only include the updated S3D models and the new exemplars - not any FSH files. You should also list the original prop-pack as a dependency (you need it because the FSHs are there).

Hope this helps.


Quote from: cogeo on November 22, 2011, 12:03:21 PM
If the model's ID is 0x5ad0e817,0x12345678,0x00030000, you can copy the 20 0x00030##0 S3D models, paste them into another (new) datfile, and renumber them to, say, 0x00031##0.

I am a little weary of changing the 5th digit (0x00031##0).  I believe that models that are rendered as foundations are given the fifth digit as a 1, perhaps it "turns off" shadows.  If this works, then don't mind me.  I feel better changing the first four digits.  I am pretty sure that Maxis left the 0xF8###### empty, and there is also a lot of space in the 0x6####### area. 


@ Cogeo and Carl,

Thanks a lot for your info.
So this means that I could indeed make my own edited models while the original still is necessary as a dependency? That might give me the opportunity to use them in uploads. Is there someone who can tell me what the bottomline is here? I'd like to be polite, of course.
The problem is: the makers of some of the models I am thinking of are not active anymore for quite some time now (Vanderaap and Haarlemmergold), so I don't know if they ever are going to read my PM's. And as copyrights last 50 or 70 years, I can't wait for that, because I will be dead by then....

And sorry that I overlooked your answer Carl, I didn't realize that this was the same question... Tweaking models is completely new to me.


Hi again,

I have worked a little with the crashing-under-Win7 issue. I made some easy/minimal changes, updating the header files, but not really checking the code of the S3D library in depth. I doubt if this will solve the problem, but who knows? If not, I will have to finally debug it and carry-out the necessary revisions.

Please download the updated version (V2.31-TEST) and report your findings. Testing should be easy, open a large prop-pack, select all models and apply a move or resize operations (then exit without saving).
You can download the updated version here.

Thanks in advance


I never cease to speak about that great tool SC4MT is , in my MD . The simple reason is that it has became absolutely necessary to my work , just like ILiveReader ... I enjoy even more SC4MTv2 and its new features , and , having noticed nothing wrong  with it ,( running this old dear XP ... ) so I have nothing to report here , except .... thank you . A lot . ;)


°   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °   °


Hi again,

@Cédric: Thank you for the nice comments! I visit your MD often (although I haven't commented yet ()sad()). You are doing an excellent job there, achieving a very realistic look! :thumbsup: Hope the new version of the Model Tweaker will be easier to use.

I have just uploaded a new TEST Version of the tool (V2.35-TEST). Here is the download link. Changes in this version:
- Fixed some issues with the use of the S3D library. As a result, the crashes-under-Win7 must have been solved. Win 7 users, please download and test.
- Finished implementation of the Merge Models operation. This one appends a model to the ones selected in the main list. A 20-Z/R model may be appended to 20-Z/R models only, while a 1-Z/R model may be appended to both 1-Z/R and 20-Z/R models.

The Merge Models command could prove useful in the following cases:
- Network Models (for draggable networks and puzzle pieces). Often developers need to merge models, eg monorail/elevated track and pylons or support structures. I'm even considering the feasibility of a true catenary (or near-catenary) overhead wire for rails, implemented as a 1-Z/R model (which wouldn't be that hard) and used as a network model, which really follow the variations of the terrain elevation (in contrast, props are either displayed upright, or sloped, according to the Orient To Slope property).
- Bridges: Many players would have noticed that the "network" (road or rail) displayed on bridges usually looks badly distorted (pixelated, blurred, bumpy etc) because of the distortions caused by the BAT renderer. Some developers have solved this problem by employing a simple planar (flat) model textured with the very same texture as the network (or a properly modified version, eg rail without those wooden sleepers) and placed just on top of the road or track bed. Placing such a model on top of all models of a bridge (End, Repeat, Support - and possibly more) is possible, but it's very labourious too (each model has 20 Z/R views). Even worse, if something is changed in the bridge models (eg a texture improvement) the procedure must be repeated. Now, with the Merge Models command, the network model can be attached to the bridge models within seconds - it as well rotates the 1-Z/R model, as needed for the different model rotated views. Even existing bridges could be improved, by adding the flat model on top of the original models - the flat model might need to be raised by 0.2m or so, before appending.

Please test the new version and report your findings. Please also post any ideas or possible improvements or requests. If everything is OK I'm gonna finish the documentation and release it as Version 3.00 (there are quite a few changes and improvements, to qualify as a new major version).

Hope you like it!


I just tested the version 2:35 and I have not had any problems. :)

On the other hand, I had think many times that would be very useful the possibility to rotate models 45 degrees. It could easily make many diagonal buildings.

                                    Links to SC4 websites


cogeo, my sincere thanks for your efforts here!  I've been an avid user of Model Tweaker for awhile now, and as a transit modder, Merge Models is going to make things so much easier.  I've just downloaded it and started giving it a whirl . . . so far, so good. :thumbsup:  (I happen to be on Win7, too.)



Merge Model looks very interesting, and also to need some prep work by the user.  Would merged models cast shadows on each other?


Does anyone know what happened to the SC4 model tweaker? ... Cogeo blocked and removed the file download links of the topic.!