Giter VIP home page Giter VIP logo

practicalmayapython's Introduction

practicalmayapython

Source code repository for the "Practical Maya Programming with Python" book.

You can get an eBook version of the book FREE! Just email me at the email below.

Or you can purchase/learn more at:

Author Information

Name: Rob Galanakis

Email: [email protected]

Website: https://robg3d.com (personal) and https://lithic.tech (business)

practicalmayapython's People

Contributors

1fth3n3ls3 avatar ragingviking avatar rgalanakis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

practicalmayapython's Issues

QStatusBar Deleted in Chapter 5

Hi!
I'm running Maya 2015 with Windows 7 64-bit. On page 163 when we open the GUI using a Shelf button, the GUI status bar does not work, (it works when called from outside Maya). This RuntimeError appears:

File "D:\MEL and Python Scripts\Python Scripts\hierarchyconvertergui.py", line 32, in update_statusbar
controller.selectionChanged.connect(update_statusbar)
RuntimeError: Internal C++ object (PySide.QtGui.QStatusBar) already deleted.

In an e-mail, you explained this was what was happening:

That issue is due to Maya cleaning up the memory underlying the Qt object before Python is actually done with it. In other words, PySide (the Qt bindings) have a reference to some C++ Qt object, but somehow it has decided that C++ object can be deleted. But Python still has a reference to the PySide object, and when Python accesses it: BAM!

And suggested this workaround:

my_hacky_list = []
def some_func():
    my_statusbar = # create status bar
    my_hacky_list.append(my_statusbar)
    def update_statusbar():
        # ... do some stuff with my_statusbar ....
    controller.selectionChanged.connect(update_statusbar)

I'm just starting to cut my teeth on this stuff and tried the following, but the problem continued....

statusbar_list = []
def keep_statusbar():
    my_statusbar = statusbar
    statusbar_list.append(my_statusbar)
    def update_statusbar(newsel):
        if not newsel:
            txt = 'Nothing selected.'
        elif len(newsel) == 1:
            txt = '%s selected.' % newsel[0]
        else:
            txt = '%s objects selected.' % len(newsel)
        my_statusbar.showMessage(txt)
    controller.selectionChanged.connect(update_statusbar)    

Thanks!
Ric

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.