Scale2 v1.0 - by Bob Le Gob *************************** The plugin is initially based on the Scale v1.0 official plugin. But in fact, 90% of the code was re-written, althrough the basic structure of the client part is similar to the original one. Editor part *********** This part has been highly modified. There isn't much to say as I documented all the functions. I added a few informations on how the C3D3 handles the plugins' editors' callbacks. Beyond this, I added a Framerate field in the plugin editor. Client part *********** What are the main changes ? - The plugin now takes into account the original scaling of objects. - Minimum scaling values above 100 and maximum scaling values below 100 are now accepted. - A rendering framerate has been implemented. Main structure: - in cbNewOb(), we retrieve all the parameters from the editor. We too retrieve the original scales of the instance's objects through Get3dObjectsScales(). We create a tuple which will be used to update the scaling of the objects at each rendering. The tuple looks like: [ScaleMin ScaleMax ScaleIncrement CurrentScale Framerate Tick Accumulator] - CurrentScale is the global scaling for all objects of the instance - Tick and Accumulator are used to handle the framerate. Tick stores clock values, and Accumulator stores intermediate values between frames (something like percents). - cbScale() is the ObCbAnim. It computes the new global scaling through UpdateCurrentScaleFactor() and apply it to each 3D object of the instance through cbScaleSingle3dOb(). You'll see in this last function how the original and global scalings are taken into account. - UpdateCurrentScaleFactor() computes the new global scaling. Two interesting parts: - Computing frames and accumulator: 1) Period = newTick - oldTick During this period, a certain number of frames may be "triggered" and the remaining stored in accumulator (as a % of frame - although we'll use per-thousands instead of percents) 2) Number of triggered frames = period x framerate / 1000 3) Accumulator = period x framerate modulo 1000 4) We then check if the old accumulator added to the new one will trigger another frame or not. - We then "play" the number of "triggered" frames. But as we have some phenomenom, we have to play these step by step. And at the end, we finaly update our tuple.