Menu

LEX File Exchange
EA Support Files
SC4 Wikipedia
Network Addon Mod
Dependencies
Chat

Author Topic: SC4 Model Tweaker Development/Support thread  (Read 80023 times)

0 Members and 1 Guest are viewing this topic.

Offline Jonathan

  • NAM Team
  • Forums Guru
  • *
  • Posts: 2609
  • Total likes: 5
  • Reputation: 25
  • CL: Einstein, Jr. &scl()
Re: SC4 Model Tweaker Development/Support thread
« Reply #140 on: March 26, 2010, 02:33:13 PM »
I just downloaded it before I posted, and I removed the S3D.dll (I tryed with the dll and without)
The Details and About Box both confirm it is 2.20

This is what I get: Unhandled exception at 0x7771dcbb in SC4MDT.exe: 0xC0000374: A heap has been corrupted.
Jonathan

Offline cogeo

  • Moderator
  • Forums Parliamentarian
  • *
  • Posts: 1160
  • Total likes: 38
  • Reputation: 18
  • CL:
    SC4 Station Master
Re: SC4 Model Tweaker Development/Support thread
« Reply #141 on: March 27, 2010, 10:00:38 AM »
Then I would like to ask you to perform two tests, to help me locate the errors:

- TEST #1: Try the "Reorient" (not Rotate) operation only (it is enabled only for 20-Z/R models). As this operation does not really change anything in the S3D files (just renumbers them), it must not crash in any case, no matter how many times you run it (better try it again and again, without closing the program in between). This will help determine if there is a more general problem in the application itself, and not in the S3D routines.

- TEST #2: You will need two files for this, one with compressed and one with uncmpressed models. As such files most probably do not exist, you will have to make them. So open a big prop-file, find an ample number of compressed S3D models, and copy them in a new datfile (and save). Then select them, right-click and select "Save decoded file" (this will uncompress and save them). In a new datfile, right-click and select "Insert File", and in the dialog select all S3D files (allows multiple selection), and save as a new file. So now you have two files, one with all-compressed and one with all-uncompressed files. Use these for testing the tweaker. This will help determine if the problem concerns specifically the compression/decompression process.

Thanks

Offline Jonathan

  • NAM Team
  • Forums Guru
  • *
  • Posts: 2609
  • Total likes: 5
  • Reputation: 25
  • CL: Einstein, Jr. &scl()
Re: SC4 Model Tweaker Development/Support thread
« Reply #142 on: April 18, 2010, 12:04:56 PM »
I doubt it is a problem with the S3D.dll (no offence) as the reader works fine with it.

I have not had time to test these but I will get to it.

Why don't you try testing it on Windows 7 yourself, I imagine you will get much more detailed information from the debugger with the source code. At least I know on Visual Studio with VB.net it highlights which line the program last executed before it terminated.

You get a 90-day trial here: http://technet.microsoft.com/en-us/evalcenter/cc442495.aspx (it's official from Microsoft for the purpose of developers testing their software)

But When the website asks "What occupation best describes you?" say Developer.

After trying out various combinations I found that these settings were the best for materials on a model:
flags-all
alpha F - greater
Depth F - less than or equal
src bl - source alpha
Dest Bl - one minus source alpha
wrap - clamb
Mag. Filter - billinear
Min. filter - billinear, no mipmapping
Alpha Threshold - either 00 or FF(256) (I can't remember)

I would like to set these options to every material in every S3D in the file but to do that now is very laborious and repetitive. So could there be an option in The tweaker to do that for me I just enter the details I want in to a window and click OK and it will go through the selected S3Ds and apply them to all the materials found in each S3D.

The other request which i think you have said no to a similar thing (but you might be able to use some of the reader's source code especially as ilive is back) is to display the S3D in a preview pane like the reader but allow the deletion/moving of vertices. So you can maniulate the model as you would in g/max.


Thanks For this great tool again
Jonathan

Offline cogeo

  • Moderator
  • Forums Parliamentarian
  • *
  • Posts: 1160
  • Total likes: 38
  • Reputation: 18
  • CL:
    SC4 Station Master
Re: SC4 Model Tweaker Development/Support thread
« Reply #143 on: April 18, 2010, 03:53:04 PM »
Jonathan, I know where the crash occurs, it's when the program releases a memory block, but there nothing wrong with that, heap corruption actually happens long before (this is when the system "understands" this). So testing under Win7 won't help. The only thing i can do is ask (and greatly involve) Alain (ilive). He's really busy for now, and I don't know if he has the time (and the will) to look into a problem which doesn't really concern him. Even if the bug is finally in the S3D library, it isn't a great problem for the reader, because the user can (manually) edit only a few files at a time, so in most cases it won't really crash. We should be thankful for offering his work and his help, and not bother him with things like these.

You didn't run the tests I asked for, this would be really helpful (and I have to add that I really expected so).

As for the extra feature you are asking for, is rather a new function, and needs to be described in more detail:
- First of, find a meaningful name  :P
- What should be optional here and what fixed?
- I haven't heard of the Alpha Threshold, and I'm not sure if the S3D library supports this. How do you edit it? Any further info?

The 2nd request is beyond the scope of the tweaker (it doesn't read FSH textures or display models) plus editing a single item is better done (or can be done) in the reader. In addition it requires many data consistency/integrity checks. I think it would be best to ask Alain for this, but I'm afraid this is beyond the reader's scope as well (this is basically the job of modelling programs).

Offline cogeo

  • Moderator
  • Forums Parliamentarian
  • *
  • Posts: 1160
  • Total likes: 38
  • Reputation: 18
  • CL:
    SC4 Station Master
Re: SC4 Model Tweaker Development/Support thread
« Reply #144 on: June 09, 2010, 03:39:44 PM »
Hi all,

I have just released a newer version of SC4 Model Tweaker (V2.20).

The updates in this version are:
- The program no longer uses S3D.DLL as a dependency. Instead, it has the code included in the program (thanks again Alain!).
- Fixed a bug in the "Scale" operation (X-only & Y-only scaling for 20-Z/R models, ie "deforming").
- Fixed some linguistic errors (eg Nominator changed to Numerator).
- Added a Warning dialog and updated the About dialog accordingly (both state that the program was made with a pre-release version od the development tool - required by Microsoft).

The changes had actually been already made by March, however the program was not available as a release version, only a test version was delivered to certain testers.

The reason I release it now is that my beta version of the development tool (MS Visual Studio 10b) was about to expire tomorrow. Now it says it will expire in 20 days, but I had to be sure. I was planning to add some more features (esp the Merge models command) and further research the crashes-under-Vista/Win7 problem, but given the lack of interest from the community, and the lack of time, I had actually stopped development.

You can download the new version from the LEX

Offline sdc16064

Re: SC4 Model Tweaker Development/Support thread
« Reply #145 on: September 22, 2010, 08:57:43 PM »
I tried to use the newest version, but after I "try" to scale a model, it crashes. Can someone tell me what to avoid that or how to fix it?

Offline Lowkee33

Re: SC4 Model Tweaker Development/Support thread
« Reply #146 on: November 23, 2010, 10:17:52 AM »
Getting to put this through the spin cycle today :)

I am having some trouble with the UV maps.  I have S3Ds that are using more than one FSH (multiple entries in the Material ID).  The UV maps appear to have lost the image in them and instead show a gray/grid type structure.  So far this has only happened in zoom 5, but that is the only time that there are more than one Material IDs.  Perhaps I am missing something.  All of the Material IDs have been changed correctly.  I could post a picture if it would help.

Thanks

Edit: Okay, looks like this isn't specific to Model Tweaker.  I get the same results when doing it manually in Reader.

Edit#2:  I solved the problem, and I think it is worthy to note.  If you notice in the lower right hand corner the T/G/I is using the wrong group.  When I changed the Instance of the FSH and then the Material ID the proper group was used.


I can only think that we have to be careful about using more unique Instances as well groups.
« Last Edit: November 24, 2010, 09:23:54 AM by Lowkee33 »

Offline cogeo

  • Moderator
  • Forums Parliamentarian
  • *
  • Posts: 1160
  • Total likes: 38
  • Reputation: 18
  • CL:
    SC4 Station Master
Re: SC4 Model Tweaker Development/Support thread
« Reply #147 on: November 26, 2010, 10:03:50 AM »
The Material IDs (in the S3D files) do not contain any Type or Group info, only the Instance IDs. The FSH files are expected to have a Group ID equal to the S3Ds' Group ID, or the special value 0x1abe787d. This one is used a lot for network textures (take a look into NAM, most textures use this special Group ID).

Now how the reader displays this, I haven't digged into its code, but I guess the Type ID is fixed (0x7ab50e44 means FSH), while the Group ID should be equal to the S3D's group (0xb9eeefd4), but as such a FSH file wasn't found in the same .dat, it just displayed the default (0x1abe787d). That is, of the values displayed, only the Instance ID is actually taken from within the S3D file itself, the rest are just "calculated" values.

So if you create a copy of the S3D files, changing only the instance IDs but leaving the group ID as is, you can then modify the copied model, still using the original textures. To see an example of changes applied to a copied model, take a look at the magnified nuclear power plant model, at the end of the 2nd post of this thread.

Offline Lowkee33

Re: SC4 Model Tweaker Development/Support thread
« Reply #148 on: November 26, 2010, 12:39:54 PM »
Quote
This one is used a lot for network textures (take a look into NAM, most textures use this special Group ID).

Ah yes, I typed this ID quite a few times last night as I was making Chris Adams' gravel paths draggable.

Quote
So if you create a copy of the S3D files, changing only the instance IDs but leaving the group ID as is, you can then modify the copied model, still using the original textures.

In my case, changing the groups/instances of the FSH files is necessary.  I am trying to set up three models for seasonal mayor mode flora.  For this to work the groups all have to be the same.  SC4 will basically cycle through three models in order of their instance.

The models I am working on here originally have unique groups and the same instance, so first I have to change the group, and then to avoid overwriting each other I also need to change the Instance, and then the material ID...

I did this once with no problem, but this time it happened (the group switched to 0x1abe787d).  The FSH instances where along the lines of 0x00010400.  To solve it the only thing I did was change the FSH instance to 0x00018400.

This problem only occurred when the model had two Material IDs (hence zoom 5)   

Offline Kergelen

Re: SC4 Model Tweaker Development/Support thread
« Reply #149 on: February 27, 2011, 05:01:31 PM »
Quote
I was planning to add some more features (esp the Merge models command) and further research the crashes-under-Vista/Win7 problem, but given the lack of interest from the community, and the lack of time, I had actually stopped development.
Hi Cogeo,

I'm trying to scale some models but the program crashes. I have Vista and I would like to know if the crash problem is solved and if the development is stopped permanently. &mmm
Thanks


                                    Links to SC4 websites

Offline cogeo

  • Moderator
  • Forums Parliamentarian
  • *
  • Posts: 1160
  • Total likes: 38
  • Reputation: 18
  • CL:
    SC4 Station Master
Re: SC4 Model Tweaker Development/Support thread
« Reply #150 on: February 28, 2011, 03:02:15 PM »
Development is currently stopped indefinitely. Add to the reasons mentioned the expiration of the development tool, which is currently not available as a beta version; there is a trial version available, however it's not legal to release products made with it. I'm sorry for not being currently able to provide a solution.

There is only one workaround, operate the program under XP (find an older computer, laptop, notebook etc, and install the program there); datfiles can be transfered via a network or wireless connection, or a USB stick. You don't need to install anything else (like the MSVC runtime) as the program is fully self-contained. More importantly, you don't need to install anything SC4-related, just the Tweaker itself.

Another way is try to scale one model at a time. Scale one model first; if it crashes try again several times, usually it works. If the operation was successful, save the file. Then try the next model, etc.

Offline Kergelen

Re: SC4 Model Tweaker Development/Support thread
« Reply #151 on: March 01, 2011, 08:10:53 AM »
Thanks for explanation Cogeo,

I tried several times but the problem is that the models are in a .dat file and I don't know how to extract each model. Is there any tool to do it?

Anyway, I will try under XP...


                                    Links to SC4 websites

Offline cogeo

  • Moderator
  • Forums Parliamentarian
  • *
  • Posts: 1160
  • Total likes: 38
  • Reputation: 18
  • CL:
    SC4 Station Master
Re: SC4 Model Tweaker Development/Support thread
« Reply #152 on: March 01, 2011, 08:51:18 AM »
You don't need to extract anything, the program should open all valid DBPF files (.SC4Model, .dat etc). Operations are applied to the model(s) selected. So if you select one model, the operation (scaling in your case) will be applied to this model only.

Offline Kergelen

Re: SC4 Model Tweaker Development/Support thread
« Reply #153 on: March 02, 2011, 07:37:17 AM »
Ok.

Yesterday I tried with another computer with XP and it works perfectly . Very fast, very easy and very useful tool.  ()stsfd()

Thanks again Cogeo.


                                    Links to SC4 websites

Offline cogeo

  • Moderator
  • Forums Parliamentarian
  • *
  • Posts: 1160
  • Total likes: 38
  • Reputation: 18
  • CL:
    SC4 Station Master
Re: SC4 Model Tweaker Development/Support thread
« Reply #154 on: October 03, 2011, 01:57:34 PM »
Hi all,

I'm considering releasing a newer version, at least implementing the Merge Models operation. Please post your suggestions or wishes. Also bugs and possible improvements.

I would also like to adddress the crashes problem. I need some information. Are you experiencing crashes on the 32-bit version of Win7, or on the 64-bit version only?

Thanks

Offline Orange_o_

  • VIP Team
  • Forums Senator
  • *
  • Posts: 710
  • Total likes: 10
  • Reputation: 9
  • 私たちは皆、日本人です - We are all Japanese
    • My creations for Sc4
  • CL:
    Like a Rock
Re: SC4 Model Tweaker Development/Support thread
« Reply #155 on: October 03, 2011, 02:21:32 PM »
Hello Cogeo,

First I wanted to thank you for this wonderful tool. A new version! Great! even better if you continue to develop this software.

Personally, the only complaint I could make would be viewing the "exemplar name" open files. I'm beginning to saturate  to 0x5AD0E817, 0xDA1E90DC, 0x00030000  $%Grinno$%


Thank's  :thumbsup:

                                                                                


Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Re: SC4 Model Tweaker Development/Support thread
« Reply #156 on: October 03, 2011, 11:28:26 PM »
I assume you are using the VS 11 Developer Preview as your IDE.  :D

Offline cogeo

  • Moderator
  • Forums Parliamentarian
  • *
  • Posts: 1160
  • Total likes: 38
  • Reputation: 18
  • CL:
    SC4 Station Master
Re: SC4 Model Tweaker Development/Support thread
« Reply #157 on: October 04, 2011, 04:19:45 PM »
Personally, the only complaint I could make would be viewing the "exemplar name" open files. I'm beginning to saturate  to 0x5AD0E817, 0xDA1E90DC, 0x00030000  $%Grinno$%
Yeah, there is needed something to help the user identify the model(s) more easily. A preview pane at the right side would be ideal, however this would require a lot of work and many changes - accessing and applying the textures - as the program currently is designed to work with S3D files only (all others aren't used, but they are kept in memory and saved unchanged when the datfile is saved). And there are other issues, eg the textures may not be in the same datfile as the models. The "exemplar name" you mention isn't easy to make either, not only the exemplar may be in a different datfile, there may be no exemplar at all, or there may be multiple exemplars referring to the same model, and these in turn require searching into the folder or the whole SC4 installation, and again, having to cope with a file type "unknown" to the tweaker (the exemplar). Another source could be the XML, however many developers remove it, and Maxis models, as well as models with 1 Z/R don't have an XML file anyway. So I think the easiest and safest way is to use the model name in the model's material. I'll try to use these ones.

I assume you are using the VS 11 Developer Preview as your IDE.  :D
Not exactly, it will be VS 10 Premium, and this is a legal license, not a preview or trial one (so that stupid warning during the launch will go). The first version was made with V 2008 Beta, and the second version with V 2010 Beta. Now I'm using V 2010 Premium and this should be OK. If you open a project with a newer version of the IDE, it is "upgraded" to the new version, but this "upgrade" doesn't always go smoothly. By using V 10 again, I won't have to upgrade it once more.

Offline Lowkee33

Re: SC4 Model Tweaker Development/Support thread
« Reply #158 on: October 05, 2011, 08:23:14 AM »
Exciting news :)

First, I want to say that Model Tweaker is a great tool for editing models.  I think that getting the crashes to stop would be the main priority.  I would be hesitant to connect the model to an exemplar or XML, but I think that FSH may be a good idea.  Perhaps just a zoom 3 (do any models have multiple zoom 3 FSH?), we don't need a whole lot of information, just enough to know what the model is, and perhaps its orientation.

I wrote a long post, but I will try to sum it up now.  Just some ideas to throw out there. 

What I envision:

-Models have a check-box next to them to decide what gets edited.  If you are using FSH to find a model I think that you will need more than just the default Ctrl/Shift method of selecting.
-Sorting options.  Models can be sorted by size for easier finding.  You could even do Date Created (By ignoring the first digit of the Group ID.  If people edit their TGIs, then it's likely that they are already in some type of order)
-Searching.  Find models via TGI (the Reader way of "filtering" is quite powerful).
-Notepad.txt support.  Select models based on a list.

That final one might be useful only to me.  Basically, I have a Reader script that calculates Occupant Size from a zoom 0 s3d.  When I do things en-mass like this I often get snagged when some people rendered, say cars, facing south, while others have rendered them facing west.  Then it is a matter of having the script say "if the width is greater than the depth, print the TGI".  I then enter MT and re-orient based off this list.

(MT may could this option built into it: Re-orient to length-wise or width-wise.  This is probably just me though.) 

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 believe that MT changes the order of these Vertices.  I admit, I do not know how MT re-orients.  I would believe that it doesn't just change the Instance of the s3d, as it works with a model that only has one rotation.

Re-orienting X,Y,Z values is not too hard to do as a formula, but there are probably issues with U,V.  I could see a way around this:  Store the original Vertex values.  Calculate the new X,Y,Z values.  Find the original X,Y,Z that match the new X,Y,Z, and then set the U,V of the new Vertex to be the same as that old one.

Again, not sure the complexities of the S3D/FSH relationships that MT uses.  You must change the MatID when you re-orient, right?

Oh well, hope you found something interesting here :)

Offline cogeo

  • Moderator
  • Forums Parliamentarian
  • *
  • Posts: 1160
  • Total likes: 38
  • Reputation: 18
  • CL:
    SC4 Station Master
Re: SC4 Model Tweaker Development/Support thread
« Reply #159 on: October 08, 2011, 12:40:43 PM »
...Perhaps just a zoom 3 (do any models have multiple zoom 3 FSH?), we don't need a whole lot of information, just enough to know what the model is, and perhaps its orientation.
Getting the data needed for the preview from either zoom 3 or zoom 5 is the same, programming-wise. The problem is that this is quite a bit of work, requiring restructuring the program internally, since as explained in my previous thread, it currently works with S3D files only.

-Models have a check-box next to them to decide what gets edited.
Hmmm, I have only seen this in web, not desktop applications; and even there, it's meant to compensate for the lack of the ability to select items in some "list control" in browsers. The Shift/Control way for selecting is the standard in desktop applications (and has the advantage of allowing range selection). And then (ie if having both modes) how to determine on which selection should operations applied on? We would need dual commands, like "Resize Selected Items" and "Resize Checked Items", which may be confusing to the user. Could you suggest a desktop application that uses both modes efficiently?

-Sorting options.  Models can be sorted by size for easier finding.  You could even do Date Created (By ignoring the first digit of the Group ID.  If people edit their TGIs, then it's likely that they are already in some type of order)
These are quite easy to make actually, all I need is to add the Size and Date columns. Currently the items are sortable by any of the columns, only that little arrow indicating the sorting order is not shown (I'll add this too).

-Searching.  Find models via TGI (the Reader way of "filtering" is quite powerful).
Please note that the list displayed in the MT is generally much sorter than the one in the reader: only the S3D files are displayed, and the 20-Z/R ones are collapsed in a single line.

-Notepad.txt support.  Select models based on a list.

That final one might be useful only to me.  Basically, I have a Reader script that calculates Occupant Size from a zoom 0 s3d.  When I do things en-mass like this I often get snagged when some people rendered, say cars, facing south, while others have rendered them facing west.  Then it is a matter of having the script say "if the width is greater than the depth, print the TGI".  I then enter MT and re-orient based off this list.
While this feature wouldn't be hard to implement, I have some doubts about its usufulness, not only regarding the effort needed to implement it vs the time it will save custom content developers, but even its efficiency regarding the user alone: one will have to write a script, test and debug it, and finally run it and paste the results into the MT! And all this only to supposedely facilitate the selection procedure! Wouldn't it be more efficient to select the items one by one? Pls take into account that the new version will be displaying the model name, which helps quite a bit.

(MT may could this option built into it: Re-orient to length-wise or width-wise.  This is probably just me though.)
Well, this is a quite custom feature, isn't it? Please don't make requests for features that you are going to use only once or twice, instead make requests for features that you will be using more regularly. For this reason, I rather lean towards respectfully declining it, as well as the previous one.

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?

I believe that MT changes the order of these Vertices.  I admit, I do not know how MT re-orients.  I would believe that it doesn't just change the Instance of the s3d, as it works with a model that only has one rotation.
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. For examplre, if you reorient the model 90 counter-clockwise, the 0x00030#00 model IDs will be changed to 0x00030#10. And these, will of course still be using the 0x00030#00 materials. And the opearation doesn't work for 1-Z/R models (it is disabled). More details in the MT Help (click on the help button and then click on the part of the program for which you want to display context-sensitive help) - it seems nobody is reading it.  ::)

Re-orienting X,Y,Z values is not too hard to do as a formula, but there are probably issues with U,V.  I could see a way around this:  Store the original Vertex values.  Calculate the new X,Y,Z values.  Find the original X,Y,Z that match the new X,Y,Z, and then set the U,V of the new Vertex to be the same as that old one.
Again, not sure the complexities of the S3D/FSH relationships that MT uses.  You must change the MatID when you re-orient, right?
What you call "Re-orienting" here is actually the "Rotating" operation. This one indeed relocates vertices, and again, leaves the materials and UVs unchanged - why change these? This operation can be applied to 1-Z/R models only. Check my SC4 Automata as Props tutorial to see an example. Actually I wished to have a real "Rotate" operation for 20-Z/R models as well, but unfortunately this is not technically possible (here is the discussion). Therefore I made the Reorient operation for these models, as a rather poor substitute (effectively "rotating" the model, but in steps of 90 only).