Reset Drawing Mesh?

mmyy23alxo's picture

I'm trying to clear the drawing and have it restart again to draw fresh when you click clear. Is it in the javascript queue that I do this?

I have an image with string of the words 'CLEAR' attached to a toggle button that does make the drawing disappear using alpha but the toggle makes it turn on and off. I just want it to turn off AND restart new when it clears.

Not sure if I'm on the right track but right now it's not doing what I want it to. Any help is appreciated.

Thanks!

PreviewAttachmentSize
javascriptqueue.txt341 bytes
MeshClear.qtz57.33 KB

Achim Breidenbach's picture
Re: Reset Drawing Mesh?

I saw some mistakes but wasn't able to make it run completely

1) In Your JavaScript you need to reset the _Queue, but not the "output" result.queue because you overwrite it anyways with "result.Queue = _Queue;" some lines below

if (reset) _Queue = new Object();

2) I added a "__numer time" parameter to your JavaScript and hooked up a "Patch Time" patch so that the JavaScript gets evaluated in each render cycle. This also involved another statement in the if, because otherwise its was generating a new point every render cycle.

3) It looks like you nee to have the "Clear-Patch" in your Render in Image patch enabled. Otherwise the canvas of the "Render in Image" patch never gets cleared and the "old" drawing is still there.

4) You need to remove the "toggle" color from the Billboard in the root level. This causes the drawing to toggle on and off, not representing the real content of the "Render in Image Patch"

Find attached the modified composition. Currently you need to click twice on the "Clear" button, sorry I have no more time to investigate further.

PreviewAttachmentSize
MeshClear (Achim).qtz.zip18.5 KB

mmyy23alxo's picture
Re: Reset Drawing Mesh?

Thank you so much Achim! I figured it out :) That was a lot easier than I thought. I wonder if you could help me with one more thing? I would like to have a main menu to switch what users can do like 'Draw' or 'Animate' and then the scenes would change to the different patches. Is that possible? Would I use toggle and clear patches? Having some trouble...

I wouldn't have the clear button available at the start but once the Draw button is clicked on, the screen will change to be able to draw.

PreviewAttachmentSize
MeshMenu.qtz59.01 KB

Achim Breidenbach's picture
Re: Reset Drawing Mesh?

I am sorry, but I didn't get the complete picture. However I think you should have the "Secondary_Value" of your "Toggle"-patch for the "Draw" set to "0" so that the toggle output actually has something to toggle to.

mmyy23alxo's picture
Re: Reset Drawing Mesh?

Hi Achim, I updated it so hopefully you can better understand what I mean. My composition starts as a main menu with different modes/options to click on and when you click on one, it clears the screen to a new one where you can draw, etc. This is all used with a graphics tablet to use the pen to click so I changed to 'click count' because mousedown did not work.

I would like to know how to click 'Main Menu' and have it go back to the main screen with the different options. Right now, when you can click on 'Draw' you can still toggle it on and off which messes with everything. I want it to just turn on and change the screen and then in the upper hand corner, be able to go back to the main menu.

I hope this makes sense.

PreviewAttachmentSize
MeshMenu2.qtz62.81 KB

Achim Breidenbach's picture
Re: Reset Drawing Mesh?

My suggestion is to use a Java-Script patch to implement this kind of program logic. You will need some states to hold and work with: Which "screen" is active, what buttons are visible, is a button enabled, etc. I am sure this can be done in vanilla QuartzComposer too, but its much more convenient to use a high level programming language for this.

mmyy23alxo's picture
Re: Reset Drawing Mesh?

Yeah I'm trying to get it to work in quartz composer, I'm not much of a programmer. The thing is the composition I sent is only a tidbit of the whole complex project. I'm not sure where I would connect the javascript patch to when there are various patches. It's hard because you can only connect one patch to an enable input.

Do you have any examples to start off?