Skip to content

Commit

Permalink
Implement 3D layers (#840)
Browse files Browse the repository at this point in the history
* Implement 3D layers

* Remove unneeded files

* Fix bug where a single hidden layer would ignore all of the layers on top when exporting

* Fix pxo loading

* Remove junk nodes from 3DShapeEdit

Seems like they were created when I copied from the old 3D Options.tscn panel to the new 3D Shape Edit tool.

* Make light gizmos half the size, and hide gizmos when rotating

* Fix crash when using the 3D shape edit tool on a group layer

* Remove unneeded code in Canvas.gd

* Add torus in the Cel3DObject.Type enumerator

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.

* Toggle 3D object visibility

* Change texts and some variable names

* Fill translation strings

* Fix crash on group blending, and make the code in Export.blend_layers() more general

* Fix errors when attempting to draw on a 3D cel

Can occur when multiple cels are selected, some of them 3D and some of them pixel

* Make scene properties and objects be per-cel instead of per-layer

Breaks compatibility with previous .pxo files that had 3D layers. Also introduces serialize() and deserialize() methods to BaseCel

* Use if not layer is get_script() in GroupLayer.blend_children()

* Flip the condition in GroupLayer.blend_children()

* Fix bug where locked/invisible layers could get drawn

Regression from c2f6bf0

* Move gizmo code to 3DShapeEdit's draw_start(), move some undo/redo logic to 3DShapeEdit

* Move all of the undo/redo code to 3DShapeEdit, simplify code in Cel3D

* Store Cel3D image data to pxo, for easy usage by external software

This makes importing projects with 3D layers to other software, such as Godot using godot_pixelorama_importer easier.

* Make the linter happy

* Fix bug where the previously selected object would remain selected when it got removed with undo
  • Loading branch information
OverloadedOrama authored Mar 31, 2023
1 parent 5f290ae commit 91aea32
Show file tree
Hide file tree
Showing 42 changed files with 3,364 additions and 113 deletions.
187 changes: 186 additions & 1 deletion Translations/Translations.pot
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,10 @@ msgstr ""
msgid "Group layer:"
msgstr ""

#. A type of layer. A 3D layer contains data of 3D objects that are rasterized automatically by Pixelorama.
msgid "3D layer:"
msgstr ""

msgid "Direction:"
msgstr ""

Expand Down Expand Up @@ -1703,10 +1707,20 @@ msgstr ""
msgid "Layers"
msgstr ""

#. Hint tooltip of the create new layer button, found on the left side of the timeline.
msgid "Create a new layer"
msgstr ""

msgid "Create a new group layer"
#. One of the options of the create new layer button.
msgid "Add Pixel Layer"
msgstr ""

#. One of the options of the create new layer button.
msgid "Add Group Layer"
msgstr ""

#. One of the options of the create new layer button.
msgid "Add 3D Layer"
msgstr ""

msgid "Remove current layer"
Expand Down Expand Up @@ -2236,3 +2250,174 @@ msgid "Locked size\n\n"
"When enabled using the tool on the canvas will only move the cropping rectangle.\n\n"
"When disabled using the tool on the canvas will draw the rectangle."
msgstr ""

#. A tool used in 3D layers, that edits 3D objects.
msgid "3D Shape Edit"
msgstr ""

#. Used in 3D layers. A type of 3D object.
msgid "Box"
msgstr ""

#. Used in 3D layers. A type of 3D object.
msgid "Sphere"
msgstr ""

#. Used in 3D layers. A type of 3D object.
msgid "Capsule"
msgstr ""

#. Used in 3D layers. A type of 3D object.
msgid "Cylinder"
msgstr ""

#. Used in 3D layers. A type of 3D object.
msgid "Prism"
msgstr ""

#. Used in 3D layers. A type of 3D object.
msgid "Torus"
msgstr ""

#. Used in 3D layers. A type of 3D object.
msgid "Plane"
msgstr ""

#. Used in 3D layers. A type of light.
msgid "Directional light"
msgstr ""

#. Used in 3D layers. A type of light.
msgid "Spotlight"
msgstr ""

#. Used in 3D layers. A type of light.
msgid "Point light"
msgstr ""

#. Used in 3D layers. A type of 3D object.
msgid "Custom model"
msgstr ""

msgid "Selected object:"
msgstr ""

msgid "Add new object"
msgstr ""

msgid "Remove object"
msgstr ""

msgid "Camera"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool. Refers to camera projection mode.
msgid "Projection:"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool. One of the modes of camera projection.
msgid "Perspective"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool. One of the modes of camera projection.
msgid "Orthogonal"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool. One of the modes of camera projection.
msgid "Frustum"
msgstr ""

msgid "Rotation:"
msgstr ""

msgid "Scale:"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool.
msgid "Environment"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool, under the Environment category.
msgid "Ambient color:"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool, under the Environment category.
msgid "Ambient color energy:"
msgstr ""

msgid "Visible:"
msgstr ""

#. Refers to the transformation options of an object, such as its position, rotation and scale. For technical details, see https://docs.godotengine.org/en/stable/tutorials/math/matrices_and_transforms.html
msgid "Transform"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool. A category with mesh-related options.
msgid "Mesh"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool, under the Mesh category if a Prism is selected. Refers to the displacement of the upper edge along the X axis.
msgid "Left to right:"
msgstr ""

#. Radius of a circle/spherical object.
msgid "Radius:"
msgstr ""

msgid "Height:"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool, under the Mesh category if a spherical object is selected.
msgid "Radial segments:"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool, under the Mesh category if a spherical object is selected. Refers to the number of segments along the height of the sphere.
msgid "Rings:"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool, under the Mesh category if a Sphere is selected. If true, a hemisphere is created rather than a full sphere.
msgid "Is hemisphere:"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool, under the Mesh category if a Cylinder is selected.
msgid "Top radius:"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool, under the Mesh category if a Cylinder is selected.
msgid "Bottom radius:"
msgstr ""

msgid "Text:"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool, under the Mesh category if a Text object is selected. Refers to the size of one pixel's width on the text to scale it in 3D.
msgid "Pixel size:"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool, under the Mesh category if a Text object is selected. Step (in pixels) used to approximate Bézier curves.
msgid "Curve step:"
msgstr ""

msgid "Horizontal alignment:"
msgstr ""

msgid "Left"
msgstr ""

msgid "Right"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool, under the Light category if a light is selected. Refers to the energy of the light. The more energy, the brighter it shines.
msgid "Energy:"
msgstr ""

#. Found in the tool options of the 3D Shape Edit tool, under the Light category if a light is selected. If true, the light's effect is reversed, darkening areas and casting bright shadows.
msgid "Negative:"
msgstr ""

msgid "Shadow:"
msgstr ""

#. Refers to the range of something, like the range of a spotlight.
msgid "Range:"
msgstr ""
1 change: 1 addition & 0 deletions assets/graphics/gizmos/directional_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/graphics/gizmos/directional_light.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/directional_light.svg-093cdb9a72dee590271da014181a4680.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/graphics/gizmos/directional_light.svg"
dest_files=[ "res://.import/directional_light.svg-093cdb9a72dee590271da014181a4680.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
1 change: 1 addition & 0 deletions assets/graphics/gizmos/omni_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/graphics/gizmos/omni_light.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/omni_light.svg-b0faa945d45257c6c9fecd256ed51eee.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/graphics/gizmos/omni_light.svg"
dest_files=[ "res://.import/omni_light.svg-b0faa945d45257c6c9fecd256ed51eee.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
1 change: 1 addition & 0 deletions assets/graphics/gizmos/spot_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/graphics/gizmos/spot_light.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/spot_light.svg-d309a6f5345413a6c8b9afd3cfe72f29.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/graphics/gizmos/spot_light.svg"
dest_files=[ "res://.import/spot_light.svg-d309a6f5345413a6c8b9afd3cfe72f29.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
Binary file added assets/graphics/tools/3dshapeedit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/graphics/tools/3dshapeedit.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/3dshapeedit.png-2d2aa73fafc7df7f7df84b5c0db6c1a6.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/graphics/tools/3dshapeedit.png"
dest_files=[ "res://.import/3dshapeedit.png-2d2aa73fafc7df7f7df84b5c0db6c1a6.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
Binary file added assets/graphics/tools/cursors/3dshapeedit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/graphics/tools/cursors/3dshapeedit.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/3dshapeedit.png-cca253df77476289c578814dc8af5d80.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/graphics/tools/cursors/3dshapeedit.png"
dest_files=[ "res://.import/3dshapeedit.png-cca253df77476289c578814dc8af5d80.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
Loading

0 comments on commit 91aea32

Please sign in to comment.