Skip to content

Conversation

@Herizoran
Copy link
Contributor

  • Add Maya viewport to be embeded in the Picker Editor
  • Add snapshot viewport
Dwpicker_maya_viewport_integration.mp4

@luckylyk
Copy link
Member

Sorry, currently i'm really busy on other projects. Your code is a huge addition and I still need time to make a deep review.

At first sight, i can already tell that I prefere to keep close to ui standards. Can you shift the viewport toggler to a toolbar button. I like custom splitter, but non standard ergonomy can be disturbing for user.
I'm mode those kind of creative stuff too, but since a year, i'm trying to remove that things from the picker.

image

For the rest, I'm making a first pass of notes but I dont have time to review everything today. I'll do my best to finish the check this week and fully test the features

@Herizoran
Copy link
Contributor Author

It's okay, take your time! :)

Alright, I will move the toggle button position to the toolbar then.
Btw, what makes the addition code too long is because of the capture module 66c9aa8 , which I took from this: https://github.com/abstractfactory/maya-capture

@Herizoran
Copy link
Contributor Author

It's done!

image

Copy link
Member

@luckylyk luckylyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I had time to check your code, sorry for the delay.
I wonder if the qsplitter custom class remains necessary with the button remove. I think you can cleanup using a QSplitter out of the box.

For the rest, if you applly all the remarks, i'm up to merge !

camera_combo_box.addItems(cameras)
camera_combo_box.currentTextChanged.connect(
lambda: self.update_camera_viewport(camera_combo_box,
picker_model_name))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use functools.partial instead of lambda as far as it is possible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the reason why I used lambda for all the trigger is to keep the code consistent in the file.
there is a combobox there that has a dynamic argument if I remember, then using functools.partial didn't help with that because it only provides static arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I meant by using functools.partial in some cases:

self.camera_name = "front"

self.field_toggle.triggered.connect(
    partial(toggle_camera_settings, picker_model_name, self.camera_name, "field_chart"))

def update_camera_viewport(self, combo_box, panel):
    """
    Update the camera in the active panel when a new camera is selected from the combo box.
    """
    active_camera = combo_box.currentText()
    cmds.modelPanel(panel, edit=True, camera=active_camera)
    self.camera_name = active_camera

In that code, even though self.camera_name is updated later, functools.partial only captures the value of self.camera_name at the time it is created. This is why lambda is used, to ensure the current value of self.camera_name is captured each time the triggered action is invoked.

And to keep the code consistent, I used lambda for all of the triggered actions.

@Herizoran Herizoran force-pushed the feat-viewport-snapshot branch from 038ab41 to dfecaf6 Compare March 25, 2025 06:03
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

Successfully merging this pull request may close these issues.

2 participants