Changing materials resets model scale
Moderators: winston, another_commander, Getafix
Changing materials resets model scale
I have scaled a subent down with model_scale_factor. Changing diffuse_map using setMaterials in a script resets the subent to the unscaled size. I probably should not do that.
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Re: Changing materials resets model scale
Did you mean 'it probably should not do that?' If so I agree.
Out of interest did you apply model_scale_factor to the sub-ent itself, or was it scaled down as a function of scaling down the model to which it is attached?
Out of interest did you apply model_scale_factor to the sub-ent itself, or was it scaled down as a function of scaling down the model to which it is attached?
Commander Smivs, the friendliest Gourd this side of Riedquat.
Re: Changing materials resets model scale
Yes, it should have been itSmivs wrote:Did you mean 'it probably should not do that?' If so I agree.
Out of interest did you apply model_scale_factor to the sub-ent itself, or was it scaled down as a function of scaling down the model to which it is attached?

- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Re: Changing materials resets model scale
Did you sort this out?
Commander Smivs, the friendliest Gourd this side of Riedquat.
Re: Changing materials resets model scale
Sort of. It's for the Station Ads OXP. I use frame and screen subents that are attached to the dock entitity. And since my modeling skillz are quite non-existent on top of the fact Wings3D refuses to work correctly on my machine, I took some models from YAH and scaled them down in shipdata. All was fine until I changed the material on the screen subent and it switched to it's original size. Luckily the screen model is so simple, just a rectangle, that I could scale it down by hand by altering the vertex numbers in the dat file. So yes, I'm good for now, but this probably needs fixing anyway.Smivs wrote:Did you sort this out?
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Re: Changing materials resets model scale
Ah, OK, thanks. I'd guessed what you were doing
The reason I asked was because I was possibly considering a similar application in the future. I already have a scaled (in shipdata) model with sub-ents (the Cobra2 in X-ships) which has a scripted materials change but as far as I can see that is OK - I probably should go and check though.
Either way you are right that this should be fixed, as It clearly isn't right. Mind you it does open up some intriguing possibilities....

The reason I asked was because I was possibly considering a similar application in the future. I already have a scaled (in shipdata) model with sub-ents (the Cobra2 in X-ships) which has a scripted materials change but as far as I can see that is OK - I probably should go and check though.
Either way you are right that this should be fixed, as It clearly isn't right. Mind you it does open up some intriguing possibilities....

Commander Smivs, the friendliest Gourd this side of Riedquat.
Re: Changing materials resets model scale
I think it works if the whole model is scaled down, but if it's just a subent that has been scaled down then it seems to go wrong when materials change. And yes indeed, this scale factor is very nice propertySmivs wrote:Ah, OK, thanks. I'd guessed what you were doing![]()
The reason I asked was because I was possibly considering a similar application in the future. I already have a scaled (in shipdata) model with sub-ents (the Cobra2 in X-ships) which has a scripted materials change but as far as I can see that is OK - I probably should go and check though.
Either way you are right that this should be fixed, as It clearly isn't right. Mind you it does open up some intriguing possibilities....

- Rorschachhamster
- ---- E L I T E ----
- Posts: 274
- Joined: Sun Aug 05, 2012 11:46 pm
- Contact:
Re: Changing materials resets model scale
This looks really nice.
And I'll just ask in this thread, because it is probably somehow related:
Any problems changing the diffuse_map on subentities via script?

And I'll just ask in this thread, because it is probably somehow related:
Any problems changing the diffuse_map on subentities via script?

Re: Changing materials resets model scale
No problem at all. Here's a snippet from Station Ads:Rorschachhamster wrote:This looks really nice.![]()
And I'll just ask in this thread, because it is probably somehow related:
Any problems changing the diffuse_map on subentities via script?
Code: Select all
...
var newAd = worldScripts["ad_resource"]._getHorizontalAd();
ship.subEntities[2].subEntities[3].setMaterials({"yah_griff_no_shader_screen.png": {diffuse_map: newAd, illumination_map: newAd, illumination_modulate_color: (127, 127, 127)}});
...
- Rorschachhamster
- ---- E L I T E ----
- Posts: 274
- Joined: Sun Aug 05, 2012 11:46 pm
- Contact:
Re: Changing materials resets model scale
Ah! I tried to call a script directly from the subentity...spara wrote:No problem at all. Here's a snippet from Station Ads:Rorschachhamster wrote:This looks really nice.![]()
And I'll just ask in this thread, because it is probably somehow related:
Any problems changing the diffuse_map on subentities via script?The script is attached to the station and the ad screen is a subent of the dock. So ship refers to the station, subEntities[2] refers to the third subent (dock in this case) of the station and subEntities[3] refers to the fourth subent of the dock.Code: Select all
... var newAd = worldScripts["ad_resource"]._getHorizontalAd(); ship.subEntities[2].subEntities[3].setMaterials({"yah_griff_no_shader_screen.png": {diffuse_map: newAd, illumination_map: newAd, illumination_modulate_color: (127, 127, 127)}}); ...

This will make it a lot easier, anyway.

Re: Changing materials resets model scale
Does the scale_model work on subentities?
Re: Changing materials resets model scale
Yes it does. That's the way things work in Station Ads.cbr wrote:Does the scale_model work on subentities?
- Amah
- ---- E L I T E ----
- Posts: 486
- Joined: Tue Aug 28, 2012 8:05 pm
- Location: aboard the Laenina Crowne - Yasen-N class space freighter
- Contact:
Re: Changing materials resets model scale
hmmh, it say in the wiki, iirc. Good to know.
Amah
- about Amah: wiki
- noshaders versions of Griff's extra, alternate ships and accessories: discussion,
wiki
- ocpc - customize the player ship: discussion, oxp repository