-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
PShape doesn't allow attibutes of int type anymore #344
Comments
Created by: benfry Thanks for the thorough report—I've tagged Andrés so he can weigh in as well. |
Created by: codeanticode Thanks for tagging me on this issue, most likely a regression after the updates in the PShape code, I will look at it asap. |
Created by: codeanticode @cacheflowe The cast error is fixed with this PR About why the setAttrib() methods are no longer accessible, the reason is discussed in the thread of issue #235. As part of the API updates you mentioned, I implemented the rest of all the setAttrib*() methods. However, we decided to keep all of this new API out of PShape, so you need to cast the result of getTessellation() as PShapeOpenGL in order to access all the setAttrib*() methods. Another important change to be noted is that getTessellation() now returns the stroked geometry (points and lines) as separate child shapes, if present in the original shape. So, if the original shape does not contain strokes, the returned PShape is a GEOMETRY PShapeOpenGL that you can manipulate directly. If lines or points are present in the original shape, then the returned PShape is a GROUP, with the first child the actually fill geometry, the second is the lines, and the third, the points. The following code demonstrates this:
I think the next step is to properly document the advanced PShape API :-) |
Created by: benfry #363 now incorporated for 4.0 beta 4. |
Created by: github-actions[bot] This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs. |
Created by: cacheflowe
As of Processing 4.0.b3, it seems that vertex attributes have changed a bit. And getTessellation() behavior has changed slightly.
One potential bug I'm seeing is an immediate crash if I've assigned an
int
value to an attrib and try to draw the shape. This crash is relieved if I cast the attribute value to a float likeshape.attrib("x", (float) x);
. It seems that int values should be allowed?Full example to crash is here:
Here's what the stack trace looks like in my local Eclipse setup:
Your Environment
Possible Causes / Solutions
I see some of the code around tessellation and attributes has changed. As a side note, I don't seem to be able to run
PShape.getTessellation()
on an svg/obj PShape and then add attributes anymore. I used to callgetTessellation()
and then useshape.setAttrib("key", vertIndex, value);
, butsetAttrib()
has been removed. This had previously seemed like the only way I could assign vertex attributes to svg/obj meshes. As of this new update I don't know if this is possible anymore - when I try to useshape.attrib()
on an svg/obj PShape, I get the following error, which seems to have something to do withinGeo
being null. It does look like the latest core updates have changed some code in this area:I hardly know anything about the inner workings here, but it would be cool to be able to add attributes to geometry that was loaded from an svg/obj again :-D
As another clue as to what's happening here, I can add attributes to a PShape just fine if it was created like so:
createShape(BOX, 100, 100, 100);
. However, an additional potentially new behavior there is an error if I try to callgetTessellation()
on that type of shape:Thank you core contributors for your work here. Obviously Ben and Andres have made heroic updates in recent weeks/months 🙏
The text was updated successfully, but these errors were encountered: