Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 3:06 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 61 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: Drawing Lines-v6 drawing feature
PostPosted: April 26th, 2008, 2:34 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi

I've been experimenting with line drawing, using the v6 drawing script features and am trying to figure out a way to erase lines.

The draw feature has a ClearDraw script, but this would clear all lines drawn in the frame, leaving the user to "start over" any time they made a mistake and need to correct it.

Using an "eraser" created by scripting a DrawLine using a wider line with the same color as the background white canvas (line color= 255,255,255) can selectively erase lines, if the "erase" frame is stacked atop the other frame (need 2 frames, since changing line color changes the color of all lines in a single frame). However, this then leaves a white line(s) on the canvas that interferes with (leave gaps in) the next black lines drawn.

I've tried to come up with ways to change layers of multiple canvases, use alternating enable/disable, but with no success. I've though about using a new frame for every new line and an advancing multi-frame (but haven't done this since as many as 100-150 lines and therefore frames would be needed).

Is there a way to create a log or other means (for example, select individual lines) to selectively erase or undo a single incorrect line and retain the remaining correctly drawn ones?

I've attached a sample .imp, which has 2 canvas frames one atop the other that draws with right mouse down trigger.

Any ideas would be appreciated.

Kind Regards,


You do not have the required permissions to view the files attached to this post.

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 27th, 2008, 5:03 am 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Stephen,

some 'thinking out loud'.
I think there was a RemoveLine command. Or, RemovePoint maybe I'm thinking. The latter... works off of an index Opus keeps automatically. So conceivably you could keep a 'log' during draw/creation. Maybe in an array using the same index, and storing the line segment's endpoints. (or, just the one endpoint's x,y values).

I'm sure there are more ways... but the shortest code between two points may not be a straight line.

Trick/challenge would be how do you let the user 'select'?. I suppose some button to toggle through the array... and at the same time applying a "Flare" attribute to the line segment (or create a temporary clone over it).

[Edit] I was thinking about line drawing driven from scripts. I realize your need is for what the User draws at runtime. I haven't looked at the DW samples in a while (and my Opus is 'down' right now). I'd guess some code inserted could 'capture' coordinates.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 27th, 2008, 12:52 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Lar_123

Thanks for your suggestions. I had overlooked the RemovePoint script.

I've attached a new .imp file with an "erase" button that uses the RemovePoint script. As can be seen, it is able to remove the last line drawn, essentially serving as an "undo" last item only.

Having read the help guide and experimented with the drawing features, it appears that the term "points" refers to the separate lines that make up shapes like polygons: a 5 sided start has 5 points. So, a line has 1 point.

I've tried a variety of scripts but am unable to find a means to undo, erase or remove more than the last point/line.

Is there any way to undo/erase more than the last line drawn?

It would be very useful for the user to be able to continue to erase/undo the last, then (if the button is clicked again and again) the next to last and so forth. Even better would be the ability to somehow select a line among many drawn and only undo/erase that one line.

Perhaps, there is a creative scripting way to do this, or this may be beyond the capacity of the current drawing features and need to be added to the Wish List for a future version.

Any help would be appreciated.

Kind Regards,


You do not have the required permissions to view the files attached to this post.

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 28th, 2008, 10:31 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Hi Stephen,

I think you're onto something with the idea "a line has 1 point". You need to figure out which line/point has 'index' value of 1, 2 etc. (index itself is zero-based).

Try this. Create a Button with an action/script to myDrawFrameXX.RemovePoint( varmyindex ). Check for syntax needed. Then duplicate that button and edit/assign different arbitrary values to 'varmyindex' (eg, 3, 8, ...). When you preview the page and DRAW lines, you should be able to see what different segments get deleted.

From there you can work on how a User can point to an area, and how to proceed with a delete.

I'll have my system back 'up' today, but will be in a catch-up mode for next few days. Good luck.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 28th, 2008, 11:19 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Lar_123

Thanks for your reply and suggestions. Happy to hear that your system is back up. Been there myself.

I had tried this, assigning a variety of different + and - numbers plus 0, but nothing works with a one point line other than 1, -1 and none which defaults to -1. I tried adding wait(1) then duplicating the -1 script, but no joy. I looked up other shapes that allow specifying "sides" thinking that maybe I could try a "one-sided" polygon that could remove other lines as points. Again, no joy.

I think what is critical is stated in the help guide
Quote:
All lines and shapes added to any individual frame are created as part of a single contour (this is a single continuous line).


I think this is a factor no matter how many lines you draw in the frame.

So, I'm stuck. I can't figure out a way to give the end-user a means to selectively delete a line or multiple lines perhaps added in error among a large number of correctly drawn lines. The tools available will only delete the very last line drawn and no previous ones or clear the frame of all lines draw, correct along with incorrect ones. I had also looked without success for any other way to set up an "undo/redo" or means to individually select a line for deletion.

These, plus "save"and "open,"if available, would add valuable features to the runtime drawing tools. (Thanks to a recent posting you had made which spurred a forum colleague's nice solution about nesting a frame in another frame, I figured out how to copy drawings: viewtopic.php?t=3215&highlight=). :)

Here's hoping that some solution can be found or DW can add these valuable features.

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 29th, 2008, 4:45 am 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
S,

Quote:
I think what is critical is stated in the help guide
Quote:
All lines and shapes added to any individual frame are created as part of a single contour (this is a single continuous line).

I interpret 'contour' to mean something akin to a presentation layer... or the 'single continuous line' to mean a single shape that can have one line-colour. So the question is... if I delete a node of that shape, does it break 'open' or just collapse that down and bridge the two adjacent nodes. I think it does the 'bridging'.

If so, that might limit what effects User editing/erasing can achieve.

To the main issue of deleting points... you may have to run the FrameObject through a loop, delete a point/index while in the loop. However, I seem to recall the command was more direct and simple.

Not something I've tried lately.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 29th, 2008, 8:59 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
I think you've missed the point - no pun intended :-)

Placing each shape inside it's own frame is only way to distinguish between different objects (shapes) but...

To draw a continuous contour, be it a straight, wavy line, star shaped, square, etc, etc - made up of different points you need to add the points first before attempting to remove them.

The example attached is quite simple and allows for a continuous contour - click anywhere to set first point and then click in different places to connect the points. Watch the index value on the button - the first point is from 0 - 1 but as it exists in the same space (IE X/Y start X/Y end are the same) nothing appears on screen BUT the index is now one. The next click uses the -1 notion to place the next point after the last in the index and the myIndex variable incremented.

Use the button to delete a point removes the previous myIndex value thus removing that section of the contour.

The additional point in this example always appends to the end (-1) but you could create add a point anywhere within the index to 'distort' an existing contour.

Hope this helps,

Mack


You do not have the required permissions to view the files attached to this post.

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 29th, 2008, 1:01 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Mack

Thanks for "pointing" that out (pun intended). I'm afraid it confirms what I suspected: the only way to draw multiple discontinuous lines and then selectively erase them (via RemovePoint) is to have every line in its own separate frame.

I've thought about the logistics of doing this and can not figure a way, since the many, many frames would need to be stacked, on how a user could get to, for example, the 18th one down, to erase its incorrect line.

Perhaps, there is another way to achieve this result that I'm missing.

Absent that, I wish DW would add an undo/redo (as well as a save and open) to the drawing features or another way to draw and selectively delete multiple lines. :)

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 29th, 2008, 1:33 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Stephen wrote:
I'm afraid it confirms what I suspected: the only way to draw multiple discontinuous lines and then selectively erase them (via RemovePoint) is to have every line in its own separate frame.


Sort of: for example if you needed to draw an irregular dodecagon but where like to make mistakes - then I'd draw this into one frame using add point / remove point for the undo.

However, if I was designed a project where I need to draw lots of shapes - I would add each new shape to a new frame (in fact I don't believe there is any other way of doing this).

If, and this is where the coding gets interesting, I needed to be able to undo both elements (points) of individual shapes as well as whole shapes - I think you'd need to combine both by tracking the frame used for each shape and storing the draw data used for the shape with the individual frame - that would be fun :-)

The match sticks game, I posted earlier uses the middle method with each line having it's own frame BUT because the line data is stored using OOP techniques - it's more like having a line object that you can get and set data like other Opus objects rather than a frame. The number of frames shouldn't be a problem - the game has 100 cloned frames without blinking it's getting control of the right frame to make changes / move / delete / etc.

I wonder whether you would be better of with some form of visible history array - like Photoshop which would allow the user to scroll through all created frames and click on a list item to activate the required frame?

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 29th, 2008, 2:18 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Mack

Since only line drawing is involved in the project, it would need to be a large number of frames atop each other. I'm afraid this may not be practical, but, in any event, would fail to successfully compete with other drawing tools on the market that draw all shapes/lines in a single canvas/frame and include simple undo/redo plus features like select, save, open, etc. (written in C++, Java, Basic).

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 29th, 2008, 4:25 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
I suppose it's a matter of taste. I really like the way the drawing functions work and can see how they could be used in any number of our projects.

The multiple frame issue isn't an issue as the frames are created at runtime - clones from a singular original and I tested the match stick game with 500 frames, which is a lot of lines, and Opus performed fine.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 29th, 2008, 5:10 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Mack

OK. I appreciate that it would work excellently for some tasks, though I suspect, for my projects, it would be awkward and hugely complicated.

A couple of challenges I've so far unsuccessfully tried to come up with solutions for:

On a 1024X768 drawing canvas, where shapes to be connected by straight lines could be several hundred pixels apart and angled relative to each other, the frames would probably all need to be the largest size that could be needed to draw the lines within.

Since the frames would all be atop each other, perhaps 100 or more, I'm still not sure how the user can select one in the middle containing an incorrect line needing deletion (and others further up or down).

I've given a lot of thought to these challenges, but, to date, have not been able to come up with viable and smooth-working (rather than awkward)solutions.

Any suggestions would be appreciated.

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 29th, 2008, 6:56 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
:-) Oddly, this is how the match stick game works - one hundred full screen cloned frames.

A few basics:


1. Use the ignore transparent area to access just the line.

2. Use the GetName() command to return the name of the frame the mouse is currently over.

3. With number 1 set, number 2 will only occur when the mouse is physically over the line - thus ignoring all other frames.

4. Nothing good is simple :-)

This give a basic working of frame management.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 29th, 2008, 7:19 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Thanks, Mack. :)

I've just sent you an email.

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 30th, 2008, 9:00 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Stephen,

Cheers for the email. I'm assuming that when you say GetChild() - you are attempting to get the 'drawing' as an object. Unless I'm much mistake, the there is no object - the 'drawing' exists as part of the frame object.

I perceive this is the same way as a traditional piece of paper. Most Opus objects are place onto the paper - such as a vector and can be moved around - like a collage. BUT the drawing functions are like using a pen to 'draw' onto the paper - once marked they become one with the paper (sounds like something out of eastern religion :-)).

By using OOP (as exampled in the showcase post) , I don't think of the frame as a group of objects when dealing with a drawing - I think of the drawing as the object - EVEN if it's called FRAME1. Because the properties of the frame ARE NOT those of the drawing - you need to record these as you create them. Thus if you draw a line, you need to record the x,y, colour, width, etc and link this to the name of frame so that when you move the mouse over drawing in that frame you can recall the information - BECAUSE Opus doesn't allow you to get it unless you tell it what it is in the first place.

Hope this helps,

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 61 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 53 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group