Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pymel Maya 2024 #467

Open
Design0r opened this issue Jun 26, 2023 · 1 comment
Open

pymel Maya 2024 #467

Design0r opened this issue Jun 26, 2023 · 1 comment

Comments

@Design0r
Copy link

Hi, quick question about Maya 2024.
I'm not sure if this is a bug or if im doing something wrong.
If i execute following pymel script on a fresh maya start it always returns true and runs the print command the first time i execute this snippet.
It doesnt matter how the window is called. On the second and any following execute it works as expected.

if pm.window("just_some_random_text", exists=True):
    print("yep")

changing from the pymel api to maya.cmds:

if cmds.window("just_some_random_text", exists=True):
    print("yep")

always works, even the first time (On a new Maya instance). This seems to only be a problem in maya 2024. I tried in in 2023 and the pymel version works properly.
Any Idea whats causing this behavior?

@SolenOchHavet
Copy link

I was just about to report the same :) I started to look into it a bit. This is what I noticed:

The result of:

pm.window("just_some_random_text", exists=True)

Will be:

ui.Window(False)

That's why it prints the first time :) This means now that this will suddenly return True:

pm.window("False", exists=True)

If you had a fresh session, you could have done this as well once:

pm.ui.Window(False)

I that line however should have raised. If I look at the internal logic for pm.window() it looks like it's False until it reaches this line:

https://github.com/LumaPictures/pymel/blob/master/pymel/core/windows.py#L1717

And when you look at that method, you see that it simply tries to cast pm.ui.Window(False) but doesn't raise:

https://github.com/LumaPictures/pymel/blob/master/pymel/internal/factories.py#L1022-L1025

So, something has happened to pm.ui.Window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants