Enumerate object names
All  1-2  3-6

Previous
Next
 From:  andrewsimper
6648.3 In reply to 6648.2 
You're welcome! Thanks for writing such a great product :) I've got a bunch more little things I would like to add to make my life easier so I'll share them all.

Ok great, that's good to know that commands automatically get undo support :) This one definitely needs it since it is quite an intrusive operation, so I'll switch it to being a command instead. I also want to make a De-enumerator operation where you can specify a trailing string to remove, so this will need user input as well so will need to be a command.

Do commands have access to any extra java script libs? Something like string.js http://stringjs.com/ would be really useful!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
6648.4 In reply to 6648.3 
Hi andrew,

> Ok great, that's good to know that commands automatically get undo support :) This one definitely
> needs it since it is quite an intrusive operation, so I'll switch it to being a command instead.

Actually I should clarify that a bit - commands automatically get undo support for all added and removed geometry. Changing just an attribute like the object name will not be covered by that current system. You could do something like clone the object, change the name on the cloned object, remove the old object from the geometry database and add in the renamed object into the geometry database in a command and then that would be undoable. The undo record will consist of the entire old object though.


> Do commands have access to any extra java script libs?

No, they have the same stuff available as inline script, but the command launcher does some various set up and tear down tasks like setting up undo records for added and removed geometry, loading the command's UI file, canceling any currently running command, clearing previous picked points, clearing any selection transition or selection lock, etc...


> Something like string.js http://stringjs.com/ would be really useful!

You can probably use it if you want, try copying the .js file to the commands folder and then in your command put #include "string.js".

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  andrewsimper
6648.5 In reply to 6648.4 
I implemented the script as a command and came to post here to complain that it wouldn't undo, but you have beaten me to it :)

Copying all of the geometry by a clone is a very heavyweight operation for a simple re-name. Is it possible to add the name field to your undo system?

edit: how does the current system work when I click on the top left name field and type in a new name? I can undo that operation, is this also a completely clone of all geometry that is being renamed?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Michael Gibson
6648.6 In reply to 6648.5 
Hi andrew,

> edit: how does the current system work when I click on the top left name field and type
> in a new name? I can undo that operation, is this also a completely clone of all geometry
> that is being renamed?

I had to look it up, I had forgotten about this.

When you use the regular UI to edit the name it does set up a special undo unit that just contains object state (including name, style assignment, hidden and locked states), and just the geometry's ID number as a reference to it, rather than storing a clone of the actual geometry.

But currently the creation of these particular undo units is baked in to some specific functions like the property panel's name edit function (which includes showing the dialog as part of it), there isn't any way to trigger it by itself from script right now.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-2  3-6