Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Ruby Issue: Draw and Init

For general discussion related FlowStone

Ruby Issue: Draw and Init

Postby tulamide » Wed Oct 22, 2014 11:39 pm

If a view is connected to the Ruby editor, when starting the schematic (and probably any exports also) the 'draw' method is called before the init method. A simple test will convince you, see attachment.

In my spline class example 2, I can resolve the issue by calling init from within the draw method, which should convince everyone who wasn't from the attached test.

This renders 'init' pretty much useless. Luckily, you can also initialize by just placing the initializing code at the very beginning of the Ruby editor, without defining an init method. No need to call init from the draw method then.

Thought you should be aware of it!
Attachments
order_issue.fsm
shows that 'draw' is called first when opening this schematic
(360 Bytes) Downloaded 717 times
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Ruby Issue: Draw and Init

Postby Exo » Thu Oct 23, 2014 5:45 am

Thanks for pointing this out and giving a solution.

I have noticed that too, it is rather odd and doesn't make much sense!
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
Exo
 
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK

Re: Ruby Issue: Draw and Init? not true

Postby Tronic » Thu Oct 23, 2014 6:50 am

Your test is not very correct, look at this:
order_issue_not_true_issue.fsm
(427 Bytes) Downloaded 746 times

The problem that you have with your class Spline is that you must always load the modules that contain the classes, before any other modules, otherwise your class when the module invokes it, does not yet exist in memory.
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: Ruby Issue: Draw and Init? not true

Postby tulamide » Thu Oct 23, 2014 7:36 am

Tronic wrote:Your test is not very correct, look at this:
The attachment order_issue_not_true_issue.fsm is no longer available

The problem that you have with your class Spline is that you must always load the modules that contain the classes, before any other modules, otherwise your class when the module invokes it, does not yet exist in memory.

I'm sorry, but you're not true. See, the watch method only gets triggered when the method it's in is also triggered. That's why you get the impression of a regular order, since after the first draw, the order is correct (draw, init, draw). The spline class is an expansion of the ruby edit class, any access to the class forces ruby to build it if not yet existant. That's why you have no issues at all when initializing at the very beginning of the editor, without creating an 'init' method.

My schematic on the other hand raises an error whenever one of the methods gets called, whatever is the first. No Spline Class involved at all!

See the attached schematic without your 'afterload' prim. (draw gets called 3x, init 1x)
Attachments
order_issue_not_true_issue.fsm
(417 Bytes) Downloaded 731 times
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Ruby Issue: Draw and Init

Postby Tronic » Thu Oct 23, 2014 7:58 am

Unfortunately I can not agree to your idea,
because if the method "Init" was not the first to be triggered,
would not be initialized the variable with which you observe the results,
you're considering the number of trig happened, but the method "draw" shows a longer time,
compared to that reported by the method "init",
so for me the order of execution is correct.
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: Ruby Issue: Draw and Init

Postby tulamide » Thu Oct 23, 2014 8:10 am

Tronic wrote:...so for me the order of execution is correct.

That's exactly what I said in my last post. You get the impression, because after the first 'draw' call, the order indeed is correct. There's just the issue that draw gets called a first time before 'init'

Here's another schematic, and if this one doesn't convince you, I don't know what else. :)

Make sure Flowstone is not running, then open it with the schematic. After load, just click on the trigger button and be surprised ;)
Attachments
order_issue 2.fsm
(436 Bytes) Downloaded 764 times
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Ruby Issue: Draw and Init

Postby Tronic » Thu Oct 23, 2014 8:18 am

Sorry, but not...
trig order still
Method:
1) init
2) event
3) draw

try to switch OFF the module and retrig....
surprise....
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: Ruby Issue: Draw and Init

Postby tulamide » Thu Oct 23, 2014 8:27 am

Tronic wrote:Sorry, but not...
trig order still
Method:
1) init
2) event
3) draw

try to switch OFF the module and retrig....
surprise....

Tronic, I see you misunderstand the whole issue. We talk past each other. Of course, it works after retrig. That's what I am saying the whole time! You don't even need to switch it off, just enter something in the editor, for example a space anywhere and retrigger. But the issue is not that it works afterwards, the issue is that, as you can clearly see in the last schematic I posted, 'init' doesn't get called, while 'draw' is called - at the very first time.

I don't know how I could explain it in another way so that it might get clearer.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Ruby Issue: Draw and Init

Postby Tronic » Thu Oct 23, 2014 8:31 am

your preview test is not correct, it every time reset the variable when you trig the module,
because method init is called only the first time, so the variable @a_init is lost(is reset) in your case.
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: Ruby Issue: Draw and Init

Postby tulamide » Thu Oct 23, 2014 8:35 am

Tronic wrote:your preview test is not correct, it every time reset the variable when you trig the module,
because method init is called only the first time, so the variable @a_init is lost(is reset) in your case.

Wrong again, I don't trig the module, I trig the event method. Also, your thought would also reset @a_draw

But I'll leave it as it is. I've done my best. :)
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Next

Return to General

Who is online

Users browsing this forum: No registered users and 87 guests