-
Notifications
You must be signed in to change notification settings - Fork 515
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
Add pixels - Finished. #400
Conversation
This is in reference to #127 |
Unlike in the case of adding other units, I think adding "pixels" unit needs further modification to be included. Because users who use "pixels" unit will expect OpenToonz acting like other movie-editing softwares such as AfterEffects, in which you don't need to mind DPIs of cameras or levels...
|
Those are good points. I will look into it. I can easily hide the DPI and other input boxes, but I'm not sure about the scaling part. I do think that pixels are an important option for users as most paperless animators probably think in terms of pixels over anything else. |
What do you think about if pixels is set as an option, disabling all DPI options (and hiding them). I'm pretty sure new levels just inherit the current DPI. Hiding the DPI would make sure that all levels are the same. |
Or is there a generally accepted DPI that is considered actual size that all levels can be locked to if pixels are selected? |
Some images (such as background) may not be created with "New Level" command, but loaded from the file. So I think the software should take care about the case when the DPI of each level is different. One idea is that when you load the file the software automatically changes its DPI to some specific value to be displayed in the Viewer one-pixel-per-pixel size. For now, DPI can manually changed in the Level Settings. |
What do you think of when pixels are selected, changing the DPI label to scale- since that's effectively what DPI does when you are talking about scale. We could leave that option visible and let users change the value according to their needs. This would make it easier to use a multi megapixel image and scale it to a smaller video friendly resolution. What image formats that OT can import have a built in sense of DPI? Is it only PSD files? How do you want to manage them? Use the set DPI in the file or scale them to some other value? Are there any other major areas of the UI that I should consider with pixels? I will hide the inches sections of the various popups. |
TIFF images can include dpi information and OpenToonz can take into account. (Actually, in studio Ghibli all background images were handled in TIF format in order to exploit dpi feature.) Please see stage.cpp line 69:
This value is used in the viewer with camstand view mode. Which means that if you put the TIFF image with 53.33333 dpi, the image will be displayed in exactly the same pixel size on screen when the viewer is not zoomed. This value is also applied when you load images without dpi such as JPG.
Well, I think some cleanup features are needed to be checked as they use cleanup camera information. |
Locking the DPI in at 53.3333 makes sense. However, this should only apply to NEW levels created while pixels is set as the option, correct? If switching to pixels makes all existing levels also 53.3333 dpi, that would mess up a lot of projects, right? Should there be any option for scaling available? If a user imports a huge image with a dpi of 53.3333, it would overwhelm the screen. I haven't done any scanning/cleanup in OT. Should any DPI information be kept in the scanning/cleanup? Or should it also go to 53.3333? |
Nevermind on the scaling question. That's what the edit tool is for. Right now it looks like the camera and new levels default to 64dpi. Should that be made 53.3333 instead? |
Yes I think so.
Yes again. I agree with you that the existing scene should not be modified by changing the unit.
Basically yes. When "pixels" unit is selected, I think you need to use 53.3333 dpi both for new level and for camera. But it is not the problem of the default value of dpi. The default values can be changed by users easily with "Save Default Settings" command. However with "pixels" unit, they should be forced always to be 53.3333 in order to show the correct size in the Viewer, and also dpi boxes should be hidden so that the users do not worry about the strange value of "53.3333". |
For now this branch conflicts to master branch since we applied clang-format on v1.0.3 release. |
Do you think that if pixels are enabled at all that they should be used everywhere or should the camera and other units be separate. I have added a checkbox that automatically sets both to be pixels but remembers the previous values and so if the checkbox is disabled, the units go back to their former values. Also the way I am building it right now, the default camera and levels are always set at 53.3333 dpi, not only when the pixels is selected. The user can change this of course, but if pixels is selected, it will change it back to 53.3333. This is to keep the camera from changing back and forth if people switch from pixels to another unit. (For example: right now the default dpi for the camera is 64. If pixels is selected, it should change to 53.3333 which would alter any scene someone had been working on. If the camera is at 53.3333 by default no matter what, toggling between pixels and something else won't mess up the scene.) Just a note of warning when the camera is set to 53.3333 with a default resolution of 1920 x 1080, the size is a strange 35.9955 x 20.2544. That might also seem like a strange value. Any thoughts on this? Here are screenshots of the new functionality. If users should be able to make each individual part pixels, I can take away the checkbox and the part that disables the dropdowns. |
Not ready yet. |
I took a quick look on your WIP source. Regarding the default camera dpi, IMO there is no reason to stick to the current value of 64. As you pointed, it would be more friendly if we change it to Stage::inch. On that condition above, I'm thinking of changing the value of Stage::inch itself... Because it is too small compared to the actual working dpi, and is difficult to hadle as it contains decimals. One problem is that the Stage::inch value are used in many part of the source, especially it defines the size / thickness of the vector levels. In the following image I loaded the same vector level on the software with different Stage::inch values: So, one idea is to separate Stage::inch into two constant values; i.e. changing Stage::inch to 160.0 and introduce another constant value (say, Stage::vectorDpi) with the value 53.33333 in order to keep the size of vector levels created in older versions unchanged. |
@@ -1014,18 +1061,19 @@ PreferencesPopup::PreferencesPopup() | |||
} | |||
styleSheetType->addItems(styleSheetList); | |||
styleSheetType->setCurrentIndex(currentIndex); | |||
|
|||
//m_pixelsOnlyCB->setChecked(m_pref->getPixelsOnly()); | |||
m_pixelsOnlyCB->setChecked(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please insert the following in order to disable the combo box if the "pixel" unit is selected on launch.
if (m_pref->getPixelsOnly()){
m_unitOm->setDisabled(true);
m_cameraUnitOm->setDisabled(true);
}
Please add a new pixel-based measure for an "fxLength" unit as follows:
|
Thanks for all the great feedback. I am still learning how OT handles units- I will get those changes pulled in. I like the idea of changing Stage::inch. I was afraid to touch it because I didn't know if it was some special value since it seemed so specific. That solves another issue I didn't like about changing the camera to 53.3333- at that DPI a project of 1920 x 1080 covered the light table completely. This will fix that. |
@shun-iwasawa At 160dpi, the light table seems a little big compared to the canvas. What do you think of 120? It makes the image size an even 16 x 9. |
Fixed the error on TUnit and applied clang formatting |
@shun-iwasawa What do you think about updating Stage::inch in a different PR to keep this one focused on just pixels? |
TDimensionD camSize; | ||
camSize.lx = camRes.lx / 53.33333; | ||
camSize.ly = camRes.ly / 53.33333; | ||
camera->setSize(camSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you are changing the size of the current camera with dpi value 53.33333.
I think it would be better to do the same thing for the cleanup camera of current cleanup settings as well.
It is stored in CleanupSettingsModel::instance()->getCurrentParameters()->m_camera .
Thanks for catching that. I don't use cleanup, so I didn't think about the cleanup camera. |
@turtleTooth First of all, thank you very much for all the way to implementing this feature, it must be one of the big advances of OpenToonz.
I agree with your suggestion to keep updating Stage::inch for the future issue.
Well, it makes some sense, but IMO making "pixel" unit to be default should NOT be done for now. Maybe at a later date, in consideration of feedback to be provided from users after releasing this, since this change may affect many aspects of the software. |
That makes sense. I will change it back. |
For now, if you set the default camera dpi to other than 53.33333, it fails to show the image in the viewer with correct size when you create a new scene with "New Scene" command. The "default camera dpi" is stored in the project settings and retrieved with the function TProjectManager::instance()->initializeScene(scene); at line 1288 in iocommand.cpp. |
@shun-iwasawa Thank you for taking the time to review this PR. I realize there is a lot to it. I reverted the default value and agree that feedback should be taken from the community. |
(continued from my previous comment) |
@shun-iwasawa I'm sorry. I think I'm missing how to change the default camera dpi. If pixels only checkbox is selected, it hides the ability to change the current camera dpi. How do I duplicate this error to fix it? I don't see a way to change the dpi related to project settings. |
"Save Default Settings" command is for saving all settings in the current scene (including camera settings) to the current project settings. The project settings is used for initial settings of new scenes.
|
I just tried that, and it looks like the settings are actually correct, but needs to call a fit to window. I followed your steps and then selected something other than pixels to see the dpi, and they seemed to be right. Would calling a fit to window after new scene or on scene load fix it? By the way, sorry for my confusion. I have never used "Save default settings before". Nevermind- I was able to see what you were seeing. I'll fix it. |
…ther than 53.33333
Does that fix it? I am seeing the correct settings even if default settings are saved other than 53.33333. |
I chose the first option, because I think the second might be too many steps:
|
Here I uploaded a video showing the problem: |
I'm so sorry for not seeing it right away. Thank you for taking the time to make the video. You rock. |
It seems that the "default dpi on creating new scene" problem is resolved! Thanks! |
@@ -277,7 +282,8 @@ CameraSettingsWidget::CameraSettingsWidget(bool forCleanup) | |||
gridLay->addWidget(m_yPrev, 0, 4, Qt::AlignCenter); | |||
|
|||
gridLay->addWidget(m_inchPrev, 1, 0, Qt::AlignRight | Qt::AlignVCenter); | |||
gridLay->addWidget(new QLabel("Inch"), 1, 1, | |||
QString units = Preferences::instance()->getCameraUnits(); | |||
gridLay->addWidget(new QLabel(units), 1, 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a tiny UI problem so I think you can adjust after releasing this PR..
You set the current unit to the label in camera settings instead of "Inch". I think it is very nice modification itself.
But since the label is set once in the constructor, it remains unchanged if you change the camera unit.
Updating the label according to the camera unit or just setting more general name (such as "Size") would be OK.
Jenkins |
I like your solution. It is better to update to show the actual measure being used. I will submit it after this is merged. |
OK, It's time to merge and hear the voices from community. LGTM |
@shun-iwasawa Yea! Thank you so much. Your help has been invaluable on this. |
This makes pixels an option for measurement.
Update: Got the ruler working too.
Update: Level creation popup and Default Level size in preferences are working now too.
I'd like to see pixels made the default, but that is up for debate.