Hmm... The EXECIDLES thing might not work at all. I don't really know what that does, I just took a wild chance. When I tried it in another script that takes even more time to execute, Windows again thinks that RS is dead until the script completes. And naturally, I don't see any progress bar updates after this since the UI is completely frozen while my script executes.
/ fre_ber On 13 March 2014 16:10, [email protected] <[email protected]> wrote: > Thanks. I did some more digging and noticed that, in the SDK, there is > some multiple inheritance going on for the PROGRESSMODEL class and that > this is not reflected in the js class. > > I made an ugly hack and now I can use the progress indicator of the > geometrics layer. > > The first thing I tried to do was to add "r3Progre();" in the constructor > of R3CLID_PROGRESSMODEL (real/code/r3progm.js). In other words, call the > constructor of R3CLID_PROGRE (oops/r3progre.js) in the subclass. This did > not work for some reason. > > My second attempt was to simply copy the code from that constructor into > the constructor for R3CLID_PROGRESSMODEL (real/code/r3progm.js). > > After adding this ugly hack I was able to use code like this: > > var layer = GetJS ("CurrentProject.Geometrics"); > var progressIndicator = layer.GetProgressIndicator(); > progressIndicator.BEGIN (height); > for (y = 0; y < height; y++) > { > layer.SHOWMSG ("Reading SL height field RAW file. (" + y + "/" + > height + ")"); > progressIndicator.PROGRESSTO (y); > ... > } > progressIndicator.END(); > > And the progress indicator behaves as expected! > > > What would be the best way to correct the js file? Why did my first > attempt fail? It told me that BEGIN was not a function even though the > constructor did set that method up via the function call. > > In my script, I had an additional problem in that my code did not release > the thread at any time before the task was completed, this meant that > Windows soon thought that the RS3D process was "Not resonding" and all UI > updates were frozen. I took a wild guess and called "layer.EXECIDLES();" > inside my loop and it now looks to be ok. > > Now, however, my problem is that my code is too slow. It appears as if > creating faces of an SDS is really slow for some reason. > > Any suggestion of how to quickly set up quad faces in a regular pattern? > > // Create faces: > progressIndicator.BEGIN (height - 1); > var faceIndex = [0, 0, 0, 0]; > for (y = 0; y < height - 1; y++) > { > layer.SHOWMSG ("Creating faces. (" + y + "/" + height + ")"); > progressIndicator.PROGRESSTO (y); > layer.EXECIDLES(); > for (x = 0; x < width - 1; x++) > { > faceIndex[0] = (y + 1) * width + (x + 0); > faceIndex[1] = (y + 1) * width + (x + 1); > faceIndex[2] = (y + 0) * width + (x + 1); > faceIndex[3] = (y + 0) * width + (x + 0); > sds.MAKEFACE (4, faceIndex); > } > } > progressIndicator.END(); > > The code above takes a long time to execute. In my example width and > height are 256. > > Best regards > fre_ber > > > On 13 March 2014 12:53, WindowsLiveMail <[email protected]>wrote: > >> >> Hello fre_ber. >> I asked Realsoft about it before. >> However, they were not able to show a sample cord to me >> because they were busy with development of Ver7. >> So they made following reply to me. >> Best regards, >> K-UDA >> >> >> I am sorry that documents about js programming are so inadequate. The >>> class >>> oops/r3progre.js is a 'base class' from which actual progress indicators >>> are >>> derived. You need to create a progress gadget and a progress model for >>> the >>> gadget, and then update the model. >>> >>> The required classes are: >>> >>> real/gadget/r3progd.js - progress gadget displaying graphical >>> information >>> real/code/r3progm.js - progress model, which you update in your js code >>> >>> Unfortunately we are very busy finishing v7 right now, so I don't have >>> time >>> to write a full js example, but here's some C code showing how things >>> work: >>> >>> proggad = R3ObjectCreate(R3CLID_PROGRESSGADGET, R3WGA_Parent, >>> myWindow, >>> R3PGA_NoCancelButton, TRUE, >>> R3TAG_END); >>> >>> progress = R3ObjectCreate(R3CLID_PROGRESSMODEL, R3TAG_END); >>> R3SetAttrs(proggad, R3WGA_Model, self->progress, R3TAG_END); >>> >>> R3SendMessageA(progress, R3PROGREM_BEGIN, 100); >>> .... >>> >>> I hope the code above helps to understand the principle. >>> >> >> >> _______________________________________________ >> User-list mailing list >> [email protected] >> http://realsoft.com/mailman/listinfo/user-list_realsoft.com >> > >
_______________________________________________ User-list mailing list [email protected] http://realsoft.com/mailman/listinfo/user-list_realsoft.com
