LDraw.org Discussion Forums

Full Version: LDCad 1.6a Animation crash
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When I use Explode or Magnet Build script on attachment file, then i get a message:
Playback is too slow for 25 fps at an avg frame time of 222.56ms.

The question is how change FPS from LUA script ?!
(2018-03-11, 14:59)Jarema Wrote: [ -> ]When I use Explode or Magnet Build script on attachment file, then i get a message:
Playback is too slow for 25 fps at an avg frame time of 222.56ms.
It's a question of graphics board performance, size of LDCad window, complexity of model, etc.... You can try to reduce required frame rate to a lower value (open animation panel on main view top right, click on '25fps' and reduce that value). Note that for saving an animation this is not a problem since the images are not created in real time.

Or you can use setFPS in the script.

Nice mosaic BTW!
Thanks for help.
Another question is: How move parts from sub-model to main-model when "Ungroup all" is not work at all ? Then delete empty sub-model.
Some scripts do not work properly without this. I need GUI and LUA behavior.
(2018-03-11, 14:59)Jarema Wrote: [ -> ]When I use Explode or Magnet Build script on attachment file, then i get a message:
Playback is too slow for 25 fps at an avg frame time of 222.56ms.

The question is how change FPS from LUA script ?!

Like Philo wrote,

It is not crashing but at some point their are too many bricks for the program to manipulate/reprep/render 25 times a second.

The bottle neck is probably not the graphics card, any semi recent card should be able to handle 8000 bricks.

The script execution is usually also below 1ms even for the biggest scripts.

The problem lies in the render prepping which is needed whenever a bricks position and or visibility changes.
This is CPU based work and uses only a single thread.
It will be even worse if the model contains many transparent parts.

If you want to view the animation regardless, You can do an OpenGL export (alt+e) at any fps and combine the images with ffmpegenc or something.
Currently, the script for LDCad can do such a thing: Click to watch . The chassis and the green brick are from the first step. I gave two wheels for one step.
Main script use static.lua for grounded elements - like baseplate - and horizontal.lua to know what direction obtain when moving part -- like wheel.
(2018-03-11, 21:44)Jarema Wrote: [ -> ]Currently, the script for LDCad can do such a thing: Click to watch . The chassis and the green brick are from the first step. I gave two wheels for one step.
Main script use static.lua for grounded elements - like baseplate - and horizontal.lua to know what direction obtain when moving part -- like wheel.

Looks promising maybe add sorting (in the start event) on y and x distance to zero to force a logical order?
How extract informations about sub-model parts via LUA Script ? Because animate sub-model as one object break animation.
(2018-03-12, 10:55)Jarema Wrote: [ -> ]How extract informations about sub-model parts via LUA Script ? Because animate sub-model as one object break animation.

You can follow the references recursively trough someRef:getSubfile(), someSubfile:getRefCount(), someSubFile:getRef(index).

But the matrices/positions inside that will be relative, so you need to multiply with the higher ref's matrix.

Alternative is to use groups as they automatically manage absolute matrices.

This will only go as expected for single used submodels though.