Member Controls

Goto page 1 2      Next
Developers > Plugin to "link" cloned objects to original
NumenorLink to postposted: Tue Jul 12, 2005 4:29 pm

Member since:
 2005-03-07
Posts:
 380
As per Inge Jones request, I'll try to summarize which steps should perform a plugin in order to make the cloned object "linked" to the original (in order to borrow the original textures and recolours).

Let's start analyzing the structure of a linked object.

First off, note that a custom object can be fully "linked" to the original only if it has the same number and names of subsets (= "models" in the GMDC).
An object can be partially linked to the original: in this case only the linked subsets must have the same names of the original.
Last case: an object can have different subsets linked to different objects.

I think that this discussion should be limited to the first case: a perfect clone that has the exact subsets (number and names) as the original, fully linked to the original.


The "links" are contained in the GMND (only for the recolourable subsets), and in the SHPE (for all the subsets, both recolourable and not recolourable).

In the SHPE, for each subset there is an external MATD reference: it's the very same MATD reference that can be found in the original SHPE (it can be copied from the original).

In the GMND there is a tsMaterialsMeshName blocks that contains (max 2) "string" entries; each entry contains the subset name and the CRES name of the original object (it can be copied from the original CRES or from the original Text List 0x85).

NOTE (mainly for Inge): in a clone created with OW, the custom GMND points to a custom GMDC, also contained in the clone; probably you are interested in keeping the original GMDC, right? This can be done replacing the reference into the custom GMND with the reference taken from the original GMND.


Look at the following scheme:
Image


The plugin should copy and store the green numbered references:
[1] CRES name, contained in the original Text List 0x85
[2] MATD references, contained in the original SHPE
[3] (Optional) GMDC reference, contained int the original GMND.

The reference [1] is to be pasted into the tsMaterialsMeshName block of the new GMND; in order to do so, a tsMaterialsMeshName block should be added to the new GMND, but only if the cloned GMND hasn't already one; if such a block already exist, we must either reuse it or delete it and re-create a new one. No more than 1 tsMaterials block is allowed!
Another important point is that every time a cDataListExtension block is added or removed, the "Datalist Extension Reference" must be updated accordingly (this list is located, in SimPE plugin, in the cObjectGraphNode tab).
A last thing to be aware of, is that often in the GMND do exist a "Copyright" block (all the CEP GMNDs have one): it's an unreferenced block, i.e. in the Datalist Extension Reference the last entry is missing; this way the game doesn't read it at all. This Copyright block should be deleted without updating the Datalist Extension Reference.


The (multiple) references [2] should be pasted in the new SHPE, in the same location as the originals; there's nothing to explaiin about this, I think.


The reference [3] should be pasted into the new GMND (this last step, only if you want to use the original mesh in the new object); the exact location where it should be pasted is visible in SimPE plugin view, under the "Reference" tab.


So, let's sum up the work-flow of the plugin (the hypothesis is that we are working on a freshly made clone of a Maxis object, created with the "Stand-Alone" option checked):

1) Copy the 3 types of references seen above from the original object (I don't know how it can be done: maybe the best thing is to ask Quaxi to modify the OW, to let it store these information somewhere, for further use by the "link" plugin; the last place where these original references can be seen is the Scenegraph rename wizard; after renaming, these references are lost).

2) Paste the original references [2] in the new SHPE and optionally the [3] in the new GMND, as explained above (it should be quite simple).

3) IF exists a tsDesignModeEnabled block THEN read from the block the 1 or 2 "Array" values, indicating the names of the recolourable subsets; ELSE, quit: the object isn't recolourable and can't be linked.

4) Check if there is a Copyright block; if so, delete it without editing the DL Extension Reference.

5) Check if there is a tsMaterialsMeshName; if so, delete it and delete the last entry in the DL Ext Ref.

6) Add a tsMaterialsMeshName block and add an entry in the DL Ext Ref.

7) Add to the newly create block 1 or 2 "String" entries (one for each recolourable subsets); for each entry, the "Name" is the same as read in step 3; the "String" is the reference [1] (the same for all the entries).

8 ) Delete all the Material Overrides, all the Material Definitions and all the Textures. Optionally, delete the cloned GMDC, if the reference [3] has been pasted into the new GMND.


