Mac truncates tool names question.
-
http://code.google.com/apis/sketchup/docs/ourdoc/toolsobserver.html
@unknownuser said:
BUG: In SketchUp 6 and SketchUp 7.0, tool names on the Mac have some of their first characters truncated. For instance, on Windows, a tool is "CameraOrbit". On the Mac, is comes across as "raOrbit". Therefore, use the tool_id to keep track of which tool you need to watch for, or use logic that corrects for the error. There is an example method of one way to do this shown below. (This example is not a comprehensive list of the tool names.)
-
As I recall, Scott told me that in v8, this issue was only HALF fixed.
One of the these was fixed, but the other was not. Can't remember which.
ToolsObserver
: thetool_name
argument in the callback methods.Tools.active_tool_name()
return string. -
hi Thomas/Dan,
The bug is appears to be gone in v8, I just noticed that the "r" added odd formating that broke up the strings.
I'm looking for the most efficient way of not using observers to get the information 'per model'
By reading the log, I'm trying to push the info to a 'per model' cache, and gather tool 'use' statistics.
I'm trying to then write this back to either an add_note or a web Dialog on demand, primarily as an exercise.
The cache itself is storing Time.now strings, but I'm struggling lots updating the 'data' files.
If cache files static 'per model_unique_Id' exists, I want to push only updated content, else create a new unique file with the full content.
john
-
@driven said:
I'm looking for the most efficient way of not using observers to get the information 'per model'
Reading and writing to a file, is bound to be much slower than accessing memory (especially if the tool is also doing file access of some kind,) unless you are actually accessing a virtual (memory) disk.
I'd think an observer is easier. (Ruby has an extended Observer class of it's own, that you might be able to use to write your own observer, where the API's C++ observers don't give you what you need.)
BTW, on the PC at least, the
ToolsObserver
only reports correcttool_id
andtool_name
for Sketchup's native C++ tools. For custom Ruby tools,active_tool_name
is always"RubyTool"
, andactive_tool_id
is always the same integer, something around or slightly more than50,000
. (Yesterday it was giving me50006
for any custom tool I activated.)
We have asked many times to have this fixed. It will need to have aUI::Tool
protoclass, so all tools have methods that return their name and id. (Currently the observer does not appear to even attempt to call these methods in a custom tool object.)
I played a bit with a baseUI::Tool
protoclass in the SKX forum, but it is not how it will be.. (I see a few things that I'd need to revise, since currently custom tools don't get an id. I would just have thetool_id()
method returnself.object_id
, which means they will change each time Ruby is loaded. But take a look if your interested, but keep in mind it still needs a lot of work.) -
The problem, I perceive, with the observers is they are 'per model' so will need to always turned on for all models, and you end up with app observers to watching model observers, like in Jim's 'super' observer.
I thought as I'm writing to file anyway, and SU has already collected what I want, why not just use that.
Do you think that's likely to have a greater impact on performance?
-
@driven said:
Do you think that's likely to have a greater impact on performance?
Test it.
I also suspect that Observers will be faster. But to be sure - it must be tested.
-
You can create a cache in memory using an array of hashes, that can have values that are arrays or hashes themselves. That should be much faster. Then write to file only once at the end of the session.
Why will the user want to see tool usage data displayed on the screen ?
-
@dan rathbun said:
Why will the user want to see tool usage data displayed on the screen ?
Rich and TIG recently made a plugin that displayed what tool was activated in order to aid video tutorials. Guessing this would fall into similar use.
-
@dan rathbun said:
Why will the user want to see tool usage data displayed on the screen ?
One idea I'm working is tracking how my 8yr old makes a model, without 'interfering' [which is how she perceives me watching].
If she's following a tutorial and it goes pear shaped, we can look at the tool steps that don't match... only standard tools.
I often read the SU log, but it gets cleared if you change models or restart, so is only good for single model sessions.
john -
@dan rathbun said:
For custom Ruby tools,
active_tool_name
is always"RubyTool"
, andactive_tool_id
is always the same integer, something around or slightly more than50,000
. (Yesterday it was giving me50006
for any custom tool I activated.)Actually just tested this again... (because something seemed weird, as I was sure in the past that I had gotten different tool ids for custom tools.)
And what is happening is that unique tool ids DO get assigned (it seems,) if the tool is associated with a
UI::Command
object. Then in this case the tool_id is actually the command id. How this happens, I have not yet figured out.
Advertisement