-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
Implement 3D layers #840
Implement 3D layers #840
Conversation
… top when exporting
Seems like they were created when I copied from the old 3D Options.tscn panel to the new 3D Shape Edit tool.
Torus isn't currently supported in Godot 3.5, but it is in 3.6 and 4.0, so this is just future-proofing. May break compatibility with .pxo files that were exported with 3D layers before this change.
@@ -387,6 +387,8 @@ func blend_layers( | |||
layer_image.copy_from(frame.cels[export_layers - 2].image) | |||
elif layer is GroupLayer: | |||
layer_image.copy_from(layer.blend_children(frame, Vector2.ZERO)) | |||
elif layer is Layer3D: | |||
layer_image.copy_from(frame.cels[export_layers - 2].get_image()) |
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.
I think this part could probably be:
if layer is GroupLayer:
layer_image.copy_from(layer.blend_children(frame, Vector2.ZERO))
else:
layer_image.copy_from(frame.cels[export_layers - 2].get_image())
right?
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.
Right, I changed it.
src/Classes/GroupLayer.gd
Outdated
@@ -18,10 +18,10 @@ func blend_children(frame: Frame, origin := Vector2.ZERO) -> Image: | |||
for layer in children: | |||
if not layer.is_visible_in_hierarchy(): | |||
continue | |||
if layer is PixelLayer: | |||
var cel: PixelCel = frame.cels[layer.index] | |||
if layer is PixelLayer or layer is Layer3D: |
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.
Something like if not layer is GroupLayer
might be nicer to make it not need every other layer type, but I guess it doesn't work because of the comment "Only if layer is GroupLayer, cannot define this due to cyclic reference error" on the else below. Does doing if not layer is get_script()
work? If it does I guess the condition should be flipped to not have not
in front
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.
Yup, it seems to be working. I changed it.
Can occur when multiple cels are selected, some of them 3D and some of them pixel
Breaks compatibility with previous .pxo files that had 3D layers. Also introduces serialize() and deserialize() methods to BaseCel
Regression from c2f6bf0
…gic to 3DShapeEdit
This makes importing projects with 3D layers to other software, such as Godot using godot_pixelorama_importer easier.
…en it got removed with undo
Bringing the power of Godot's 3D engine into Pixelorama. Introducing a new layer type, 3D layers! 3D layers allow for the usage of 3D objects into Pixelorama, in 2D space. They get automatically pixelated, depending on the size of the canvas. Artists can now use a variety of 3D shapes, including boxes, spheres, capsules, cylinders, prisms and even 3D text! It is also possible to import custom .obj models (thanks to gd-obj). For lighting, you can use directional lights, spotlights and point lights.
Current features include:
This PR also makes the following changes:
To-do:
Future improvements outside the scope of this PR:
(The above image is a sphere object, illuminated by a directional light. I merged it into a pixel layer, and applied a Gradient Map with constant interpolation on it to achieve this effect. Not the best workflow at the moment, but it will improve tremendously when Layers FX are implemented.)