R Soul on 26/12/2012 at 14:02
Let's say your obj folder is all messed up - there are loads of objects in there and you've no idea if you need them. Here's a technique that can tell you which ones your mission uses.
(Requires the NewDark update)
Part 1) Most objects are created by you. The model they use is set by their Shape > Model Name property. This will find each one for you:1) Run these commands, or select their equivalent items from your custom menu:
hilight_obj_type physical
hilight_add_prop modelname
hilight_clear
2) AI meshes are in the mesh folder, so they should be filtered out for now
hilight_obj_type creature
hilight_rem_prop modelname
hilight_clear
3) The same applies to PlacedRope objects if you have any. Repeat the above step with placedrope instead of creature
4) To get the list of AI models, do step 1 with creature instead of physical and ignore step 2
(and do it again for placedrope if necessary)
5) All concrete objects will now have the Shape > Model Name property. The correct value will be inherited from the hierarchy.
Existing properties will NOT be overwritten.
6) Open the object hierarchy, and select Physical
Edit this, and add the Shape > Model Name property. The value doesn't matter.
7) With that property selected, click on Hierarchy Op. Select 'Delete Property' and 'Abstract Descendants'.
Then delete the property from Physical.
8) Close the properties, and go back to the Physical archetype
Click on Query. Select Shape > Model Name.
9) It will list all occurrences of that property, along with each value.
Click on Save and you can save the results in a text file.
10) You should now reload your mis/cow so that the mission and gamesys are reset.
The list is not yet complete. Some objects get created dynamically in game. There are several ways of doing that:
Part 2) Emitting objects:1) Use hilight_by_prop cfgtweqemit to find objects with the Tweq > Emit property. The highlight will include objects where the property is only on the archetype.
2) Next, type hilight_add_prop cfgtweqemit. If the property did not exist on any of the highlighted objects, it will now.
[INDENT]- Use the command hilight_render 1 to filter out brushes that have not been highlighted. (A value of 0 does the opposite)
- If the only highlighted objects are things like noise or fire arrows, you can skip this section (unless you've modified the things those arrows emit).[/INDENT]
3) Go back to Part 1 steps 6-9, but select Object instead of Physical, and use the property Tweq > Emit.
4)It is important to note that the 'emit' value is the archetype name, not the model name
[INDENT]- use find_object to go to each archetype and note each Shape > Model Name property
- in NewDark the Object Hierarchy window has a 'Filter' field which is also useful.
- if you don't see the Model Name property, check the parent archetype(s).[/INDENT]
5) Use hilight_clear to turn off the highlight.
Part 3) Some objects cycle through a list of models1) This applies to things like torches and gaslights. Also, the Mechanist cameras change their model based on their alert state.
[INDENT]- hilight_by_prop cfgtweqmodels
- hilight_add_prop cfgtweqmodels[/INDENT]
2) Do Part 1 steps 6-9 again, starting with Physcial and using the Tweq > Models property
3) In this case, the values are model names, so just copy each one.
[INDENT]- e.g for a torch, there are 5 model names: newt02, newt03, newt04, newt05 and newt01[/INDENT]
Part 4) Some objects may be created by a Receptron you've added.1) There doesn't seem to be a way of highlighting all objects with receptrons, so you'll have to find the following receptron effects yourself:
[INDENT]- Create object (archetype)
- Change object model (model name)
- Clone object properties (archetype may include a model name)
- Add Metaproperty (metaprop may contain a model name)[/INDENT]
2) Only concern yourself with effects that you have created. Unless you've made extensive use of them, chances are you'll be able to remember which ones change the object's the model name.
- Don't forget to check archetypes as well as concrete objects.
- If you want to be really pedantic, a 'Stimulate object' effect could cause the target object to respond by changing its model name using one of the four effects mentioned above.
Part 5) You might have used custom scripts to create objects (e.g. NVCreateAndLink).1) This really depends on how the script is set up, but in some way it will refer to an archetype name (links or the design note property).
Part 6) Corpse and Flinderize links1) This is harder because links within the object hierarchy are inherited but not shown on the concrete objects. E.g. you can create a WoodCrateSealed, and it won't show any Flinderize links. If you look at it's parent archetypes, you'll find them from Crate (-1842).
2) Select Physical in the Object Hierarchy
3) Query all links of the desired flavour: shows all archetypes and concrete objects
4) Save the results to a text file
5) Go through it line-by-line. Use hilight_obj_type.
[INDENT]- It should be easy to ignore some lines, e.g. if you haven't created any MechBanners or ScurryBots[/INDENT]
[INDENT]- Use hilight_render to make sure you can see any highlights
- If nothing highlighted, move on to the next line
- When there are highlights, examine the model name of each dest object of all links[/INDENT]
[INDENT][INDENT]- Use find_obj to take you to the archetype of each link dest object
- If the Flinder/Corpse is a particle effect, you can ignore it
- You can ignore links to particle effects, such as SmokePuff or GasArrPuff[/INDENT][/INDENT]
[INDENT][INDENT][INDENT]- If in doubt, go to the archetype and see if Render Type is 'Not Rendered' (look at the parent archetype(s) if you don't see the property)[/INDENT][/INDENT][/INDENT]
[INDENT]- For each link dest archetype you'll need to see if it has its own Corpse/Flinderize links.[/INDENT]
[INDENT][INDENT]- E.g. a CombatBot had a Corpse link to a CombatBotCorpse, and that has 3 Flinderize links and another Corpse link.
- It might even have its own Emit or Models properties (e.g. a mosslump emits other objects), and has a Coprse link.[/INDENT][/INDENT]
Part 7) Generating the list1) You can close Dromed if you want because it's not needed for these steps.
2) The results from the Queries will include other things besides the model names
3) For the Shape > Model Name query you can use MS Excel or notepad++ to automatically narrow it down to just the model names
4a) Excel:
[INDENT]-Data > From Text File
[INDENT]-(for older versions I think it's Tools > Get external data)[/INDENT]
-Space delimited. You can tell it not to import certain columns, leaving you with just the model names.
[/INDENT]
4b) Notepad++:
[INDENT]-Search > Replace:
-Select 'Regular Expression' at the bottom
-In the 'Find' box, paste this in:
.*:
-(note there is a space at the end)
-'Replace with' should be blank.
-Click on Replace All.
.*: means 'any number of any character followed by a : and a space'[/INDENT]
4c) There may still be duplicates (e.g. if the mission has many WoodCrateSealed objects). There's a plugin called TextFX that can remove them. Instructions for that are (
http://stackoverflow.com/questions/3958350/removing-duplicate-rows-in-notepad) here.
Part 8) What can you do with this list?1) You can go through each bin file in your object folder and delete it if it's not in the list. You can also go through each texture and delete it if its name doesn't occur in any bin file (notepad++ has a find in files feature that can help you with that).
2) You can offer to (
http://www.ttlg.com/forums/showthread.php?t=140627) test this program of mine which will do the previous step automatically.