Results 1 to 15 of 15

Thread: Plugin "Scan Folder" and Python scripts?

  1. #1
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,740

    Question Plugin "Scan Folder" and Python scripts?

    I just went to use Quick_Clone.py which is in the path

    E:\Program Files\NewTek\LightWave11.6.3\support\plugins\scrip ts\Python\Layout\Generic\Quick_Clone.py

    IOW, my normal plugin path. Layout said "not found", so I re-scanned the folder, and it STILL doesn't find it.

    Does the folder SCANNING function not work for Python scripts?

    (Obviously, I'll ADD the script manually, but I'd like to know.)
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  2. #2
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,740

    Python script failure.

    the plot thickens....

    The actual error is "Cannot load external plugin file: blah blah blah...". This is the NATIVE plugin. However, Celshader's version of Python QuickClone works dandy.

    So, could someone PLEASE test the LW3dG python Script "Quick_Clone.py" to check its functionality?
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  3. #3
    There might be a problem with the contents of the py file which define if it's a proper LW script.
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  4. #4
    Not doing nothing.... Tranimatronic's Avatar
    Join Date
    Dec 2003
    Location
    Vancouver BC
    Posts
    496
    I will take a look when I get to my home machine, but there appears to be a space in the filename which may kill it.
    Of course it may be a typo, but thought I would point it out
    scrip" "ts :
    "pport\plugins\scrip ts\Python\La"
    Last edited by Tranimatronic; 05-14-2014 at 07:24 PM.

  5. #5
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,740
    Quote Originally Posted by ernpchan View Post
    There might be a problem with the contents of the py file which define if it's a proper LW script.
    That's a problem, since it's a LW3dG script!

    Tranimatronic, that space was an artifact of cutting and pasting, doesn't actually exist. Good eye, though.
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  6. #6
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,740
    More observations:

    "Quick_Clone.py" DOES run from the Python button in Layout, but does NOT run from a button added to the UI which directly invokes it.

    But Celshader's "QuickClone.py" (no underscore) runs from a button fine.

    I have no idea what the implications are here.
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  7. #7
    Are there discrepancies in the server tag lines?
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  8. #8
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,740
    Me no knowee what this "server tag lines" am you speak of.

    Anybody else use this plugin? Jen's version is super convenient: "insta-clone" would be a good description of it.

    Anyway, shouldn't using "Python" (the button) be the same as making a button on the UI that directly invokes the script? Or does "Python" and the UI use, ummmmm, different 'servers'???

    https://fogbugz.newtek.com/default.a...foc5qtmip32198
    Last edited by jeric_synergy; 05-15-2014 at 11:14 AM.
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  9. #9
    Not doing nothing.... Tranimatronic's Avatar
    Join Date
    Dec 2003
    Location
    Vancouver BC
    Posts
    496
    ...sorry. Was going to look last night. Instead sleep got in the way. Will TRY to remember tonight

  10. #10
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,740
    No worries: it's been fogbuzzed, it may just be MY system (see the g.d. HUB thread....) and it ain't gonna get fixed overnight anyway.

    It's pretty peculiar/puzzling, what with the added info/behaviour above. SHOULD work: doesn't.

    Especially puzzling in that it's an LW3dG script.
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  11. #11
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,740

    working and non-working Python code for "QuickClone" and "Quick_Clone"

    Quote Originally Posted by ernpchan View Post
    Are there discrepancies in the server tag lines?
    :sigh: Man, I'd sure like to USE lightwave instead of writing bug reports ALL THE TIME.

    At least when I was a beta-tester I got a tiny bit of compensation.

    I don't read Python but: here's the Python code for THE ONE THAT WORKS:

    import lwsdk

    __author__ = "Jennifer Hachigian"
    __copyright__ = "Copyright (C) 2012 Jennifer Hachigian"
    __version__ = "1.0"
    __maintainer__ = "Not Me"
    __email__ = "[email protected]"
    __status__ = "Production"
    __lwver__ = "11"

    class QuickClone(lwsdk.IGeneric):
    def __init__(self, context):
    super(QuickClone, self).__init__()

    # LWGeneric -------------------------------------------
    def process(self, ga):
    lwsdk.command("Clone 1")
    return lwsdk.AFUNC_OK



    ServerTagInfo = [
    ( "Python QuickClone", lwsdk.SRVTAG_USERNAME | lwsdk.LANGID_USENGLISH ),
    ( "QuickClone", lwsdk.SRVTAG_BUTTONNAME | lwsdk.LANGID_USENGLISH ),
    ( "Utilities/Python", lwsdk.SRVTAG_MENU | lwsdk.LANGID_USENGLISH )
    ]

    ServerRecord = { lwsdk.GenericFactory("LW_QuickClone", QuickClone) : ServerTagInfo }


    And here's the one that doesn't work:

    #! /usr/bin/env python
    # -*- Mode: Python -*-
    # -*- coding: ascii -*-

    """

    Creates a single clone of the selected item.

    usage: assign this script to a hotkey for a faster cloning/moving workflow in Layout.

    tip: this script uses the single-shot formatting introduced with LightWave 11.5.
    See "anatomy.html" in the SDK's lwpython documentation for more information.

    tip: this script executes the Clone command. For a list of more commands, see the
    "commands.html" file in the SDK.

    """

    import lwsdk

    __author__ = "Jennifer Hachigian"
    __date__ = "Aug 29 2013"
    __copyright__ = "Copyright (C) 2013 NewTek, Inc."
    __version__ = "1.0"
    __maintainer__ = "Jennifer Hachigian"
    __email__ = "[email protected]"
    __status__ = "Utility"
    __lwver__ = "11"

    lwsdk.command("Clone 1")
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  12. #12
    Yeah, there's no ServerTag info in the one that doesn't work...so while you can run it as a one-off python command, it won't get added as a proper button. LW doesn't see it as a plugin that can be added to the environment. That's what the ServerTag stuff does. If you watch BigHache's python vids he explains this.

    So it's not so much that the scripts are broken, one is just not formatted to be added as an actual button.

    I don't believe lscript had this problem. With python we're going to get more control but at the cost of ease of coding imho.
    Last edited by ernpchan; 05-15-2014 at 01:09 PM.
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  13. #13
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,740
    Thanks for looking into that ernpchan. So, everything in the brackets is the server tag? (It certainly looks that way.) Will just plopping that bit in make it, ummm, "buttonable"?

    I'm a little disappointed in Jennifer-- she wrote them both, so why is the one included in the official distro so lame?
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  14. #14
    This is what's needed to make it a proper button/plugin entry.

    Code:
    ServerTagInfo = [
    ( "Python QuickClone", lwsdk.SRVTAG_USERNAME | lwsdk.LANGID_USENGLISH ),
    ( "QuickClone", lwsdk.SRVTAG_BUTTONNAME | lwsdk.LANGID_USENGLISH ),
    ( "Utilities/Python", lwsdk.SRVTAG_MENU | lwsdk.LANGID_USENGLISH )
    ]
    
    ServerRecord = { lwsdk.GenericFactory("LW_QuickClone", QuickClone) : ServerTagInfo }
    But it's not just a matter of copy pasting this exact text. The names have to be relevant to your python code. If you pick through the code you'll see which text in the ServerTag is the same as what's in the Class code.

    The first example has everything wrapped into a Class. The 2nd example is just executing a command. I believe you need to wrap your code into a Class to properly use the ServerTag.

    I'm still trying to get my brain wrapped around python so I might be wrong but that's my understanding of it.

    I can't speak for celshader. Part of it may be as an example of what's possible. The python implementation is still relatively new so it may just be the byproduct of the discovery process.
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  15. #15
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,740
    This issue got attention from Deuce Bennett and Jennifer Hachigian (Celshader). She was using something called the "single shot" format, which may explain both the difference in code and why one worked and the other didn't.

    In the course of full characterization of the issue, I nuked my LW11EXT-64.cfg file, and that seemed to correct whatever was wrong. Since I've been doing full scans of plugins frequently, apparently plugin scans alone will not correct an error in that config file.

    At this point (I've learned to be cautious) it seems that this issue is addressed, --although once again I'm baffled how much trouble a bad config file can cause.
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •