Replicating the old SetModelScale function in gmod 13?

I’m trying to find a good way of doing making the new way of doing SetModelScale behave like the old one.

From what I’ve tested and experienced so far:

The problem with the new method and using Entity.EnableMatrix with RenderMultiply is that if I use it on a model that has more than one bone it will either not scale the model at all or scale the 0 bone only with different axes from the old method. Some models did this in gmod12 but mostly just ragdoll models. This scaling behavior only seems to apply on models with IK on, which is fine I think but now it’s as if IK is enabled on all models by default and the Entity.SetIK function does nothing anymore. Entity.SetIK used to work in previous versions of the gmod beta (but only sometimes for some reason). I can disable IK on players at least by doing this hack ply:SetModelScale(1.00001, 0)

I could work around this by overriding BuildBonePositions on the entities I want to scale. This is kind of annoying and seems to be a lot of work just to scale the model. If you’re scaling an entity you don’t own (as an effect) you’d have to/should make hook code in order to keep the old scale. It’s also in my case a potential big slowdown since I have a lot of entities that need this behavior. Apart from just being annoying and potentially slow, you cannot scale these models between drawing them anymore since the scaling has to be done in another function.

If only the old function was kept and the new one was called SetModelSize instead (since scale usually indicates a vector scale)… This is bugging me a lot atm.

old way:

new way: (if you want to make sure it behaves the same as the old way)
if ent:GetBoneCount() > 1 then
local old = ent.BuildBonePositions

ent.BuildBonePositions = function(...)
	for bone = 0, ent:GetBoneCount() do
		local mat = ent:GetBoneMatrix(i)
		if mat then
			-- ...
			-- more code that will scale each bone relative to its parent bone
			ent:SetBoneMatrix(i, mat)
	if old then return old(...) end

local mat = Matrix()
ent:EnableMatrix(“RenderMultiply”, vec)

Which is the only way I can think of atm. I have not successfully made the code that will translate and scale each bone relative to parent bone yet but I think I might need to do a recursive loop instead of a for loop.

Garry should just bring the old function back.

Garry, oh Garry, why you do dis to us.

I’m sure Luajit is great and all and these new functions are fine and dandy but is it really worth breaking roughly 70 - 80% of all the stuff people are trying to make just to speed up the overall game by some probably negligible amount?

** edit

I have no idea exactly what the benefits / speed increases or whatever are of the new lua system thingy-ma-bobber … Thing, that Garry has GM13 running off of, but whatever it is, I hope it truly is worth all this stuff that seems to be breaking left and right.

This is not related to LuaJIT, stop talking about it, garry replaced it because someone came up with the new scaling function introduced with TF2 which obviously has it’s benefits, but does not allow per axis scaling and breaks with bones, so instead of replacing it, he should add it as an addition.

I am having problems to actualy ‘set’ the scale of one model, too.

It was way easier to code with the old function.

I don’t understand the change anyway.

If anybody need this today, here’s a replacement script which do the same thing by the same function (client side) :

	local ENTITY = FindMetaTable("Entity")
	function ENTITY:DoModelScale( Vecteur )   
	local mat = Matrix()
		self:EnableMatrix("RenderMultiply", mat)


this doesn’t work for players. How would you resize a player model?