I don't think to have forgotten anything... At least, I hope so :)
Feel free to ask me further explanations.
Inge JonesLink to postposted: Tue Jul 12, 2005 4:53 pm

Member since:
 2005-03-06
Posts:
 1900
maybe the best thing is to ask Quaxi to modify the OW, to let it store these information somewhere, for further use by the "link" plugin; the last place where these original references can be seen is the Scenegraph rename wizard; after renaming, these references are lost).



The trouble with this is that the user may not be in the same session where he cloned the object - for example I have loads of already made objects I need to update like this. That's why in our preliminary discussions I mentioned the idea of making a complete clone of the original object first and getting all the files and references out of that - though that would be super-tedious for the user who is doing it at the time of cloning!

Do you know if I was designing this game, I would make it that the recolours are linked with the model, so if you use that modelname in your STR# 0x85 you get all the colours made for it. If you want to use the same shape but with different colour range, only then you'd have to start renaming scenegraph elements.
NumenorLink to postposted: Thu Jul 14, 2005 8:24 pm

Member since:
 2005-03-07
Posts:
 380
If you can't perform the "linkage" in the same session as the clone, then there's no other solution than to re-run the OW routines; either the new plugin should be able to invoke the OW autonomously, or the standard OW should have added a third option (beside "Create colour package" and "Clone"): something like "Store link data", that would create a temporary clone (with all the cloning options set to off: no renaming, no GroupID changes...) and store into a file the needed link data. This file can then be used by the new plugin to actually create the links.
Inge JonesLink to postposted: Thu Jul 14, 2005 8:38 pm

Member since:
 2005-03-06
Posts:
 1900
It could be made an alternative OW cloning option. I could actually fairly easily "lift" the nuts and bolts of my hacks and dump them into the new linked clones.

What would be very handy was if SimPe had an option to replace file instances when adding extracted resources. Then I could just plop my hacked BHAVs etc right over the top of the other stuff in the clone.
Inge JonesLink to postposted: Sat Jul 16, 2005 11:00 am

Member since:
 2005-03-06
Posts:
 1900
This is just on "simmer" (pardon the pun) setting while Peter fixes some stuff in the BHAV plugin...
quaxiLink to postposted: Sat Jul 16, 2005 4:56 pm
Avator for quaxi

Member since:
 2006-04-28
Posts:
 3154
Uhm, exuse my ignorance, but isn't cloning with OW and none of the Checkboxes checked exactly what you want (a clone of the original Object, with all names/groups as in th original)?
Inge JonesLink to postposted: Sat Jul 16, 2005 5:13 pm

Member since:
 2005-03-06
Posts:
 1900
This is an extra feature which has the following purpose: to mean that after you clone an object, if someone makes a recolour for the original, that recolour will also show up in design mode for the clone.

I think it will be very popular with players if it can be acheived. Well it will be popular with players who use my objects, because I am too thick or attention defective to actually do these steps manually, especially on objects with 6 parts! :D
quaxiLink to postposted: Sat Jul 16, 2005 5:25 pm
Avator for quaxi

Member since:
 2006-04-28
Posts:
 3154
Ah, so this is a Recolor Feature only?

Isn't that as easy (for the Plugin) as cloning the MMAT and adjusting the name/model/GUID Fields?

The Only Problem would be, if the Object you try to "link" to, isn't color Enabled. Maybe we shoudl finaly build the Plaugin to Color Enable a package? What dou you think ybout that Numenor? I know we didnÄr releas one on Purpose when we first created the CEP, but maybe the time has come now?
Inge JonesLink to postposted: Sun Jul 17, 2005 4:51 pm

Member since:
 2005-03-06
Posts:
 1900
Well that's only going to get the MMATs that have already been done. Not the ones that any person might make in the future, which is what we'd like to acheive. In the meantime I do have a tutorial on my site telling people how to add the MMATs of their favourite recolours to any of my objects.
quaxiLink to postposted: Sun Jul 17, 2005 7:03 pm
Avator for quaxi

Member since:
 2006-04-28
Posts:
 3154
What? Like whenever someone is creating a Recolor for the Flamingo, SimPe should be able to create all the needed MMAT Files for all available Flamingo-based Objects?
Goto page 1 2      Next


viewthread, 0, 0, Plugin-to-link-cloned-objects-to-original