Updating a datablock runtime
by lineage · in Torque Game Engine · 07/25/2005 (3:08 pm) · 6 replies
Can i update a datablock runtime? essentially thats what the editor is doing right? do i basically need to call the function that the button Apply calls after making changes? thanks
#2
07/25/2005 (3:53 pm)
The Mission Editor doesn't edit datablocks. It edits the peristent fields of the objects which is handled separately from the datablocks.
#3
my function does change the value of it correctly, but nothing happens. once i go to the editor and hit apply, the sky changes to the appropriate color. i guess my question is, how do i make changes appear, similar to when you hit apply in the editor?
07/25/2005 (4:01 pm)
I see, thanks for the correction. so for instance, the sky color is SkySolidColor in the sky datablock, and hte persistent field is mSolidFillColor right? I created a function accessible in the console to change this. my function does change the value of it correctly, but nothing happens. once i go to the editor and hit apply, the sky changes to the appropriate color. i guess my question is, how do i make changes appear, similar to when you hit apply in the editor?
#4
The key part here is the setting of the NetMask. If you look in packUpdate() you will see that mSolidFillColor gets set across whenever InitMask is set. So, you need to call setMaskBits(InitMask); in your new console function in order to get mSolidFillColor changes sent across the network to the clients (even in a SinglePlayer set up).
Hope that helps!
07/25/2005 (4:54 pm)
When you hit Apply in the Mission Editor it calls inspectPostApply() which usually will set a NetMask that in turn flags packUpdate/unpackUpdate to send the change across the network to the clients.The key part here is the setting of the NetMask. If you look in packUpdate() you will see that mSolidFillColor gets set across whenever InitMask is set. So, you need to call setMaskBits(InitMask); in your new console function in order to get mSolidFillColor changes sent across the network to the clients (even in a SinglePlayer set up).
Hope that helps!
#5
07/25/2005 (5:13 pm)
Thanks! exactly what i was looking for :)
#6
07/25/2005 (5:13 pm)
MSkySolidColor is not part of the sky datablock. Sky is not a GameBase, therefore does not have a datablock. Only GameBase and lower actually have Datablocks.
Torque Owner lineage