Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
New properties
Added a few properties to rect layers. This is what a fully expanded rect layer looks like:
Fill & Stroke
The "Stroke Width" and "Border Radius" properties are just regular numbers so there's nothing of note to talk about there. However, the new "Fill" and "Stroke Color" properties are of a new "color type".
When clicked, the new Color Picker is opened. It is considered to be a "custom context menu" (see #23).
Currently it only allows for RGB colors. Transparency is currently not supported but will be pretty easy to add in the future.
When changes have been made, the enter key can be pressed to submit the changes.
These new properties are reflected in the Composition Workspace. They are reflected in realtime when inside of the Color Picker.
Anchor X and Y properties
These properties currently don't do anything. The behavior will be tackled later.
Color Nodes
Three new nodes were added.
color_input
color_to_rgba_factors
color_from_rgba_factors
You can see these in action here:
There are some obvious low-hanging-fruit omissions here.
And then some less obvious omissions.
These will be saved for future updates.
Type changes
Added
Color
toValueType
enum.CompositionProperty
has been updated to allow for multiple types of properties (e.g.number
,Vec2
andRGBAColor
).The new
PropertyToValueMap
type sets the raw and computed values to theunknown
types, forcing assertions where used.RGB vs RGBA
To clarify, all color properties are stored as
RGBAColor
. The current RGB-only aspect of the Color Picker is just to get this out quickly. The alpha channel will be added to the color picker.Property Performance Optimizations
Currently in
CompTimeLayer
, thepropertyToValue
object is always a new object on every action state change. This results in a LOT of unnecessary renders.The creation of the
propertyToValue
map is now done byCompTimeLayerPropertyToValue
. It is a wrapper component around property related components.It takes care of creating
propertyToValue
, and it exposes it to its children via context. TheCompTimePropertyValueContext
was created for this purpose.And the
CompTimeProperty
component no longer accesses thepropertyToValue
map. Instead, it rendersCompTimePropertyValue
which looks like so:In this new structure, every
CompTimePropertyValue
component will render on every action state update (that affectspropertyToValue
). It fetchespropertyToValue
from the context and gets the value of the property from it. We check the value type and pass it to the appropriate value component.