Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Can't execute a plugin twice

    Scheduled Pinned Locked Moved PYTHON Development
    16 Posts 0 Posters 1.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 01/10/2013 at 13:29, xxxxxxxx wrote:

      Nope... even without the RestoreLayout stuff, it still returns the same error 😞

      Is there any frameword for a CommandData plugin that uses .res files to create a dialog around?

      Rui Batista

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 01/10/2013 at 13:45, xxxxxxxx wrote:

        I have one posted on my plugins site: https://sites.google.com/site/scottayersmedia/plugins
        In the python section. Called "Dialog Using Resources".

        -ScottA

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 01/10/2013 at 13:48, xxxxxxxx wrote:

          Thank you, Scott. But it is for C++. Isn't there anything available for python?

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 01/10/2013 at 14:03, xxxxxxxx wrote:

            Scroll down.
            There's a python plugins section below the C++ plugins section.

            That reminds me. I gotta update that website.
            It's pretty ugly.

            -ScottA

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 01/10/2013 at 14:32, xxxxxxxx wrote:

              Ok, ok... found it.

              My Execute code had a tab too much. Damn! the whole problem was just a tab.
              Thank you for all the help.

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                On 01/10/2013 at 15:00, xxxxxxxx wrote:

                Lol!

                Been there. Done that. Got the T-Shirt.
                I like Python a lot. But that tabbed spacing stuff is a royal P.I.T.A. And burned me more times than I care to admit.
                After dealing with a few spacing errors like that. You don't mind typing {} braces in other languages anymore.

                -ScottA

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  On 01/10/2013 at 17:40, xxxxxxxx wrote:

                  It does help to use a proper editor which can enforce PEP8 rules to your code. It won't
                  be able to fix really fundamental formatting syntax errors, but most of them. PEP8 are
                  the official python code formatting guidelines ( x = foo(y=5) instead of x = foo(y = 5) 
                  for example).

                  https://github.com/hhatto/autopep8

                  There also many (unofficial) branches specifically fitted into the various editors / IDEs.
                  Eclipse does come with some rock solid PEP8 enforcing, personally I am using SublimeText3
                  with

                  https://github.com/wistful/SublimeAutoPEP8.

                  There is also CodeIntel for ST3 which can highlight various (possible) code problems for you,
                  including PEP8 violations.

                  https://github.com/SublimeCodeIntel/SublimeCodeIntel

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    On 02/10/2013 at 06:30, xxxxxxxx wrote:

                    I do have an excellent editor. I use Sublime Text 2.
                    This is one of those errors that can only be attributed to me. Code that could be executed nevertheless was only being executed if a condition was true.

                    Rui Batista

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      On 02/10/2013 at 08:28, xxxxxxxx wrote:

                      Not sure which version of Sublime supports it, but version 3 or even version 2 has an option to use
                      spaces instead of tabs. You won't have this problem when using tabs only, and sublime will automatically
                      convert tabs to spaces with the right options.

                      Best,
                      -Niklas

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

                        On 02/10/2013 at 08:35, xxxxxxxx wrote:

                        Sublime Text 2 can convert spaces into tabs and vice-versa.
                        And I always use tabs, instead of spaces 🙂
                        However, when I copy/paste code from the SDK pages, sometimes the pasted code comes with spaces. But I always convert spaces to tabs.

                        1 Reply Last reply Reply Quote 0
                        • H Offline
                          Helper
                          last edited by

                          On 02/10/2013 at 10:00, xxxxxxxx wrote:

                          All three links work with ST2/.3 The first link is the original PEP8 Autoformat script, which is kind 
                          of the official python autoformat and will obviously work on any text file. Link two and three are 
                          specific ST2/3 plugins.

                          I like autoformatting and I think it is a good idea to follow PEP8, considering the way python 
                          does define its syntax. CodeIntel also adds things like some sort of intellisense, displaying your 
                          classes and methods with its docstrings and parameters in the autocomplete dropdown. You can 
                          also hook it up with the great fake c4d lib from here :

                          http://www.smart-page.net/blog/2012/11/04/python-cinema-4d-api-auto-completion-fake-modules/

                          About spaces and tabs, I think it is actually a PEP rule to use spaces ( edit : just looked it up, it is 
                          not a  rule, it is just a guideline, but still worth following for various reasons imho). With an editor 
                          like ST you won't recognize any difference in the workflow, as you can just use tab like you are 
                          used to.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post