23 Replies Latest reply on Oct 30, 2017 10:13 PM by johnrellis

    [Q] Development tool recomendation?

    Naoki-Hada Level 1

      Hi all,

       

      I'm not sure what is good development tool for Lighroom plugin development.

      Any recommendation?

       

      I've tried following.

      * WebStorm

         I used for CEP plugin development for JavaScript and ExtendScript.

         Code look up is strong and capable for Lua code

       

      * ZeroBrane Studio

         From other thread:  Interactive debugger for Lightroom plugins

         It has runtime debugging with steps and watch list.

         But I think it does not have object browser like Chrome debugger or ESTK.

       

      Is there any tool or good way to check object's data structure?

       

      Thank you,

      Naoki

        • 1. Re: [Q] Development tool recomendation?
          johnrellis Most Valuable Participant

          Try my Debugging Toolkit: Debugging Toolkit for Lightroom SDK .  It's a rudimentary debugger, but it has the basics of breakpoints, stepping, and examining stacks, but it also can print out all Lua values, including nested tables, in a very readable format.   Also, it handles the unique issues of Lightroom tasks, pcall, and error handling better than ZeroBrane.

          1 person found this helpful
          • 2. Re: [Q] Development tool recomendation?
            Naoki-Hada Level 1

            johnrellis Thank you very much for the tool and the info.

            I had installed the plugin already but not really tried yet.

            # I was not sure how to use.

            So I'll check more details.

            Thank you,

            Naoki

            • 3. Re: [Q] Development tool recomendation?
              johnrellis Most Valuable Participant

              Check out the documentation in the file "Debugging Toolkit.html". It does take some time  to get up to speed and prepare your source files, but that's due to inherent limitations of the Lua environment in LR with regard to error handling.

              1 person found this helpful
              • 4. Re: [Q] Development tool recomendation?
                Naoki-Hada Level 1

                johnrellis Ah, I missed the documentation. It is helpful.

                Thank you very much.

                • 5. Re: [Q] Development tool recomendation?
                  Naoki-Hada Level 1

                  johnrellis I'm still trying to set up your Debugging Toolkit.

                  But I'm getting attached error.

                  Is it compatible for Lightroom Classic CC (ver 7.0)?

                  I'm not sure if I've seen this with Lightroom CC 2015.

                  I needed to upgrade Win 7 to Win 10.

                   

                  capture_20171025_144753.png

                  • 6. Re: [Q] Development tool recomendation?
                    johnrellis Most Valuable Participant

                    It should work after you restart LR. 

                     

                    Like the ZeroBane debugger, the toolkit needs to install an  undocumented module to get access to Lua's debugging facilities. But the toolkit does it automatically, and when it does, you need to restart LR for it to work.

                    1 person found this helpful
                    • 7. Re: [Q] Development tool recomendation?
                      Naoki-Hada Level 1

                      johnrellis

                       

                      I restarted Lightroom many times, but it is poping up every time.

                      It shows result, but it does not show debugger screen.

                       

                      I'm trying to use Debug Script Command feature by following steps.

                      # I'd like to check object/data browser.

                       

                      1) Removed all module folder/files from below

                          C:\Program Files\Adobe\Adobe Lightroom Classic CC\Modules

                          ZeroBrane code has removed as well.

                       

                      2) Disable all modules except Debugging Toolkit

                        It is at following location

                        C:\Users\nhada\AppData\Roaming\Adobe\Lightroom\Modules\debuggingtoolkit.lrdevplugin

                       

                      3) Re-launch Lightroom

                       

                      4) File > Plug-in Extras > Debug Script

                       

                        Then following pop up. Even relaunched Lightroom, it shows every time.

                      capture_20171026_114011.png

                        I verified following folder has created with Info.lua and LrHidenLua.lua file.

                        C:\Users\nhada\AppData\Roaming\Adobe\Lightroom\Modules\LrHiddenLua.lrmodule

                       

                      5) Select Test002.lua on Debug Script window then click "Run"

                       

                        capture_20171026_114110.png

                      Test002.lua files is located in 2)'s folder.

                      File content is following

                       

                      Test000.lua

                      local LrApplication = import 'LrApplication'

                      local t = LrApplication.versionTable()

                      local s = t.major.."."..t.minor.."."..t.revision.."."..t.build

                      return s

                       

                      6) Then error shows up again.

                      capture_20171026_114116.png

                      7) After that 5)'s window pop up with result.

                      capture_20171026_114119.png

                      8) If I click "Run" again, it repeat from 6).

                       

                      TextPad is installed following location, but it seems not called.

                      C:\Program Files\TextPad 7

                      C:\Program Files\TextPad 8

                       

                       

                      capture_20171026_123027.png

                       

                      If there's something missing, please let me know.

                       

                      Thank you,
                      Naoki

                      • 8. Re: [Q] Development tool recomendation?
                        johnrellis Most Valuable Participant

                        Very strange. Could you please zip up C:\Users\nhada\AppData\Roaming\Adobe\Lightroom\Modules\LrHiddenLua.lrmodule and email it to me at the support address on this page: Debugging Toolkit for Lightroom SDK

                         

                        Also, your screenshot is concerning:

                         

                         

                        I wonder why the backslashes "\" not displaying properly? In which language is your LR running?

                        1 person found this helpful
                        • 9. Re: [Q] Development tool recomendation?
                          Naoki-Hada Level 1

                          johnrellis

                           

                          I've sent I've sent zipped LrHidadenLua.lrmodule and emailed.

                          If it is not delivered, please let me know.

                          # I might have typo on address.

                           

                          Debugging Toolkit itself is 1.7.0

                          VERSION = {major = 1 , minor = 7, revision = 0, build = 0}}

                           

                          > I wonder why the backslashes "\" not displaying properly? In which language is your LR running?

                           

                          This part is no issue. The Windows' system locale has set to Japanese.

                          Back slash shows Japanese Yen mark in Japanese font set.

                          I don't know why, but it is from DOS era or even before.

                           

                          Thank you,

                          Naoki

                          • 10. Re: [Q] Development tool recomendation?
                            johnrellis Most Valuable Participant

                            > I wonder why the backslashes "\" not displaying properly? In which language is your LR running?

                             

                            This part is no issue. The Windows' system locale has set to Japanese. Back slash shows Japanese Yen mark in Japanese font set. I don't know why, but it is from DOS era or even before.

                            This makes me mildly suspicious. LR uses Unicode internally to represent and display all strings. It shouldn't be displaying the Yen symbol for "\", regardless of what's set for the Windows' system locale.  I'm wondering if there's something going on internally with file paths causing LR to be unable to load LrHiddenLua.lua. 

                            • 11. Re: [Q] Development tool recomendation?
                              Naoki-Hada Level 1

                              The string data are same.

                              Only glyph (each char in font set) is different.

                              capture_20171026_160435.png

                               

                              capture_20171026_160855.png

                               

                              capture_20171026_160949.png

                              capture_20171026_161021.png

                              capture_20171026_161008.png

                              • 12. Re: [Q] Development tool recomendation?
                                johnrellis Most Valuable Participant

                                The string data are same. Only glyph (each char in font set) is different.

                                Thanks, that clarifies the Yen mark. I do find it curious that LR would use a font in which the Unicode character for "\" displays as a Yen mark.  The whole idea of Unicode is that a Unicode character is always displayed faithfully.  There's probably a good reason, but not likely related to the Debug.lua problem.

                                 

                                In the next day or so, I'll set up a virtual machine with Windows 10 configured with the Japanese locale and see if I can reproduce your issue.

                                • 13. Re: [Q] Development tool recomendation?
                                  johnrellis Most Valuable Participant

                                  Here's a quick diagnostic that might help.  Place the following into the file "test-import.lua":

                                   

                                  local LrDialogs = import "LrDialogs"
                                  local success, value = pcall (import, "LrHiddenLua")
                                  LrDialogs.message (tostring (success) .. ", " .. tostring (value))
                                  

                                   

                                  In LR, click on the Scripts menu:

                                  and select Open User Scripts Folder. Copy "test-import.lua" into that folder and restart LR.  Then click the Scripts menu again and invoke "test-import".  Post a screenshot of the result.  Thanks.

                                  • 14. Re: [Q] Development tool recomendation?
                                    Naoki-Hada Level 1

                                    johnrellis

                                     

                                    I changed Windows' system locale from Japanese to English.

                                    But the issue did not resolved.

                                     

                                    I'm not sure if Lr Window has the script menu feature. There's no similar icon.

                                     

                                    So I used Lua Console Lightroom Plugin from

                                    GitHub - nitoyon/lua-console-lightroom-plugin: "Lua Console" plugin for Lightroom 3.0+

                                     

                                    I'm not sure the result would be same as your instruction, but it shows failed.

                                     

                                    capture_20171027_132511.png

                                     

                                    capture_20171027_132521.png

                                    • 15. Re: [Q] Development tool recomendation?
                                      johnrellis Most Valuable Participant

                                      I changed Windows' system locale from Japanese to English. But the issue did not resolved.

                                      That's helpful to know, thanks.

                                      • 16. Re: [Q] Development tool recomendation?
                                        johnrellis Most Valuable Participant

                                        I'm not sure if Lr Window has the script menu feature. There's no similar icon.

                                        Oh sorry, I forgot that the Scripts menu only shows up if you've first created the folder.  For future reference, see this help article for where to create the folder: Script to extract previews of lost or deleted photos

                                        1 person found this helpful
                                        • 17. Re: [Q] Development tool recomendation?
                                          johnrellis Most Valuable Participant

                                          capture_20171027_132521.png

                                          Well, that explains why the debugger can't initialize -- it can't load the LrHiddenLua module.  The error message "attempt to index a nil value" must be coming internally from within LR, since LrHiddlenLua.lua doesn't do any indexing (the use of "." or [ ]).  Unfortunately, ZeroBrane and the Debugging Toolkit rely on the same undocumented mechanism, and Adobe no longer provides any real support for the SDK, so we might be stuck here.  I don't know why this happens with the toolkit but not with ZeroBrane.

                                           

                                          I only have suggestion: Modify LrHiddenLua.lua to to look like this:

                                           

                                          return {
                                              -- _G = _G,
                                              -- collectgarbage = collectgarbage,
                                              coroutine = coroutine,
                                              debug = debug,
                                              -- gcinfo = gcinfo,
                                              getfenv = getfenv,
                                              -- module = module,
                                              -- newproxy = newproxy,
                                              -- os = os,
                                              -- package = package,
                                              setfenv = setfenv,
                                              -- xpcall = xpcall}
                                          

                                           

                                          That's the bare minimum required by the toolkit -- the other lines I added just for completeness, not because they were necessary.

                                           

                                          My guess is that won't make a difference.  Without being able to reproduce this myself on my Windows configuration, I think we'll just have to give up :-<

                                          1 person found this helpful
                                          • 18. Re: [Q] Development tool recomendation?
                                            Naoki-Hada Level 1

                                            johnrellis

                                             

                                            Thank you for the Script info.

                                            I did not know this feature. It would be helpful for some case.

                                             

                                            Following is screenshot run from Scripts folder.

                                            The error message is different.

                                             

                                            capture_20171027_153628.png

                                            • 19. Re: [Q] Development tool recomendation?
                                              Naoki-Hada Level 1

                                              I tried, but it has same error.

                                              Thank you,

                                              Naoki

                                               

                                              capture_20171027_154803.png

                                              • 20. Re: [Q] Development tool recomendation?
                                                johnrellis Most Valuable Participant

                                                I'm afraid I'm out of options.  The debugger works in my MacOS and Windows 10 LR 7, and I haven't received any reports about this before. There's clearly something different about your configuration but don't have any effective means to debug LR internals to figure out what.

                                                • 21. Re: [Q] Development tool recomendation?
                                                  johnrellis Most Valuable Participant

                                                  One more thing occurred to me :-> Try copying the folder "LrHiddenLua.lrmodule" from

                                                   

                                                  C:\Users\nhada\AppData\Roaming\Adobe\Lightroom\Modules

                                                   

                                                  to:

                                                   

                                                  C:\Program Files\Adobe\Adobe Lightroom Classic CC\Modules

                                                   

                                                  and remove any other files (e.g. the ZeroBrane files) from both of those folders.  (In my testing, putting LrHJiddenLua in either of those folders works, with or without the ZeroBrane files, but who knows...)

                                                  1 person found this helpful
                                                  • 22. Re: [Q] Development tool recomendation?
                                                    Naoki-Hada Level 1

                                                    johnrellis

                                                     

                                                    Thank you very much for your support.

                                                    I think it is working now after reinstalled Lighroom.

                                                    One note is Lightroom Classic CC has updated to 7.0.1 .

                                                     

                                                    For someone's benefit, following would be recovery steps as last resort.

                                                    Note: replace "nhada" to your user name

                                                     

                                                    1) Back up user script/modules data. It could be following location.

                                                       C:\Users\nhada\AppData\Roaming\Adobe\Lightroom\Scripts

                                                       C:\Program Files\Adobe\Adobe Lightroom Classic CC\Modules

                                                       C:\Users\nhada\AppData\Roaming\Adobe\Lightroom\Modules

                                                     

                                                    2) Uninstall all Lightroom(s) versions with removing preferences.

                                                       I uninstalled Lr Classic CC and Lr (new) CC as well

                                                     

                                                    3) Remove left over files from following folders

                                                       C:\Program Files\Adobe\Adobe Lightroom Classic CC\

                                                       C:\Program Files\Adobe\Adobe Lightroom CC\

                                                       C:\Users\nhada\AppData\Roaming\Adobe\Lightroom\

                                                     

                                                    4) Install Lightroom Classic CC

                                                     

                                                    5) Disable all plug-ins from Menu: File->Plug-in Manager

                                                     

                                                    6) Install Debugging Tool Kit to folder

                                                       C:\Users\nhada\AppData\Roaming\Adobe\Lightroom\Modules

                                                       And enable Menu: File->Plug-in Manager

                                                       And run once at Menu: File->Plug-in Extras -> Debugging Toolkit -> Debug Script

                                                       Then it pop up prompt dialog to restart Lightroom

                                                     

                                                    7) Restart Lightroom

                                                     

                                                    Then I think Debugging Toolkit is working as expected as following screenshot.

                                                     

                                                    Thank you very much,

                                                    Naoki

                                                     

                                                    capture_20171028_131136.pngcapture_20171028_131310.pngcapture_20171028_131521.pngcapture_20171028_131524.pngcapture_20171028_131534.png

                                                    • 23. Re: [Q] Development tool recomendation?
                                                      johnrellis Most Valuable Participant

                                                      Wow, that was a lot of work to get it installed!  I'm glad you finally got it working.

                                                      1 person found this helpful