114 Commits

Author SHA1 Message Date
Ghostkeeper
75aafa1e5c
Don't crash if rendering without any window
Probably it'll still crash somewhere else then, but we'll rely on Sentry to find that for us.

Fixes Sentry issue CURA-KW.
2020-04-23 13:41:06 +02:00
Nino van Hooff
7302e8ba7f Update missed sdk versions from 7.1 to 7.2.0 for Cura 4.6
CURA-7383
2020-04-21 11:46:12 +02:00
Jaime van Kessel
9a2d2d32bf
Remove code that prevents Cura from starting on MAC
The renderer isn't active when the view is activated. As such,
no opengl context *ever* exists. In some cases this might cause it to get
stuck in an indefinate loop.

The comments around it are explaining a situation that can't occur. The activateView
event of SolidView isn't triggered when switching to another view...
2020-04-20 13:52:40 +02:00
Remco Burema
b7e6b2888a
Actually remove xray error image (because colors).
part of CURA-7262
2020-04-07 12:57:07 +02:00
fieldOfView
ccc0589495 Remove the checkbox option to set the preference to hide the messagebox 2020-03-31 11:50:16 +02:00
fieldOfView
b7898b5a97 Change preference to only hide the xray message, not the visualization 2020-03-31 11:39:05 +02:00
fieldOfView
a2f9eac23b Remove unused import 2020-03-31 11:29:34 +02:00
fieldOfView
0794766644 Fix xray composite shader for opengl 2.1
textureSize() is not available in opengl 2.1, so we calculate the xray error image scale outside the shader (which is also a theoretical performance improvement because now the scale does not get computed over and over for each pixel)
2020-03-27 23:24:20 +01:00
Ghostkeeper
986284052d
Show warning on any invalid pixel, not just 10
Now that we have no noise any more we can do this.
Possibly cuts the processing time in half, too.

Contributes to issue CURA-7262.
2020-03-25 18:57:30 +01:00
Ghostkeeper
4c770587e2
Fix getting additional bytes from QImage
QImage's bytes are aligned to memory words per column of pixels. That means that one of these columns contains 99% valid image data, but with several bytes of unassigned noise at the end. How many of these padding bytes there are would depend on the image size, i.e. Cura's window size. In the end, the total number of bytes in the image ends up slightly more than w*h*3. As a result, Cura would crash because it couldn't reshape the image. Reshaping was completely unnecessary anyway, but this random noise was giving false positives also.
But how do you then get only the actual pixels from each column of data? We can't just go iterating over this array, as that would be an iteration of thousands of columns which is prohibitively slow in Python. No, we're going to do some Numpy magic. We're going to create a class that pretends to be a Numpy array. Give this class some data and say that this data has a certain pixel size but also a certain STRIDE LENGTH. This stride length can be the length of the actual pixel data. As a result when Numpy sees this object it will read out the data using these strides, all done efficiently within the C code of Numpy.

Framerate is fantastic on my computer. No problems at all. Pretty powerful computer though. But also a big 5k screen. Still no problem for Numpy. Seems to be decently efficient.

Took me quite a while to figure all of this out.

Contributes to issue CURA-7262.
2020-03-25 18:00:14 +01:00
Ghostkeeper
a4fbf3c613
Move X-ray set-up code into _checkSetup
That's what that function is meant for. It's executing essentially the same, since before it was executed right after the call to _checkSetup() and now it's at the end inside that function.

Contributes to issue CURA-7262.
2020-03-25 15:13:33 +01:00
Tim Kuipers
3919b1292e fix cooldown for xray warning 2020-02-27 20:39:19 +01:00
Tim Kuipers
42a1b02d4c use transparency in xray view and merge shader duplication 2020-02-27 20:29:58 +01:00
Tim Kuipers
890b6dc0b4 prevent false negative xray error for high overlap count 2020-02-27 20:03:35 +01:00
Tim Kuipers
5d90fd31d9 fix xray for high intersection count models
I don't understand why, but any deviation from this produces worse results
2020-02-27 18:42:27 +01:00
Tim Kuipers
b51b699715 fix old xray view
I don't understand why it only seems to work if I define u_color via [default]
andd why it doesn't work when I set it inside the shader itself.
2020-02-27 18:17:07 +01:00
Tim Kuipers
0e633a0dfa allow immediate change of preference for showing xray errors in solid view 2020-02-27 16:41:20 +01:00
Tim Kuipers
643b27e160 add xray error warning message 2020-02-27 16:41:20 +01:00
Tim Kuipers
b4c3703dc4 Check xray overlay for badness in model every 1.0 second 2020-02-27 16:41:20 +01:00
Tim Kuipers
01643f5fee remove outdated unused shader functions 2020-02-27 16:41:20 +01:00
Tim Kuipers
c16f677bf0 make a new xray error image
includes SVG source file
2020-02-27 16:41:20 +01:00
Tim Kuipers
28abf6ff8c fix xray error image scaling 2020-02-27 16:41:20 +01:00
Tim Kuipers
0f184219e6 use tiled image for xray error instead of a uniform color
temporarily use the cura logo as placeholder image
didn't correctly determine window size yet
2020-02-27 16:41:20 +01:00
Tim Kuipers
82b2f23689 make xray solid color depending on what it occludes 2020-02-27 16:41:20 +01:00
Tim Kuipers
1b2cc7f7a7 make xray error noise depend on background color 2020-02-27 16:41:20 +01:00
Tim Kuipers
4a8385e3e8 make xray counting color hardcoded value
Somewhere between the xray.shader and the xray_composite.shader the colors are stored as unsigned int.
Since we want to count the integer number of faces behind a pixel in the red channel, we simply use a color with an r value of 1/255.
2020-02-27 16:41:20 +01:00
Tim Kuipers
b515a0f744 make xray errors exhibit static noise and see-through 2020-02-27 16:41:20 +01:00
Tim Kuipers
fc4c66b62a show xray errors in solid view 2020-02-27 16:41:13 +01:00
Ghostkeeper
6f707f3149
Bump SDK version number of Cura 4.5 to 7.1
We've added new things to our API. This allows plug-in developers to use them.

