Hello I have been playing with modifying some of my tools and wanted to know how if at all do you highlight the points and lines as the mouse ids over them. To see what I am asking just look at the add points tool. It creates a yellow circle when mouse is over a point and red circle when over a line. I like this highlighting it helps to be more precise in selctions.
Thanks in Advance
John P
Point highlighting script
Moderators: Víctor Paredes, Belgarath, slowtiger
-
- Posts: 12
- Joined: Sun Sep 04, 2011 8:28 pm
Re: Point highlighting script
Just to make sure I understand you want to modify the point selection tool so it highlights points and lines as you hover over them before selecting?
This should be possible. If the add point tool does this, the code is in that tool and could be copied to use in other tools. You would need to find the code in the add point tool and add this code to the point translate tool. This may require modifying the code as required.
In some cases it is also possible to simply "call" the function of another tool to access functionality. This depends on how the highlighting function in the add point tool is written. For example many of the bone tools use functions in the bone selection tool because they have the same purpose. Instead of duplicating that code for every bone tool, the functionality of one tool can be "reused". It is possible the same thing could be done with the point translate tool by referencing the function in the add point tool on the "mouseover" or "mousemove".
Just to be clear, this might be considered "advanced" scripting.
Additional Information:
The highlighting behavior uses a drawing method in the AS scripting reference that is very different from drawing on a vector layer but it has some similarities. Basically there is a built in drawing method that displays in the interface for drawing things like bounding boxes around points, highlighting points etc. So the add point tool script uses the mouse location as a point of reference and then uses this drawing method to create shapes over the document view. This drawing method allows for drawing boxes and ellipses in "one step" or you can also draw shapes one line at a time and connecting them. You can fill and stroke these GUI shapes. They only display in the preview when using the tool that contains these draw methods.
This should be possible. If the add point tool does this, the code is in that tool and could be copied to use in other tools. You would need to find the code in the add point tool and add this code to the point translate tool. This may require modifying the code as required.
In some cases it is also possible to simply "call" the function of another tool to access functionality. This depends on how the highlighting function in the add point tool is written. For example many of the bone tools use functions in the bone selection tool because they have the same purpose. Instead of duplicating that code for every bone tool, the functionality of one tool can be "reused". It is possible the same thing could be done with the point translate tool by referencing the function in the add point tool on the "mouseover" or "mousemove".
Just to be clear, this might be considered "advanced" scripting.
Additional Information:
The highlighting behavior uses a drawing method in the AS scripting reference that is very different from drawing on a vector layer but it has some similarities. Basically there is a built in drawing method that displays in the interface for drawing things like bounding boxes around points, highlighting points etc. So the add point tool script uses the mouse location as a point of reference and then uses this drawing method to create shapes over the document view. This drawing method allows for drawing boxes and ellipses in "one step" or you can also draw shapes one line at a time and connecting them. You can fill and stroke these GUI shapes. They only display in the preview when using the tool that contains these draw methods.
-
- Posts: 12
- Joined: Sun Sep 04, 2011 8:28 pm
Re: Point highlighting script
I think you understood my question and thanks for the reply. I assumed that is was in the script portion of the add point tool that this highlighting is made available.
My purpose for wanting this is for example in the tools that grab points to move them. it sometimes seems when points are close the cursor may choose the wrong point. this lead me to undo and retry and it happens often enough to be frustrating. So for me I would like the points highlighted before I take action on them.
I have looked but to no avail into that script and see the portions referring to the highlighting but have not been able to duplicate it yet.
I will continue to try.
My purpose for wanting this is for example in the tools that grab points to move them. it sometimes seems when points are close the cursor may choose the wrong point. this lead me to undo and retry and it happens often enough to be frustrating. So for me I would like the points highlighted before I take action on them.
I have looked but to no avail into that script and see the portions referring to the highlighting but have not been able to duplicate it yet.
I will continue to try.
Re: Point highlighting script
It's been a while since I looked at these tools, you may want to also check the lm_utilities.lua script in the scripts/utility folder. Sometimes there are common functions there used by multiple scripts.
-
- Posts: 12
- Joined: Sun Sep 04, 2011 8:28 pm
Re: Point highlighting script
Thanks I will check into that