Notifications
Clear all

[Closed] Thumbnail viewer control

Hey Jeremy, I’ve been keeping busy so I haven’t had much chance to check out the multi-select. The right-click menu sounds like a good idea. What did you have in mind that should be put in there? Let me know, I’ll see if I can get some of this implemented this week or so.

Soulcialism,
in my asset browser I’ve implemented a rightclick-menu by using the contextmenustrip-property of the control. You don’t need a rightclick-event for that. The trouble is, you do need to get the selected item from somewhere. For that, a rightclick-event would be very handy. At the moment I first need to leftclick the item, then record that item in a variable, open the contextmenustrip and finally feed that item into whatever option is chosen in the contextmenustrip.

When I do my right-click menu in HitchHiker I handle as much as I can in the control by registering a custom right click mouse event that passes the selected item as an argument property. I have different menus popping up depending on the filetype, so I also specify the menuitem as the sender of the event. That way, I use a case statement in max to work out which menuitem was pressed from the dotnetcontrol.

Yes Pete, and it looks good too! Something like that would be vary handy in Jason’s control as well.
Klaas

1 Reply
(@lonerobot)
Joined: 11 months ago

Posts: 0

Hi Klaas, I just wanted to give an idea of how I implement the right click in a dotnetcontrol, I wasn’t trying to hijack Jason’s thread!

Well, I want to write my own rclick menus, so what I was thinking about was just a registered rclick event so that I can fire a MXS RCMenu from that. I’m already doing an RCMenu for the top menu bar. I would definitely want the item to be passed as the arg. I think all of the info that I need for this use comes with the thumbnailItem properties – same as a left click event.

Pete definitely hits the mark, but my need is even more simplified – I am filtering for specific filetypes so I don’t necessarily need it to be contextual.

Klaas – is the contextmenustrip a dotNet control?

Yes, the contextmenustrip is a dotnetcontrol. You can assign a contextmenustrip you create to the thumbnailviewer with the .contextmenustrip property of the thumbnailviewer. I’m not even sure if you can use a maxscript rcMenu on a dotnet control such as the thumbnailviewer.
Klaas

I made my own way of implementing a rightclick in my flowlayoutpanel setup I have.

I just use the mouse pos and create a standard max rightclick menu at that position.
It seems to work just fine, and I haven’t had any issues with it.

labbejason: Very cool thumnail viewer :D. I have some comments on it though. Would it be possible to have tooltip for each thumb to show its text/full text? Also, would there be a way to dynamically resize the thumbs as well?

Thanks!

I’ll add in the right-click event, that’s no problem. The tool tip sounds like a good idea! I can see if I can make the tool tip’s text as the thumbnail item’s property.

I’m not sure how I would handle resizing the thumbnails dynamically. Right now their size is determined by the number of items that are in a row and the width of the control. I wanted to never show a horizontal scroll bar on the main control, so that’s why I did it this way.

Good feedback! Thanks guys.

Ah, ok well cool. Yeah the tooltip would definably be cool to have in there.

The FlowLayoutPanel is pretty good, but has some flaws. But it seems your viewer only supports .jpg,.bmp,.png and maybe some others?

The Flow doesn’t support .tga or anything, but with that control, you are feeding it a bitmap object, not a file path. So I just made my own functions/found some dotnet stuff to resize a bitmap and put it into the clipboard.

So even if its a .hdri or something, I can still display it in my viewer without issue.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

and how finally you read .tga files?

I just make sure that the Bitmap Path is valid, then call a function with the openBitmap/setClipboard methods.


local tempBmp = openBitmap theBitmap
 setclipboardBitmap tempBmp

//........more code (Resizing)

It works fine for what I’m doing. I’m not worrying about display the thumbs with alpha or anything. Although PNG will display with transparency by default.

I use that code for .TGA, .DDS, .PSD and .HDR. Basically anything that 3DS Max supports for filetypes, I just use the openBitmap and “convert” it, then I use a Dotnet bitmap resizing function I saw on this forum.

Then to extract/display bitmap info, I just use the bitmapInfo call.

Then to get the image in my Flowlayout I just append the images to an array and display them at the end.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

yep… clipboard <-> .net method is well known. it’s not an issue. the problem is – to get a .net image you have to open max bitmap. it causes memory leaking. if you try to open … hmm… let say 100 TGA files and put them in you control, the max probably will die. Staying in .net solution only i can fill my control by 1000 image files. of course it takes time to draw, but it doesn’t crash MAX.

only BPM, JPG, PNG, TIFF (GIF, ICO) .net support looks poor but it’s what we have. i don’t care about any exotic file formats. but formats that I really need to support are DDS and TGA. well… the formats are open. you can find all info about it just googling. Maybe you can use third party DLLs but I can’t. So I wrote my code to read it.

Page 3 / 5