Contributes to issue CURA-7205.
2020-02-10 10:45:07 +01:00
Jaime van Kessel
4ce086d5c3
Cut op beginRendering of solidView 2019-12-20 16:44:12 +01:00
Nino van Hooff
c62ff262ed Change SDK version to 7.0.0
CURA-6858
2019-10-21 14:51:34 +02:00
Jaime van Kessel
0ff9d72c4c
Remove use of deprecated extruders property 2019-09-13 17:27:16 +02:00
Remco Burema
e5a690e605 Wrap up 'lay flat by face' feature for 4.3-BETA.
Icon thanks to Yi-An Lai.
part of CURA-6754
2019-09-10 12:37:59 +02:00
Remco Burema
d9b10e7180 Merge branch 'feature_bottom_face' of https://github.com/Ultimaker/Cura into feature_bottom_face 2019-09-03 16:04:38 +02:00
Remco Burema
70332978fd Less cryptic max face-id.
part of CURA-6745
2019-09-03 15:48:31 +02:00
Lipu Fei
44db4216bc Rename to getEndFaceSelectionId()
CURA-6745
2019-09-03 15:44:43 +02:00
Remco Burema
503a24f7a1 Make magic value into funtion (max face-id).
part of CURA-6745
2019-09-03 15:08:41 +02:00
Remco Burema
b97015a354 Added 'align selected face with buildplate' feature.
Alt-click to select a face. See the (identically named) 'feature_bottom_face' branch in Uranium for more indepth information.
2019-09-02 00:17:14 +02:00
Lipu Fei
905889214a Fix typing 2019-04-23 10:31:13 +02:00
Lipu Fei
4423fc82b0 Fix typing 2019-04-23 09:39:46 +02:00
Jaime van Kessel
50ad4e4d4e Speed up the rendering of the solid view by caching support_angle property 2019-04-19 14:55:28 +02:00
Jaime van Kessel
d53bac6eb8 Simplify the expensive call to the validation state
Since the support angle needs to be between 0 and 90, we don't have to rely on the (expensive)
validator. We can just check that ourselves.
2019-02-19 15:42:51 +01:00
Lipu Fei
6992fd2991 Update plugin versions to match package versions
CURA-6019
2018-12-17 13:03:21 +01:00
Ghostkeeper
c235f339ae
Increment API version to 6
All plug-ins now have to re-check whether they are still compatible with the current version of Cura.

Contributes to issue CURA-6019.
2018-12-14 17:29:02 +01:00
Lipu Fei
620790ae3d Reduce the creations of ExtrudersModels
CURA-6015
2018-12-13 14:12:23 +01:00
Jaime van Kessel
d8dd9bf363 Set SolidView to invisible.
Since we don't have a selector in the prepare stage anymore, solidview must be invisible

CURA-5829
2018-10-29 14:54:42 +01:00
Aleksei S
fe9cada459 Increase plugin API version to 5
CURA-5627
2018-08-27 13:59:00 +02:00
Diego Prado Gesto
43657010ba CURA-5164 The Preferences is not a singleton class anymore since in some point
several instances need to be created.

- In the ThreeMFWorkspaceReader we need to create some temporal
instances of Preferences that makes it not singleton anymore.

- The current preferences are kept in the Application class and so all
the calls to the preferences are changed to get the preferences from
Application.

- The method getInstance in Preferences is kept as deprecated since some
external plugins.
2018-05-11 08:50:42 +02:00
Ghostkeeper
7d806e7ae9
Fix rendering before the extruder number decoration is set
If a render is triggered before this decorator is set it would crash. The rest of the code is robust against this being None, but here it would give a TypeError.
2018-04-11 11:59:54 +02:00
Jack Ha
bd775cf32e CURA-4400 fix support_extruder_nr values in overhang angle and SliceInfo 2018-03-19 10:56:40 +01:00