Rick Posted December 5, 2009 Share Posted December 5, 2009 So I copied the light entity to make a pivot entity. The name property doesn't seem to stick. I set it, click apply, close the properties window, and when I go back in the name is blank again. What needs to happen for these properties to hold their value? Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 5, 2009 Share Posted December 5, 2009 So I copied the light entity to make a pivot entity. The name property doesn't seem to stick. I set it, click apply, close the properties window, and when I go back in the name is blank again. What needs to happen for these properties to hold their value? when you hit apply you should see the instance of it on the right side of the screen change to that name. It works for me on my custom objects. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Rick Posted December 5, 2009 Author Share Posted December 5, 2009 worked now. not sure what happened. Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 5, 2009 Share Posted December 5, 2009 worked now. not sure what happened. you weren't holding your mouth right... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Rick Posted December 6, 2009 Author Share Posted December 6, 2009 I still have something funky about my custom pivot entity. After the first time I save the scene and close it then reopen no matter where I move it and save the scene again, closing the editor and reopening it the pivot will always go back to where it was originally saved. Quote Link to comment Share on other sites More sharing options...
Josh Posted December 6, 2009 Share Posted December 6, 2009 Post your script. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted December 6, 2009 Author Share Posted December 6, 2009 I just copied the light and commented the light specific stuff out. dofile("Scripts/base.lua") -- We need the base class entity function InitDialog(grid) base_InitDialog(grid) --group=grid:AddGroup("Light") --group:AddProperty("Resolution",PROPERTY_CHOICE,"256,512,1024,2048") --group:AddProperty("linearoffset",PROPERTY_FLOAT,"0,1,2","Linear offset") --group:AddProperty("multoffset",PROPERTY_FLOAT,"0,1,2","Multiplicative offset") --group:AddProperty("Range",PROPERTY_FLOAT,"1,100,0") --group:Expand(1) end function Spawn(model) local entity=base_Spawn(model) entity.model=model --entity.light=CreatePointLight(10,model) entity.pivot = CreatePivot() return entity end function GetKey( model, key, value ) local entity=entitytable[model] if entity==nil then return value end if entity.model==nil then return end return base_GetKey(model,key,value) --if entity.light==nil then --return base_GetKey(model,key,value) --else --if key=="linearoffset" then -- return entity.light:GetShadowOffset(0,0)--..","..entity.light:GetShadowOffset(0,1)..","..entity.light:GetShadowOffset(0,2) --elseif key=="multoffset" then -- return entity.light:GetShadowOffset(1,0)--..","..entity.light:GetShadowOffset(1,1)..","..entity.light:GetShadowOffset(1,2) --elseif key=="range" then -- return entity.light:GetRange() --else -- return base_GetKey(model,key,value) --end --end end function SetKey(model, key,value) local entity=entitytable[model] if entity==nil then return 1 end if entity.model==nil then return 1 end base_SetKey(model,key,value) if entity.light==nil then --base_SetKey(model,key,value) else --if key=="resolution" then -- if value=="0" then -- entity.light:SetShadowmapSize(256) -- elseif value=="1" then -- entity.light:SetShadowmapSize(512) -- elseif value=="2" then -- entity.light:SetShadowmapSize(1024) -- elseif value=="3" then -- entity.light:SetShadowmapSize(2048) -- end --elseif key=="range" then -- entity.light:SetRange(value) --elseif key=="shadowresolution" then -- resolution=entity.light:GetShadowmapSize() -- if resolution==256 then -- return 0 -- elseif resolution==512 then -- return 1 -- elseif resolution==1024 then -- return 2 -- elseif resolution==2048 then -- return 3 -- else -- return -1 -- end --elseif key=="multoffset" then -- entity.light:SetShadowOffset(entity.light:GetShadowOffset(0,0),value,0) --elseif key=="linearoffset" then -- entity.light:SetShadowOffset(value,entity.light:GetShadowOffset(1,0),0) --else -- return base_SetKey(model,key,value) --end end return 1 end Quote Link to comment Share on other sites More sharing options...
Josh Posted December 6, 2009 Share Posted December 6, 2009 You are always returning 1 from SetKey. I experienced this same problem and realized you don't want to actually set the position, rotation, scale keys. If you open base.lua you will see that when those values are set, the functions positions them, then returns 0. Your function should say this: return base_SetKey(model,key,value) Instead of this: return 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.