New plugins: color tools - Printable Version +- Wings 3D Development Forum (https://www.wings3d.com/forum) +-- Forum: Wings 3D (https://www.wings3d.com/forum/forumdisplay.php?fid=1) +--- Forum: Design & Development (https://www.wings3d.com/forum/forumdisplay.php?fid=6) +--- Thread: New plugins: color tools (/showthread.php?tid=3114) |
New plugins: color tools - edb - 05-23-2023 Hello, I've made some plugins related to color and the wings palette. Color Panel A color panel for quick selection of colors, it maintains a color history like in some paint programs, and the color history can be sent to the palette. Palette Import/Export I've made some functionality to import and export different kinds of files to the wings palette. Since it is a standalone plugin at the moment I decided to put them in the Tools menu. Import: From swatch image: Reads an image file of a color swatch (image of solid color squares that some color generator web sites can export). Text file: Read various plain text files, it recognizes hex color codes, CSS style rgb(...) and tabular data. Adobe Palette: Reads various adobe palette types. Sample from image: Scans the image for the most used colors. Export: SVG swatch image / EPS swatch image: Generates a swatch-style picture in SVG/EPS. Text file: Generate text file with hex or tabular data. SVG/TeX legend: Generate a list of labelled colors (currently labels show "Color1", Color2", etc). Download Color tools beam files: wings_palette_patch.tar wpc_color_panel.tar RE: New plugins: color tools - micheus - 05-23-2023 Hi edb This is I nice stuff to the palette usage. I have some suggestions... Color Panel: I think it would be better for colour selection if we could move the cursor - while keeping the mouse button pressed - see a preview of the colour (using just the small square you will store the colour). Then, by releasing the colour we already know with more "precision" the chosen colour. Although your colour pick is the same as the one in the default OS used by Wings3D (HSL - at least for Windows) the main advantage I see is the possibility to pick a set each time instead of only one. Maybe this can be useful for other OSs too. For the entire content of this plugin, I think you could implement is as an upgrade to the official Palette window, which you could add the Color Panel as a second option to fill the selected square (usually it's done via Edit option) or append a set of colors the user has created when using your dialog. The Import and Export option would be added as submenu of the Palette's one with the addition of the native Wings3D option (.wpal). Also, take a look on this old thread: How to better organize a color palette ? I would like you to take a "special" look on post #4, #10 (see tkbd idea and files) I'm sure that should not be a problem to do the adaptation in the src/wings_palette.erl and I think this has potential to be approved by dgud. Think about. RE: New plugins: color tools - edb - 05-24-2023 Hello micheus, Thanks for the feedback. I'll look at trying to add a color preview when the mouse button is held down. I think the palette window as it is is pretty good. I used wings_palette.erl as a reference to how the floating windows in wings are written, since it's one of the simpler modules in the wings source. It helped a lot in my case to get a floating window plugin working, so a module like wings_palette.erl has some advantages to be small and simple especially for future plugin developers. As for palette editing, I'll have to think if there is any ideas for the color dialog when "edit" is pushed. When I modified the #st{} pal list I was impressed how the palette window reacts right away to the change in state, it makes the two color windows seem more integrated even when they are different windows. I should mention I'm probably going to make more color related plugins as well, at least one more floating window tool after this one. I can try adding the palette import/export stuff right away to the menu of wings_palette.erl, but I don't know how to make submenus using wings_menu:popup_menu yet. I first tried by doing a second psend/popup_menu call after the first psend/popup_menu in a handle_event. But nothing appears after the click but it does appear after a second right click, but I don't think I'm doing it right. RE: New plugins: color tools - micheus - 05-24-2023 Ok. So, keep doing your way for now. We can think about integrate than in the future depending on the viability after all stuff you will add. But, since the Import/Export stuff you implemented act over the native Palette it would be appropriated those options be appended to the Import/Export option we already find there (Palette window), because it will not be intuitive to have two places to handle this kind of stuff. edb Wrote:I can try adding the palette import/export stuff right away to the menu of wings_palette.erl, but I don't know how to make submenus using wings_menu:popup_menu yet. I first tried by doing a second psend/popup_menu call after the first psend/popup_menu in a handle_event. But nothing appears after the click but it does appear after a second right click, but I don't think I'm doing it right.You didn't asked for help, but I think you don't need to go through the hard path I've made. I started to build a thread bout menus for programmers and at the end I hope this can help you spend more time coding than trying to figure out how the things work: "How to" about context menus I'm going to keep adding info there later. RE: New plugins: color tools - tkbd - 05-25-2023 hello edb I love this tool. Then, I found two issues and good things through Palette tools test. Good things
Unsatisfied point New Color tool palette can trim for new created colors, but can't eliminate specific one color. Issue 1.Some aco(Photoshop swatch) files can't load colors (no message in log window) Issue occurred = HKS E-Z Process.aco , HKS E-Z.aco,ANPA Colors.aco,etc No problem = VisiBone.aco , Windows.aco, Mac OS.aco,WebSafeColors.aco Issue 2.Cant export color palette completely by SVG(EPS) format Wings crash log output when exporting through Palette tools the color palette that has some gaps with undefine color(s) in wings3d-built-in palette window.(It is workaround that used compact command for fix gap.) The SVG file generate,but it is incompletely. It's a good to skip datas with undefined colors(It is a slashed swatch in palette window). It is as like color ,color,... (omit)... color , none,none ,color,none .... The output log is a following. Code: wpc_palette_imports: Error function_clause stack trace: [{wpc_palette_imports, RE: New plugins: color tools - edb - 05-26-2023 Hello micheus and tkbd, micheus Wrote:"How to" about context menus Thank you the information about the submenus it helped a lot. tkbd Wrote:New Color tool palette can trim for new created colors, but can't eliminate specific one color. Thanks for the feedback tkbd for the good things and the things need improvements, I'll try to find a way to remove a specific color. tkbd Wrote:Issue 1.Some aco(Photoshop swatch) files can't load colors (no message in log window) tkbd Wrote:Issue 2.Cant export color palette completely by SVG(EPS) format Thanks I'll have a fix for issue 1 and 2 for the next build. The next build for the palette import / export will be a patch. I should have something soon. RE: New plugins: color tools - edb - 05-26-2023 Palette import/export patch: wings_palette_patch.tar I'll make a pull request soon. The wpc_palette_imports.beam can be deleted from plugins as it is now replaced with a patch for wings_palette_imports.beam RE: New plugins: color tools - micheus - 05-26-2023 Hi edb I just checked the import/export plugin. Do you intend to make it part of the native wings_palette code? If so, I think that all the options must be grouped in the sub-menu. Keep one option for Wings3D palette and others is not nice to look at. RE: New plugins: color tools - edb - 05-26-2023 Hello micheus, I wasn't sure if wings' palette .wpal would be inside or outside of the submenu, but I can add it inside too, at the top with a separator. Maybe something like this? Code: "Clear All" RE: New plugins: color tools - micheus - 05-26-2023 Yeah. It can look better this way. So the user will see the main options Import and Export and after that will find all options available. |