Re: Movement animation - update problem [SOLVED]
Posted: Thu Nov 29, 2012 5:15 pm
Hi,
I'm testing QCad/ECMAScript in order to do movement 2D animations.
I ran a little test script: apply a little step (1,1) movement on a preselected block, inside a for cycle, with a sleep between every step.
I get no errors, but I can't see intermediate positions: only the last one (when its time comes, at last of the animation); so I see no animation.
Also: at the end of actions I cannot select the moved block unless I do it with a selection window which includes also the original position of the block (so it looks).
If I run QCad with debugger enabled the problem doesn't appear.
There might be some update problems with document or rappresentation data of entities.
I tried all update/repaint/regenerate commands in the document interface with no effect.
I run QCad-trial 3.0 on a Windows 7 SP1 (64bit) machine.
This is the testing code:
Thanks for help
Ciao
Mario
I'm testing QCad/ECMAScript in order to do movement 2D animations.
I ran a little test script: apply a little step (1,1) movement on a preselected block, inside a for cycle, with a sleep between every step.
I get no errors, but I can't see intermediate positions: only the last one (when its time comes, at last of the animation); so I see no animation.
Also: at the end of actions I cannot select the moved block unless I do it with a selection window which includes also the original position of the block (so it looks).
If I run QCad with debugger enabled the problem doesn't appear.
There might be some update problems with document or rappresentation data of entities.
I tried all update/repaint/regenerate commands in the document interface with no effect.
I run QCad-trial 3.0 on a Windows 7 SP1 (64bit) machine.
This is the testing code:
Code: Select all
var document = this.getDocument();
var storage = document.getStorage();
var di = this.getDocumentInterface();
var ids = document.querySelectedEntities();
blockRef = document.queryEntity(ids[0]);
blockRef.setSelected(false);
var newPosition = new RVector(1,1);
for (i=0; i<30; i++) {
var op = new RModifyObjectsOperation();
blockRef.move(newPosition);
op.addObject(blockRef);
di.applyOperation(op);
blockRef.update();
sleep(50);
di.updateAllEntities
document.updateAllEntities();
di.regenerateScenes(ids[0],true);
di.regenerateViews(true);
di.repaintViews();
}
this.terminate
Ciao
Mario