Member Controls

Developers > Hook for adding entries to Right-click on resource list?
pljonesLink to postposted: Tue Nov 21, 2006 6:15 pm
Avator for pljones

Member since:
 2005-04-02
From:
 London, UK
Posts:
 610

Quaxi,

 

In a similar way to the Tools menu allowing tools to pick which file types they're enabled for, would it be possible to have a way for a plugin to add entries to the context menu for the Resource List?  At the moment, this is a somewhat theoretical request as I'm not quite sure how I'm going to approach my latest feature request but I'd like to know if this is an option.

 

Thanks! 

Inge JonesLink to postposted: Tue Nov 21, 2006 8:53 pm
Avator for Inge Jones

Member since:
 2005-03-06
Posts:
 1899
To put it in context, we've been thinking about exporting from CPF editors so as to use the data in external programs, such as a proposed material editor.  Or at least I thought we were, it seems like Peter has a different idea now...
quaxiLink to postposted: Tue Nov 21, 2006 8:57 pm
Avator for quaxi

Member since:
 2006-04-28
Posts:
 3154
Already there :)
You want to implement a IToolAction. If you have the SimPe Source, have a look at the SimPe Main project, and the Action* classes in there.
As a regular ToolPlugin, the ActionTools have a Method that is called when the selection in teh ResourceList changes, so you can enable/disable it for certain selections like resource types.

A Tool action is returned by the KnownTools Property of your plugins Factory class, and SimPe will add it to the context menu, and the actions toolbar and the actions dock.
quaxiLink to postposted: Tue Nov 21, 2006 9:02 pm
Avator for quaxi

Member since:
 2006-04-28
Posts:
 3154
If you think about using this for opening alternative wrapper GUIs for CPFs, please don't. It would be just confusing.

Instead I will figure out a way for the users to choose which Wrapper a resource should get opened with (like the "open with..." command from Explorer you suggested Inge). That is the clean way to do something like this.
Inge JonesLink to postposted: Wed Nov 22, 2006 12:36 am
Avator for Inge Jones

Member since:
 2005-03-06
Posts:
 1899

It was for exporting to alternative formats.   For example, with the TXMTs, for editing manually in a spreadsheet or text editor, for advanced users who have some purpose behind it.

 

We were also going to suggest that the right-click should not open the resource, which would be useful in the rare case the resource was corrupted and crashing SimPE, and could be deleted without being opened.

pljonesLink to postposted: Wed Nov 22, 2006 1:02 am
Avator for pljones

Member since:
 2005-04-02
From:
 London, UK
Posts:
 610
quaxi wrote:
Already there :)
You want to implement a IToolAction. If you have the SimPe Source, have a look at the SimPe Main project, and the Action* classes in there.
As a regular ToolPlugin, the ActionTools have a Method that is called when the selection in teh ResourceList changes, so you can enable/disable it for certain selections like resource types.

A Tool action is returned by the KnownTools Property of your plugins Factory class, and SimPe will add it to the context menu, and the actions toolbar and the actions dock.


Okay, I'll remember to implement that...

 

The other half of this is...  When a tool accesses a pfd, it probably wants to get the current version.  This needs the user's changes to be either committed or discarded.

 

Is there a way for the tool to tell SimPE to go through this process (as if another packed file were being opened or the package being closed)?

 

Once the tool has completed work on the pfd, it would be nice if the user interface could be refresh with the updates.  Currently, we have to tell people to select another resource then come back again.

 

Is there any way for the tool to tell SimPE to update any open Plugin views for a particular packed file? 

 

(As Inge says, this is specifically for the TXMT export/import I'm working on but the BodyMeshTool could benefit, too.) 

Inge JonesLink to postposted: Wed Nov 22, 2006 10:39 am
Avator for Inge Jones

Member since:
 2005-03-06
Posts:
 1899

Quaxi if you're worried about confusion being caused, maybe some of these things could be available in advanced mode only.

 

Although Peter, I still feel it might be less bloating for SimPE (and remember it will be a tiny minority of people who want this) to make a tool to convert from an already extracted material resource, even if it means borrowing some of Quaxi's code and duplicating it.

 

It's immensely tricky trying to build an application like SimPE that caters to from the in-depth hacker right up to the player who just once in a while wants to change the name of a Simmie.



viewthread, 0, 0, Hooks-for-adding-entries-to-Right-click-on-resource-list