Merge pull request #71037 from reduz/array-format-bitfield

Use BitField<> hint for Mesh.ArrayFormat and Control.SizeFlags
This commit is contained in:
Rémi Verschelde 2023-01-08 22:51:03 +01:00
commit 378d589e2d
No known key found for this signature in database
GPG key ID: C3336907360768E1
29 changed files with 200 additions and 200 deletions

View file

@ -65,7 +65,7 @@
<param index="1" name="arrays" type="Array" />
<param index="2" name="blend_shapes" type="Array[]" default="[]" />
<param index="3" name="lods" type="Dictionary" default="{}" />
<param index="4" name="compress_flags" type="int" default="0" />
<param index="4" name="compress_flags" type="int" enum="Mesh.ArrayFormat" default="0" />
<description>
Creates a new surface.
Surfaces are created to be rendered using a [param primitive], which may be any of the types defined in [enum Mesh.PrimitiveType]. (As a note, when using indices, it is recommended to only use points, lines, or triangles.) [method Mesh.get_surface_count] will become the [code]surf_idx[/code] for this new surface.
@ -141,7 +141,7 @@
</description>
</method>
<method name="surface_get_format" qualifiers="const">
<return type="int" />
<return type="int" enum="Mesh.ArrayFormat" />
<param index="0" name="surf_idx" type="int" />
<description>
Returns the format mask of the requested surface (see [method add_surface_from_arrays]).

View file

@ -1064,13 +1064,13 @@
<member name="size" type="Vector2" setter="_set_size" getter="get_size" default="Vector2(0, 0)">
The size of the node's bounding rectangle, in pixels. [Container] nodes update this property automatically.
</member>
<member name="size_flags_horizontal" type="int" setter="set_h_size_flags" getter="get_h_size_flags" default="1">
<member name="size_flags_horizontal" type="int" setter="set_h_size_flags" getter="get_h_size_flags" enum="Control.SizeFlags" default="1">
Tells the parent [Container] nodes how they should resize and place the node on the X axis. Use one of the [enum SizeFlags] constants to change the flags. See the constants to learn what each does.
</member>
<member name="size_flags_stretch_ratio" type="float" setter="set_stretch_ratio" getter="get_stretch_ratio" default="1.0">
If the node and at least one of its neighbors uses the [constant SIZE_EXPAND] size flag, the parent [Container] will let it take more or less space depending on this property. If this node has a stretch ratio of 2 and its neighbor a ratio of 1, this node will take two thirds of the available space.
</member>
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" default="1">
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" enum="Control.SizeFlags" default="1">
Tells the parent [Container] nodes how they should resize and place the node on the Y axis. Use one of the [enum SizeFlags] constants to change the flags. See the constants to learn what each does.
</member>
<member name="theme" type="Theme" setter="set_theme" getter="get_theme">
@ -1315,23 +1315,23 @@
<constant name="PRESET_MODE_KEEP_SIZE" value="3" enum="LayoutPresetMode">
The control's size will not change.
</constant>
<constant name="SIZE_SHRINK_BEGIN" value="0" enum="SizeFlags">
<constant name="SIZE_SHRINK_BEGIN" value="0" enum="SizeFlags" is_bitfield="true">
Tells the parent [Container] to align the node with its start, either the top or the left edge. It is mutually exclusive with [constant SIZE_FILL] and other shrink size flags, but can be used with [constant SIZE_EXPAND] in some containers. Use with [member size_flags_horizontal] and [member size_flags_vertical].
[b]Note:[/b] Setting this flag is equal to not having any size flags.
</constant>
<constant name="SIZE_FILL" value="1" enum="SizeFlags">
<constant name="SIZE_FILL" value="1" enum="SizeFlags" is_bitfield="true">
Tells the parent [Container] to expand the bounds of this node to fill all the available space without pushing any other node. It is mutually exclusive with shrink size flags. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
<constant name="SIZE_EXPAND" value="2" enum="SizeFlags">
<constant name="SIZE_EXPAND" value="2" enum="SizeFlags" is_bitfield="true">
Tells the parent [Container] to let this node take all the available space on the axis you flag. If multiple neighboring nodes are set to expand, they'll share the space based on their stretch ratio. See [member size_flags_stretch_ratio]. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
<constant name="SIZE_EXPAND_FILL" value="3" enum="SizeFlags">
<constant name="SIZE_EXPAND_FILL" value="3" enum="SizeFlags" is_bitfield="true">
Sets the node's size flags to both fill and expand. See [constant SIZE_FILL] and [constant SIZE_EXPAND] for more information.
</constant>
<constant name="SIZE_SHRINK_CENTER" value="4" enum="SizeFlags">
<constant name="SIZE_SHRINK_CENTER" value="4" enum="SizeFlags" is_bitfield="true">
Tells the parent [Container] to center the node in the available space. It is mutually exclusive with [constant SIZE_FILL] and other shrink size flags, but can be used with [constant SIZE_EXPAND] in some containers. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
<constant name="SIZE_SHRINK_END" value="8" enum="SizeFlags">
<constant name="SIZE_SHRINK_END" value="8" enum="SizeFlags" is_bitfield="true">
Tells the parent [Container] to align the node with its end, either the bottom or the right edge. It is mutually exclusive with [constant SIZE_FILL] and other shrink size flags, but can be used with [constant SIZE_EXPAND] in some containers. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
<constant name="MOUSE_FILTER_STOP" value="0" enum="MouseFilter">

View file

@ -22,7 +22,7 @@
<member name="read_only" type="bool" setter="set_read_only" getter="is_read_only" default="false">
If [code]true[/code], the slider can't be interacted with.
</member>
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" overrides="Control" default="1" />
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" overrides="Control" enum="Control.SizeFlags" default="1" />
<member name="step" type="float" setter="set_step" getter="get_step" overrides="Range" default="1.0" />
<member name="suffix" type="String" setter="set_suffix" getter="get_suffix" default="&quot;&quot;">
The suffix to display after the value (in a faded color). This should generally be a plural word. You may have to use an abbreviation if the suffix is too long to be displayed.

View file

@ -62,7 +62,7 @@
Limits the lines of text the node shows on screen.
</member>
<member name="mouse_filter" type="int" setter="set_mouse_filter" getter="get_mouse_filter" overrides="Control" enum="Control.MouseFilter" default="2" />
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" overrides="Control" default="4" />
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" overrides="Control" enum="Control.SizeFlags" default="4" />
<member name="structured_text_bidi_override" type="int" setter="set_structured_text_bidi_override" getter="get_structured_text_bidi_override" enum="TextServer.StructuredTextParser" default="0">
Set BiDi algorithm override for the structured text.
</member>

View file

@ -266,79 +266,79 @@
<constant name="ARRAY_CUSTOM_MAX" value="8" enum="ArrayCustomFormat">
Represents the size of the [enum ArrayCustomFormat] enum.
</constant>
<constant name="ARRAY_FORMAT_VERTEX" value="1" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_VERTEX" value="1" enum="ArrayFormat" is_bitfield="true">
Mesh array contains vertices. All meshes require a vertex array so this should always be present.
</constant>
<constant name="ARRAY_FORMAT_NORMAL" value="2" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_NORMAL" value="2" enum="ArrayFormat" is_bitfield="true">
Mesh array contains normals.
</constant>
<constant name="ARRAY_FORMAT_TANGENT" value="4" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_TANGENT" value="4" enum="ArrayFormat" is_bitfield="true">
Mesh array contains tangents.
</constant>
<constant name="ARRAY_FORMAT_COLOR" value="8" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_COLOR" value="8" enum="ArrayFormat" is_bitfield="true">
Mesh array contains colors.
</constant>
<constant name="ARRAY_FORMAT_TEX_UV" value="16" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_TEX_UV" value="16" enum="ArrayFormat" is_bitfield="true">
Mesh array contains UVs.
</constant>
<constant name="ARRAY_FORMAT_TEX_UV2" value="32" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_TEX_UV2" value="32" enum="ArrayFormat" is_bitfield="true">
Mesh array contains second UV.
</constant>
<constant name="ARRAY_FORMAT_CUSTOM0" value="64" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM0" value="64" enum="ArrayFormat" is_bitfield="true">
Mesh array contains custom channel index 0.
</constant>
<constant name="ARRAY_FORMAT_CUSTOM1" value="128" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM1" value="128" enum="ArrayFormat" is_bitfield="true">
Mesh array contains custom channel index 1.
</constant>
<constant name="ARRAY_FORMAT_CUSTOM2" value="256" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM2" value="256" enum="ArrayFormat" is_bitfield="true">
Mesh array contains custom channel index 2.
</constant>
<constant name="ARRAY_FORMAT_CUSTOM3" value="512" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM3" value="512" enum="ArrayFormat" is_bitfield="true">
Mesh array contains custom channel index 3.
</constant>
<constant name="ARRAY_FORMAT_BONES" value="1024" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_BONES" value="1024" enum="ArrayFormat" is_bitfield="true">
Mesh array contains bones.
</constant>
<constant name="ARRAY_FORMAT_WEIGHTS" value="2048" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_WEIGHTS" value="2048" enum="ArrayFormat" is_bitfield="true">
Mesh array contains bone weights.
</constant>
<constant name="ARRAY_FORMAT_INDEX" value="4096" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_INDEX" value="4096" enum="ArrayFormat" is_bitfield="true">
Mesh array uses indices.
</constant>
<constant name="ARRAY_FORMAT_BLEND_SHAPE_MASK" value="7" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_BLEND_SHAPE_MASK" value="7" enum="ArrayFormat" is_bitfield="true">
Mask of mesh channels permitted in blend shapes.
</constant>
<constant name="ARRAY_FORMAT_CUSTOM_BASE" value="13" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM_BASE" value="13" enum="ArrayFormat" is_bitfield="true">
Shift of first custom channel.
</constant>
<constant name="ARRAY_FORMAT_CUSTOM_BITS" value="3" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM_BITS" value="3" enum="ArrayFormat" is_bitfield="true">
Number of format bits per custom channel. See [enum ArrayCustomFormat].
</constant>
<constant name="ARRAY_FORMAT_CUSTOM0_SHIFT" value="13" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM0_SHIFT" value="13" enum="ArrayFormat" is_bitfield="true">
Amount to shift [enum ArrayCustomFormat] for custom channel index 0.
</constant>
<constant name="ARRAY_FORMAT_CUSTOM1_SHIFT" value="16" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM1_SHIFT" value="16" enum="ArrayFormat" is_bitfield="true">
Amount to shift [enum ArrayCustomFormat] for custom channel index 1.
</constant>
<constant name="ARRAY_FORMAT_CUSTOM2_SHIFT" value="19" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM2_SHIFT" value="19" enum="ArrayFormat" is_bitfield="true">
Amount to shift [enum ArrayCustomFormat] for custom channel index 2.
</constant>
<constant name="ARRAY_FORMAT_CUSTOM3_SHIFT" value="22" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM3_SHIFT" value="22" enum="ArrayFormat" is_bitfield="true">
Amount to shift [enum ArrayCustomFormat] for custom channel index 3.
</constant>
<constant name="ARRAY_FORMAT_CUSTOM_MASK" value="7" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM_MASK" value="7" enum="ArrayFormat" is_bitfield="true">
Mask of custom format bits per custom channel. Must be shifted by one of the SHIFT constants. See [enum ArrayCustomFormat].
</constant>
<constant name="ARRAY_COMPRESS_FLAGS_BASE" value="25" enum="ArrayFormat">
<constant name="ARRAY_COMPRESS_FLAGS_BASE" value="25" enum="ArrayFormat" is_bitfield="true">
Shift of first compress flag. Compress flags should be passed to [method ArrayMesh.add_surface_from_arrays] and [method SurfaceTool.commit].
</constant>
<constant name="ARRAY_FLAG_USE_2D_VERTICES" value="33554432" enum="ArrayFormat">
<constant name="ARRAY_FLAG_USE_2D_VERTICES" value="33554432" enum="ArrayFormat" is_bitfield="true">
Flag used to mark that the array contains 2D vertices.
</constant>
<constant name="ARRAY_FLAG_USE_DYNAMIC_UPDATE" value="67108864" enum="ArrayFormat">
<constant name="ARRAY_FLAG_USE_DYNAMIC_UPDATE" value="67108864" enum="ArrayFormat" is_bitfield="true">
Flag indices that the mesh data will use [code]GL_DYNAMIC_DRAW[/code] on GLES. Unused on Vulkan.
</constant>
<constant name="ARRAY_FLAG_USE_8_BONE_WEIGHTS" value="134217728" enum="ArrayFormat">
<constant name="ARRAY_FLAG_USE_8_BONE_WEIGHTS" value="134217728" enum="ArrayFormat" is_bitfield="true">
Flag used to mark that the mesh contains up to 8 bone influences per vertex. This flag indicates that [constant ARRAY_BONES] and [constant ARRAY_WEIGHTS] elements will have double length.
</constant>
<constant name="BLEND_SHAPE_MODE_NORMALIZED" value="0" enum="BlendShapeMode">

View file

@ -62,7 +62,7 @@
<member name="rounded" type="bool" setter="set_use_rounded_values" getter="is_using_rounded_values" default="false">
If [code]true[/code], [code]value[/code] will always be rounded to the nearest integer.
</member>
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" overrides="Control" default="0" />
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" overrides="Control" enum="Control.SizeFlags" default="0" />
<member name="step" type="float" setter="set_step" getter="get_step" default="0.01">
If greater than 0, [code]value[/code] will always be rounded to a multiple of [code]step[/code]. If [code]rounded[/code] is also [code]true[/code], [code]value[/code] will first be rounded to a multiple of [code]step[/code] then rounded to the nearest integer.
</member>

View file

@ -1930,7 +1930,7 @@
<param index="2" name="arrays" type="Array" />
<param index="3" name="blend_shapes" type="Array" default="[]" />
<param index="4" name="lods" type="Dictionary" default="{}" />
<param index="5" name="compress_format" type="int" default="0" />
<param index="5" name="compress_format" type="int" enum="RenderingServer.ArrayFormat" default="0" />
<description>
</description>
</method>
@ -2032,14 +2032,14 @@
</method>
<method name="mesh_surface_get_format_attribute_stride" qualifiers="const">
<return type="int" />
<param index="0" name="format" type="int" />
<param index="0" name="format" type="int" enum="RenderingServer.ArrayFormat" />
<param index="1" name="vertex_count" type="int" />
<description>
</description>
</method>
<method name="mesh_surface_get_format_offset" qualifiers="const">
<return type="int" />
<param index="0" name="format" type="int" />
<param index="0" name="format" type="int" enum="RenderingServer.ArrayFormat" />
<param index="1" name="vertex_count" type="int" />
<param index="2" name="array_index" type="int" />
<description>
@ -2047,14 +2047,14 @@
</method>
<method name="mesh_surface_get_format_skin_stride" qualifiers="const">
<return type="int" />
<param index="0" name="format" type="int" />
<param index="0" name="format" type="int" enum="RenderingServer.ArrayFormat" />
<param index="1" name="vertex_count" type="int" />
<description>
</description>
</method>
<method name="mesh_surface_get_format_vertex_stride" qualifiers="const">
<return type="int" />
<param index="0" name="format" type="int" />
<param index="0" name="format" type="int" enum="RenderingServer.ArrayFormat" />
<param index="1" name="vertex_count" type="int" />
<description>
</description>
@ -3745,65 +3745,65 @@
</constant>
<constant name="ARRAY_CUSTOM_MAX" value="8" enum="ArrayCustomFormat">
</constant>
<constant name="ARRAY_FORMAT_VERTEX" value="1" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_VERTEX" value="1" enum="ArrayFormat" is_bitfield="true">
Flag used to mark a vertex array.
</constant>
<constant name="ARRAY_FORMAT_NORMAL" value="2" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_NORMAL" value="2" enum="ArrayFormat" is_bitfield="true">
Flag used to mark a normal array.
</constant>
<constant name="ARRAY_FORMAT_TANGENT" value="4" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_TANGENT" value="4" enum="ArrayFormat" is_bitfield="true">
Flag used to mark a tangent array.
</constant>
<constant name="ARRAY_FORMAT_COLOR" value="8" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_COLOR" value="8" enum="ArrayFormat" is_bitfield="true">
Flag used to mark a color array.
</constant>
<constant name="ARRAY_FORMAT_TEX_UV" value="16" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_TEX_UV" value="16" enum="ArrayFormat" is_bitfield="true">
Flag used to mark an UV coordinates array.
</constant>
<constant name="ARRAY_FORMAT_TEX_UV2" value="32" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_TEX_UV2" value="32" enum="ArrayFormat" is_bitfield="true">
Flag used to mark an UV coordinates array for the second UV coordinates.
</constant>
<constant name="ARRAY_FORMAT_CUSTOM0" value="64" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM0" value="64" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="ARRAY_FORMAT_CUSTOM1" value="128" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM1" value="128" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="ARRAY_FORMAT_CUSTOM2" value="256" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM2" value="256" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="ARRAY_FORMAT_CUSTOM3" value="512" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM3" value="512" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="ARRAY_FORMAT_BONES" value="1024" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_BONES" value="1024" enum="ArrayFormat" is_bitfield="true">
Flag used to mark a bone information array.
</constant>
<constant name="ARRAY_FORMAT_WEIGHTS" value="2048" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_WEIGHTS" value="2048" enum="ArrayFormat" is_bitfield="true">
Flag used to mark a weights array.
</constant>
<constant name="ARRAY_FORMAT_INDEX" value="4096" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_INDEX" value="4096" enum="ArrayFormat" is_bitfield="true">
Flag used to mark an index array.
</constant>
<constant name="ARRAY_FORMAT_BLEND_SHAPE_MASK" value="7" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_BLEND_SHAPE_MASK" value="7" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="ARRAY_FORMAT_CUSTOM_BASE" value="13" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM_BASE" value="13" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="ARRAY_FORMAT_CUSTOM_BITS" value="3" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM_BITS" value="3" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="ARRAY_FORMAT_CUSTOM0_SHIFT" value="13" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM0_SHIFT" value="13" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="ARRAY_FORMAT_CUSTOM1_SHIFT" value="16" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM1_SHIFT" value="16" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="ARRAY_FORMAT_CUSTOM2_SHIFT" value="19" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM2_SHIFT" value="19" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="ARRAY_FORMAT_CUSTOM3_SHIFT" value="22" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM3_SHIFT" value="22" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="ARRAY_FORMAT_CUSTOM_MASK" value="7" enum="ArrayFormat">
<constant name="ARRAY_FORMAT_CUSTOM_MASK" value="7" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="ARRAY_COMPRESS_FLAGS_BASE" value="25" enum="ArrayFormat">
<constant name="ARRAY_COMPRESS_FLAGS_BASE" value="25" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="ARRAY_FLAG_USE_2D_VERTICES" value="33554432" enum="ArrayFormat">
<constant name="ARRAY_FLAG_USE_2D_VERTICES" value="33554432" enum="ArrayFormat" is_bitfield="true">
Flag used to mark that the array contains 2D vertices.
</constant>
<constant name="ARRAY_FLAG_USE_DYNAMIC_UPDATE" value="67108864" enum="ArrayFormat">
<constant name="ARRAY_FLAG_USE_DYNAMIC_UPDATE" value="67108864" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="ARRAY_FLAG_USE_8_BONE_WEIGHTS" value="134217728" enum="ArrayFormat">
<constant name="ARRAY_FLAG_USE_8_BONE_WEIGHTS" value="134217728" enum="ArrayFormat" is_bitfield="true">
</constant>
<constant name="PRIMITIVE_POINTS" value="0" enum="PrimitiveType">
Primitive to draw consists of points.

View file

@ -60,7 +60,7 @@
<member name="select_all_on_focus" type="bool" setter="set_select_all_on_focus" getter="is_select_all_on_focus" default="false">
If [code]true[/code], the [SpinBox] will select the whole text when the [LineEdit] gains focus. Clicking the up and down arrows won't trigger this behavior.
</member>
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" overrides="Control" default="1" />
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" overrides="Control" enum="Control.SizeFlags" default="1" />
<member name="step" type="float" setter="set_step" getter="get_step" overrides="Range" default="1.0" />
<member name="suffix" type="String" setter="set_suffix" getter="get_suffix" default="&quot;&quot;">
Adds the specified [code]suffix[/code] string after the numerical value of the [SpinBox].

View file

@ -43,7 +43,7 @@
<member name="radial_initial_angle" type="float" setter="set_radial_initial_angle" getter="get_radial_initial_angle" default="0.0">
Starting angle for the fill of [member texture_progress] if [member fill_mode] is [constant FILL_CLOCKWISE] or [constant FILL_COUNTER_CLOCKWISE]. When the node's [code]value[/code] is equal to its [code]min_value[/code], the texture doesn't show up at all. When the [code]value[/code] increases, the texture fills and tends towards [member radial_fill_degrees].
</member>
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" overrides="Control" default="1" />
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" overrides="Control" enum="Control.SizeFlags" default="1" />
<member name="step" type="float" setter="set_step" getter="get_step" overrides="Range" default="1.0" />
<member name="stretch_margin_bottom" type="int" setter="set_stretch_margin" getter="get_stretch_margin" default="0">
The height of the 9-patch's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.

View file

@ -9,8 +9,8 @@
<tutorials>
</tutorials>
<members>
<member name="size_flags_horizontal" type="int" setter="set_h_size_flags" getter="get_h_size_flags" overrides="Control" default="0" />
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" overrides="Control" default="1" />
<member name="size_flags_horizontal" type="int" setter="set_h_size_flags" getter="get_h_size_flags" overrides="Control" enum="Control.SizeFlags" default="0" />
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" overrides="Control" enum="Control.SizeFlags" default="1" />
</members>
<theme_items>
<theme_item name="decrement" data_type="icon" type="Texture2D">

View file

@ -10,8 +10,8 @@
<tutorials>
</tutorials>
<members>
<member name="size_flags_horizontal" type="int" setter="set_h_size_flags" getter="get_h_size_flags" overrides="Control" default="0" />
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" overrides="Control" default="1" />
<member name="size_flags_horizontal" type="int" setter="set_h_size_flags" getter="get_h_size_flags" overrides="Control" enum="Control.SizeFlags" default="0" />
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" overrides="Control" enum="Control.SizeFlags" default="1" />
</members>
<theme_items>
<theme_item name="grabber_offset" data_type="constant" type="int" default="0">

View file

@ -356,19 +356,19 @@ namespace GodotTools.Build
{
base._Ready();
SizeFlagsVertical = (int)SizeFlags.ExpandFill;
SizeFlagsVertical = SizeFlags.ExpandFill;
var hsc = new HSplitContainer
{
SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
SizeFlagsVertical = (int)SizeFlags.ExpandFill
SizeFlagsHorizontal = SizeFlags.ExpandFill,
SizeFlagsVertical = SizeFlags.ExpandFill
};
AddChild(hsc);
_issuesList = new ItemList
{
SizeFlagsVertical = (int)SizeFlags.ExpandFill,
SizeFlagsHorizontal = (int)SizeFlags.ExpandFill // Avoid being squashed by the build log
SizeFlagsVertical = SizeFlags.ExpandFill,
SizeFlagsHorizontal = SizeFlags.ExpandFill // Avoid being squashed by the build log
};
_issuesList.ItemActivated += IssueActivated;
_issuesList.AllowRmbSelect = true;
@ -382,8 +382,8 @@ namespace GodotTools.Build
_buildLog = new TextEdit
{
Editable = false,
SizeFlagsVertical = (int)SizeFlags.ExpandFill,
SizeFlagsHorizontal = (int)SizeFlags.ExpandFill // Avoid being squashed by the issues list
SizeFlagsVertical = SizeFlags.ExpandFill,
SizeFlagsHorizontal = SizeFlags.ExpandFill // Avoid being squashed by the issues list
};
hsc.AddChild(_buildLog);

View file

@ -123,9 +123,9 @@ namespace GodotTools.Build
base._Ready();
CustomMinimumSize = new Vector2i(0, (int)(228 * EditorScale));
SizeFlagsVertical = (int)SizeFlags.ExpandFill;
SizeFlagsVertical = SizeFlags.ExpandFill;
var toolBarHBox = new HBoxContainer { SizeFlagsHorizontal = (int)SizeFlags.ExpandFill };
var toolBarHBox = new HBoxContainer { SizeFlagsHorizontal = SizeFlags.ExpandFill };
AddChild(toolBarHBox);
_buildMenuBtn = new MenuButton { Text = "Build", Icon = GetThemeIcon("Play", "EditorIcons") };

View file

@ -68,12 +68,12 @@ void BoxContainer::_resort() {
if (vertical) { /* VERTICAL */
stretch_min += size.height;
msc.min_size = size.height;
msc.will_stretch = c->get_v_size_flags() & SIZE_EXPAND;
msc.will_stretch = c->get_v_size_flags().has_flag(SIZE_EXPAND);
} else { /* HORIZONTAL */
stretch_min += size.width;
msc.min_size = size.width;
msc.will_stretch = c->get_h_size_flags() & SIZE_EXPAND;
msc.will_stretch = c->get_h_size_flags().has_flag(SIZE_EXPAND);
}
if (msc.will_stretch) {

View file

@ -104,22 +104,22 @@ void Container::fit_child_in_rect(Control *p_child, const Rect2 &p_rect) {
Size2 minsize = p_child->get_combined_minimum_size();
Rect2 r = p_rect;
if (!(p_child->get_h_size_flags() & SIZE_FILL)) {
if (!(p_child->get_h_size_flags().has_flag(SIZE_FILL))) {
r.size.x = minsize.width;
if (p_child->get_h_size_flags() & SIZE_SHRINK_END) {
if (p_child->get_h_size_flags().has_flag(SIZE_SHRINK_END)) {
r.position.x += rtl ? 0 : (p_rect.size.width - minsize.width);
} else if (p_child->get_h_size_flags() & SIZE_SHRINK_CENTER) {
} else if (p_child->get_h_size_flags().has_flag(SIZE_SHRINK_CENTER)) {
r.position.x += Math::floor((p_rect.size.x - minsize.width) / 2);
} else {
r.position.x += rtl ? (p_rect.size.width - minsize.width) : 0;
}
}
if (!(p_child->get_v_size_flags() & SIZE_FILL)) {
if (!(p_child->get_v_size_flags().has_flag(SIZE_FILL))) {
r.size.y = minsize.y;
if (p_child->get_v_size_flags() & SIZE_SHRINK_END) {
if (p_child->get_v_size_flags().has_flag(SIZE_SHRINK_END)) {
r.position.y += p_rect.size.height - minsize.height;
} else if (p_child->get_v_size_flags() & SIZE_SHRINK_CENTER) {
} else if (p_child->get_v_size_flags().has_flag(SIZE_SHRINK_CENTER)) {
r.position.y += Math::floor((p_rect.size.y - minsize.height) / 2);
} else {
r.position.y += 0;

View file

@ -1684,27 +1684,27 @@ void Control::_clear_size_warning() {
// Container sizing.
void Control::set_h_size_flags(int p_flags) {
if (data.h_size_flags == p_flags) {
void Control::set_h_size_flags(BitField<SizeFlags> p_flags) {
if ((int)data.h_size_flags == (int)p_flags) {
return;
}
data.h_size_flags = p_flags;
emit_signal(SceneStringNames::get_singleton()->size_flags_changed);
}
int Control::get_h_size_flags() const {
BitField<Control::SizeFlags> Control::get_h_size_flags() const {
return data.h_size_flags;
}
void Control::set_v_size_flags(int p_flags) {
if (data.v_size_flags == p_flags) {
void Control::set_v_size_flags(BitField<SizeFlags> p_flags) {
if ((int)data.v_size_flags == (int)p_flags) {
return;
}
data.v_size_flags = p_flags;
emit_signal(SceneStringNames::get_singleton()->size_flags_changed);
}
int Control::get_v_size_flags() const {
BitField<Control::SizeFlags> Control::get_v_size_flags() const {
return data.v_size_flags;
}
@ -3326,12 +3326,12 @@ void Control::_bind_methods() {
BIND_ENUM_CONSTANT(PRESET_MODE_KEEP_HEIGHT);
BIND_ENUM_CONSTANT(PRESET_MODE_KEEP_SIZE);
BIND_ENUM_CONSTANT(SIZE_SHRINK_BEGIN);
BIND_ENUM_CONSTANT(SIZE_FILL);
BIND_ENUM_CONSTANT(SIZE_EXPAND);
BIND_ENUM_CONSTANT(SIZE_EXPAND_FILL);
BIND_ENUM_CONSTANT(SIZE_SHRINK_CENTER);
BIND_ENUM_CONSTANT(SIZE_SHRINK_END);
BIND_BITFIELD_FLAG(SIZE_SHRINK_BEGIN);
BIND_BITFIELD_FLAG(SIZE_FILL);
BIND_BITFIELD_FLAG(SIZE_EXPAND);
BIND_BITFIELD_FLAG(SIZE_EXPAND_FILL);
BIND_BITFIELD_FLAG(SIZE_SHRINK_CENTER);
BIND_BITFIELD_FLAG(SIZE_SHRINK_END);
BIND_ENUM_CONSTANT(MOUSE_FILTER_STOP);
BIND_ENUM_CONSTANT(MOUSE_FILTER_PASS);

View file

@ -198,8 +198,8 @@ private:
// Container sizing.
int h_size_flags = SIZE_FILL;
int v_size_flags = SIZE_FILL;
BitField<SizeFlags> h_size_flags = SIZE_FILL;
BitField<SizeFlags> v_size_flags = SIZE_FILL;
real_t expand = 1.0;
Point2 custom_minimum_size;
@ -471,10 +471,10 @@ public:
// Container sizing.
void set_h_size_flags(int p_flags);
int get_h_size_flags() const;
void set_v_size_flags(int p_flags);
int get_v_size_flags() const;
void set_h_size_flags(BitField<SizeFlags> p_flags);
BitField<SizeFlags> get_h_size_flags() const;
void set_v_size_flags(BitField<SizeFlags> p_flags);
BitField<SizeFlags> get_v_size_flags() const;
void set_stretch_ratio(real_t p_ratio);
real_t get_stretch_ratio() const;
@ -619,7 +619,7 @@ public:
};
VARIANT_ENUM_CAST(Control::FocusMode);
VARIANT_ENUM_CAST(Control::SizeFlags);
VARIANT_BITFIELD_CAST(Control::SizeFlags);
VARIANT_ENUM_CAST(Control::CursorShape);
VARIANT_ENUM_CAST(Control::LayoutPreset);
VARIANT_ENUM_CAST(Control::LayoutPresetMode);

View file

@ -86,7 +86,7 @@ void FlowContainer::_resort() {
}
line_height = MAX(line_height, child_msc.x);
if (child->get_v_size_flags() & SIZE_EXPAND) {
if (child->get_v_size_flags().has_flag(SIZE_EXPAND)) {
line_stretch_ratio_total += child->get_stretch_ratio();
}
ofs.y += child_msc.y;
@ -108,7 +108,7 @@ void FlowContainer::_resort() {
}
line_height = MAX(line_height, child_msc.y);
if (child->get_h_size_flags() & SIZE_EXPAND) {
if (child->get_h_size_flags().has_flag(SIZE_EXPAND)) {
line_stretch_ratio_total += child->get_stretch_ratio();
}
ofs.x += child_msc.x;
@ -175,21 +175,21 @@ void FlowContainer::_resort() {
}
if (vertical) { /* VERTICAL */
if (child->get_h_size_flags() & (SIZE_FILL | SIZE_SHRINK_CENTER | SIZE_SHRINK_END)) {
if (child->get_h_size_flags().has_flag(SIZE_FILL) || child->get_h_size_flags().has_flag(SIZE_SHRINK_CENTER) || child->get_h_size_flags().has_flag(SIZE_SHRINK_END)) {
child_size.width = line_data.min_line_height;
}
if (child->get_v_size_flags() & SIZE_EXPAND) {
if (child->get_v_size_flags().has_flag(SIZE_EXPAND)) {
int stretch = line_data.stretch_avail * child->get_stretch_ratio() / line_data.stretch_ratio_total;
child_size.height += stretch;
}
} else { /* HORIZONTAL */
if (child->get_v_size_flags() & (SIZE_FILL | SIZE_SHRINK_CENTER | SIZE_SHRINK_END)) {
if (child->get_v_size_flags().has_flag(SIZE_FILL) || child->get_v_size_flags().has_flag(SIZE_SHRINK_CENTER) || child->get_v_size_flags().has_flag(SIZE_SHRINK_END)) {
child_size.height = line_data.min_line_height;
}
if (child->get_h_size_flags() & SIZE_EXPAND) {
if (child->get_h_size_flags().has_flag(SIZE_EXPAND)) {
int stretch = line_data.stretch_avail * child->get_stretch_ratio() / line_data.stretch_ratio_total;
child_size.width += stretch;
}

View file

@ -174,7 +174,7 @@ void GraphNode::_resort() {
stretch_min += size.height;
msc.min_size = size.height;
msc.will_stretch = c->get_v_size_flags() & SIZE_EXPAND;
msc.will_stretch = c->get_v_size_flags().has_flag(SIZE_EXPAND);
if (msc.will_stretch) {
stretch_avail += msc.min_size;

View file

@ -73,10 +73,10 @@ void GridContainer::_notification(int p_what) {
row_minh[row] = ms.height;
}
if (c->get_h_size_flags() & SIZE_EXPAND) {
if (c->get_h_size_flags().has_flag(SIZE_EXPAND)) {
col_expanded.insert(col);
}
if (c->get_v_size_flags() & SIZE_EXPAND) {
if (c->get_v_size_flags().has_flag(SIZE_EXPAND)) {
row_expanded.insert(row);
}
}

View file

@ -327,10 +327,10 @@ void ScrollContainer::_reposition_children() {
Size2 minsize = c->get_combined_minimum_size();
Rect2 r = Rect2(-Size2(get_h_scroll(), get_v_scroll()), minsize);
if (c->get_h_size_flags() & SIZE_EXPAND) {
if (c->get_h_size_flags().has_flag(SIZE_EXPAND)) {
r.size.width = MAX(size.width, minsize.width);
}
if (c->get_v_size_flags() & SIZE_EXPAND) {
if (c->get_v_size_flags().has_flag(SIZE_EXPAND)) {
r.size.height = MAX(size.height, minsize.height);
}
r.position += ofs;

View file

@ -346,7 +346,7 @@ TypedArray<Array> ImmediateMesh::surface_get_blend_shape_arrays(int p_surface) c
Dictionary ImmediateMesh::surface_get_lods(int p_surface) const {
return Dictionary();
}
uint32_t ImmediateMesh::surface_get_format(int p_idx) const {
BitField<Mesh::ArrayFormat> ImmediateMesh::surface_get_format(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, int(surfaces.size()), 0);
return surfaces[p_idx].format;
}

View file

@ -99,7 +99,7 @@ public:
virtual Array surface_get_arrays(int p_surface) const override;
virtual TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const override;
virtual Dictionary surface_get_lods(int p_surface) const override;
virtual uint32_t surface_get_format(int p_idx) const override;
virtual BitField<ArrayFormat> surface_get_format(int p_idx) const override;
virtual PrimitiveType surface_get_primitive_type(int p_idx) const override;
virtual void surface_set_material(int p_idx, const Ref<Material> &p_material) override;
virtual Ref<Material> surface_get_material(int p_idx) const override;

View file

@ -75,7 +75,7 @@ Dictionary Mesh::surface_get_lods(int p_surface) const {
return ret;
}
uint32_t Mesh::surface_get_format(int p_idx) const {
BitField<Mesh::ArrayFormat> Mesh::surface_get_format(int p_idx) const {
uint32_t ret = 0;
GDVIRTUAL_REQUIRED_CALL(_surface_get_format, p_idx, ret);
return ret;
@ -658,35 +658,35 @@ void Mesh::_bind_methods() {
BIND_ENUM_CONSTANT(ARRAY_CUSTOM_RGBA_FLOAT);
BIND_ENUM_CONSTANT(ARRAY_CUSTOM_MAX);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_VERTEX);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_NORMAL);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_TANGENT);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_COLOR);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_TEX_UV);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_TEX_UV2);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM0);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM1);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM2);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM3);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_BONES);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_WEIGHTS);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_INDEX);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_VERTEX);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_NORMAL);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_TANGENT);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_COLOR);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_TEX_UV);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_TEX_UV2);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM0);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM1);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM2);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM3);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_BONES);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_WEIGHTS);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_INDEX);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_BLEND_SHAPE_MASK);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_BLEND_SHAPE_MASK);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM_BASE);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM_BITS);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM0_SHIFT);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM1_SHIFT);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM2_SHIFT);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM3_SHIFT);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM_BASE);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM_BITS);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM0_SHIFT);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM1_SHIFT);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM2_SHIFT);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM3_SHIFT);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM_MASK);
BIND_ENUM_CONSTANT(ARRAY_COMPRESS_FLAGS_BASE);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM_MASK);
BIND_BITFIELD_FLAG(ARRAY_COMPRESS_FLAGS_BASE);
BIND_ENUM_CONSTANT(ARRAY_FLAG_USE_2D_VERTICES);
BIND_ENUM_CONSTANT(ARRAY_FLAG_USE_DYNAMIC_UPDATE);
BIND_ENUM_CONSTANT(ARRAY_FLAG_USE_8_BONE_WEIGHTS);
BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_2D_VERTICES);
BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_DYNAMIC_UPDATE);
BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_8_BONE_WEIGHTS);
BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_NORMALIZED);
BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_RELATIVE);
@ -1554,7 +1554,7 @@ void ArrayMesh::_recompute_aabb() {
}
// TODO: Need to add binding to add_surface using future MeshSurfaceData object.
void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, const Vector<uint8_t> &p_attribute_array, const Vector<uint8_t> &p_skin_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<uint8_t> &p_blend_shape_data, const Vector<AABB> &p_bone_aabbs, const Vector<RS::SurfaceData::LOD> &p_lods) {
void ArrayMesh::add_surface(BitField<ArrayFormat> p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, const Vector<uint8_t> &p_attribute_array, const Vector<uint8_t> &p_skin_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<uint8_t> &p_blend_shape_data, const Vector<AABB> &p_bone_aabbs, const Vector<RS::SurfaceData::LOD> &p_lods) {
_create_if_empty();
Surface s;
@ -1589,7 +1589,7 @@ void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const
emit_changed();
}
void ArrayMesh::add_surface_from_arrays(PrimitiveType p_primitive, const Array &p_arrays, const TypedArray<Array> &p_blend_shapes, const Dictionary &p_lods, uint32_t p_flags) {
void ArrayMesh::add_surface_from_arrays(PrimitiveType p_primitive, const Array &p_arrays, const TypedArray<Array> &p_blend_shapes, const Dictionary &p_lods, BitField<ArrayFormat> p_flags) {
ERR_FAIL_COND(p_arrays.size() != ARRAY_MAX);
RS::SurfaceData surface;
@ -1705,7 +1705,7 @@ int ArrayMesh::surface_get_array_index_len(int p_idx) const {
return surfaces[p_idx].index_array_length;
}
uint32_t ArrayMesh::surface_get_format(int p_idx) const {
BitField<Mesh::ArrayFormat> ArrayMesh::surface_get_format(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, surfaces.size(), 0);
return surfaces[p_idx].format;
}

View file

@ -156,7 +156,7 @@ public:
virtual Array surface_get_arrays(int p_surface) const;
virtual TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const;
virtual Dictionary surface_get_lods(int p_surface) const;
virtual uint32_t surface_get_format(int p_idx) const;
virtual BitField<ArrayFormat> surface_get_format(int p_idx) const;
virtual PrimitiveType surface_get_primitive_type(int p_idx) const;
virtual void surface_set_material(int p_idx, const Ref<Material> &p_material);
virtual Ref<Material> surface_get_material(int p_idx) const;
@ -269,9 +269,9 @@ protected:
static void _bind_methods();
public:
void add_surface_from_arrays(PrimitiveType p_primitive, const Array &p_arrays, const TypedArray<Array> &p_blend_shapes = TypedArray<Array>(), const Dictionary &p_lods = Dictionary(), uint32_t p_flags = 0);
void add_surface_from_arrays(PrimitiveType p_primitive, const Array &p_arrays, const TypedArray<Array> &p_blend_shapes = TypedArray<Array>(), const Dictionary &p_lods = Dictionary(), BitField<ArrayFormat> p_flags = 0);
void add_surface(uint32_t p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, const Vector<uint8_t> &p_attribute_array, const Vector<uint8_t> &p_skin_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<uint8_t> &p_blend_shape_data = Vector<uint8_t>(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>(), const Vector<RS::SurfaceData::LOD> &p_lods = Vector<RS::SurfaceData::LOD>());
void add_surface(BitField<ArrayFormat> p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, const Vector<uint8_t> &p_attribute_array, const Vector<uint8_t> &p_skin_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<uint8_t> &p_blend_shape_data = Vector<uint8_t>(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>(), const Vector<RS::SurfaceData::LOD> &p_lods = Vector<RS::SurfaceData::LOD>());
Array surface_get_arrays(int p_surface) const override;
TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const override;
@ -298,7 +298,7 @@ public:
int surface_get_array_len(int p_idx) const override;
int surface_get_array_index_len(int p_idx) const override;
uint32_t surface_get_format(int p_idx) const override;
BitField<ArrayFormat> surface_get_format(int p_idx) const override;
PrimitiveType surface_get_primitive_type(int p_idx) const override;
virtual void surface_set_material(int p_idx, const Ref<Material> &p_material) override;
@ -330,7 +330,7 @@ public:
};
VARIANT_ENUM_CAST(Mesh::ArrayType);
VARIANT_ENUM_CAST(Mesh::ArrayFormat);
VARIANT_BITFIELD_CAST(Mesh::ArrayFormat);
VARIANT_ENUM_CAST(Mesh::ArrayCustomFormat);
VARIANT_ENUM_CAST(Mesh::PrimitiveType);
VARIANT_ENUM_CAST(Mesh::BlendShapeMode);
@ -351,7 +351,7 @@ public:
virtual Array surface_get_arrays(int p_surface) const override { return Array(); }
virtual TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const override { return TypedArray<Array>(); }
virtual Dictionary surface_get_lods(int p_surface) const override { return Dictionary(); }
virtual uint32_t surface_get_format(int p_idx) const override { return 0; }
virtual BitField<ArrayFormat> surface_get_format(int p_idx) const override { return 0; }
virtual PrimitiveType surface_get_primitive_type(int p_idx) const override { return PRIMITIVE_TRIANGLES; }
virtual void surface_set_material(int p_idx, const Ref<Material> &p_material) override {}
virtual Ref<Material> surface_get_material(int p_idx) const override { return Ref<Material>(); }

View file

@ -180,7 +180,7 @@ TypedArray<Array> PrimitiveMesh::surface_get_blend_shape_arrays(int p_surface) c
return TypedArray<Array>(); //not really supported
}
uint32_t PrimitiveMesh::surface_get_format(int p_idx) const {
BitField<Mesh::ArrayFormat> PrimitiveMesh::surface_get_format(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, 1, 0);
uint32_t mesh_format = RS::ARRAY_FORMAT_VERTEX | RS::ARRAY_FORMAT_NORMAL | RS::ARRAY_FORMAT_TANGENT | RS::ARRAY_FORMAT_TEX_UV | RS::ARRAY_FORMAT_INDEX;

View file

@ -84,7 +84,7 @@ public:
virtual Array surface_get_arrays(int p_surface) const override;
virtual TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const override;
virtual Dictionary surface_get_lods(int p_surface) const override;
virtual uint32_t surface_get_format(int p_idx) const override;
virtual BitField<ArrayFormat> surface_get_format(int p_idx) const override;
virtual Mesh::PrimitiveType surface_get_primitive_type(int p_idx) const override;
virtual void surface_set_material(int p_idx, const Ref<Material> &p_material) override;
virtual Ref<Material> surface_get_material(int p_idx) const override;

View file

@ -700,9 +700,9 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint
return OK;
}
uint32_t RenderingServer::mesh_surface_get_format_offset(uint32_t p_format, int p_vertex_len, int p_array_index) const {
uint32_t RenderingServer::mesh_surface_get_format_offset(BitField<ArrayFormat> p_format, int p_vertex_len, int p_array_index) const {
ERR_FAIL_INDEX_V(p_array_index, ARRAY_MAX, 0);
p_format &= ~ARRAY_FORMAT_INDEX;
p_format = int64_t(p_format) & ~ARRAY_FORMAT_INDEX;
uint32_t offsets[ARRAY_MAX];
uint32_t vstr;
uint32_t astr;
@ -711,8 +711,8 @@ uint32_t RenderingServer::mesh_surface_get_format_offset(uint32_t p_format, int
return offsets[p_array_index];
}
uint32_t RenderingServer::mesh_surface_get_format_vertex_stride(uint32_t p_format, int p_vertex_len) const {
p_format &= ~ARRAY_FORMAT_INDEX;
uint32_t RenderingServer::mesh_surface_get_format_vertex_stride(BitField<ArrayFormat> p_format, int p_vertex_len) const {
p_format = int64_t(p_format) & ~ARRAY_FORMAT_INDEX;
uint32_t offsets[ARRAY_MAX];
uint32_t vstr;
uint32_t astr;
@ -720,8 +720,8 @@ uint32_t RenderingServer::mesh_surface_get_format_vertex_stride(uint32_t p_forma
mesh_surface_make_offsets_from_format(p_format, p_vertex_len, 0, offsets, vstr, astr, sstr);
return vstr;
}
uint32_t RenderingServer::mesh_surface_get_format_attribute_stride(uint32_t p_format, int p_vertex_len) const {
p_format &= ~ARRAY_FORMAT_INDEX;
uint32_t RenderingServer::mesh_surface_get_format_attribute_stride(BitField<ArrayFormat> p_format, int p_vertex_len) const {
p_format = int64_t(p_format) & ~ARRAY_FORMAT_INDEX;
uint32_t offsets[ARRAY_MAX];
uint32_t vstr;
uint32_t astr;
@ -729,8 +729,8 @@ uint32_t RenderingServer::mesh_surface_get_format_attribute_stride(uint32_t p_fo
mesh_surface_make_offsets_from_format(p_format, p_vertex_len, 0, offsets, vstr, astr, sstr);
return astr;
}
uint32_t RenderingServer::mesh_surface_get_format_skin_stride(uint32_t p_format, int p_vertex_len) const {
p_format &= ~ARRAY_FORMAT_INDEX;
uint32_t RenderingServer::mesh_surface_get_format_skin_stride(BitField<ArrayFormat> p_format, int p_vertex_len) const {
p_format = int64_t(p_format) & ~ARRAY_FORMAT_INDEX;
uint32_t offsets[ARRAY_MAX];
uint32_t vstr;
uint32_t astr;
@ -1049,7 +1049,7 @@ Error RenderingServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surfa
return OK;
}
void RenderingServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes, const Dictionary &p_lods, uint32_t p_compress_format) {
void RenderingServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes, const Dictionary &p_lods, BitField<ArrayFormat> p_compress_format) {
SurfaceData sd;
Error err = mesh_create_surface_data_from_arrays(&sd, p_primitive, p_arrays, p_blend_shapes, p_lods, p_compress_format);
if (err != OK) {
@ -1797,35 +1797,35 @@ void RenderingServer::_bind_methods() {
BIND_ENUM_CONSTANT(ARRAY_CUSTOM_RGBA_FLOAT);
BIND_ENUM_CONSTANT(ARRAY_CUSTOM_MAX);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_VERTEX);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_NORMAL);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_TANGENT);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_COLOR);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_TEX_UV);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_TEX_UV2);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM0);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM1);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM2);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM3);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_BONES);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_WEIGHTS);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_INDEX);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_VERTEX);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_NORMAL);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_TANGENT);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_COLOR);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_TEX_UV);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_TEX_UV2);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM0);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM1);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM2);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM3);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_BONES);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_WEIGHTS);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_INDEX);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_BLEND_SHAPE_MASK);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_BLEND_SHAPE_MASK);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM_BASE);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM_BITS);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM0_SHIFT);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM1_SHIFT);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM2_SHIFT);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM3_SHIFT);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM_BASE);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM_BITS);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM0_SHIFT);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM1_SHIFT);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM2_SHIFT);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM3_SHIFT);
BIND_ENUM_CONSTANT(ARRAY_FORMAT_CUSTOM_MASK);
BIND_ENUM_CONSTANT(ARRAY_COMPRESS_FLAGS_BASE);
BIND_BITFIELD_FLAG(ARRAY_FORMAT_CUSTOM_MASK);
BIND_BITFIELD_FLAG(ARRAY_COMPRESS_FLAGS_BASE);
BIND_ENUM_CONSTANT(ARRAY_FLAG_USE_2D_VERTICES);
BIND_ENUM_CONSTANT(ARRAY_FLAG_USE_DYNAMIC_UPDATE);
BIND_ENUM_CONSTANT(ARRAY_FLAG_USE_8_BONE_WEIGHTS);
BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_2D_VERTICES);
BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_DYNAMIC_UPDATE);
BIND_BITFIELD_FLAG(ARRAY_FLAG_USE_8_BONE_WEIGHTS);
BIND_ENUM_CONSTANT(PRIMITIVE_POINTS);
BIND_ENUM_CONSTANT(PRIMITIVE_LINES);

View file

@ -320,10 +320,10 @@ public:
virtual void mesh_set_blend_shape_count(RID p_mesh, int p_blend_shape_count) = 0;
virtual uint32_t mesh_surface_get_format_offset(uint32_t p_format, int p_vertex_len, int p_array_index) const;
virtual uint32_t mesh_surface_get_format_vertex_stride(uint32_t p_format, int p_vertex_len) const;
virtual uint32_t mesh_surface_get_format_attribute_stride(uint32_t p_format, int p_vertex_len) const;
virtual uint32_t mesh_surface_get_format_skin_stride(uint32_t p_format, int p_vertex_len) const;
virtual uint32_t mesh_surface_get_format_offset(BitField<ArrayFormat> p_format, int p_vertex_len, int p_array_index) const;
virtual uint32_t mesh_surface_get_format_vertex_stride(BitField<ArrayFormat> p_format, int p_vertex_len) const;
virtual uint32_t mesh_surface_get_format_attribute_stride(BitField<ArrayFormat> p_format, int p_vertex_len) const;
virtual uint32_t mesh_surface_get_format_skin_stride(BitField<ArrayFormat> p_format, int p_vertex_len) const;
/// Returns stride
virtual void mesh_surface_make_offsets_from_format(uint32_t p_format, int p_vertex_len, int p_index_len, uint32_t *r_offsets, uint32_t &r_vertex_element_size, uint32_t &r_attrib_element_size, uint32_t &r_skin_element_size) const;
@ -333,7 +333,7 @@ public:
TypedArray<Array> mesh_surface_get_blend_shape_arrays(RID p_mesh, int p_surface) const;
Dictionary mesh_surface_get_lods(RID p_mesh, int p_surface) const;
virtual void mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes = Array(), const Dictionary &p_lods = Dictionary(), uint32_t p_compress_format = 0);
virtual void mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes = Array(), const Dictionary &p_lods = Dictionary(), BitField<ArrayFormat> p_compress_format = 0);
virtual void mesh_add_surface(RID p_mesh, const SurfaceData &p_surface) = 0;
virtual int mesh_get_blend_shape_count(RID p_mesh) const = 0;
@ -1610,7 +1610,7 @@ VARIANT_ENUM_CAST(RenderingServer::TextureLayeredType);
VARIANT_ENUM_CAST(RenderingServer::CubeMapLayer);
VARIANT_ENUM_CAST(RenderingServer::ShaderMode);
VARIANT_ENUM_CAST(RenderingServer::ArrayType);
VARIANT_ENUM_CAST(RenderingServer::ArrayFormat);
VARIANT_BITFIELD_CAST(RenderingServer::ArrayFormat);
VARIANT_ENUM_CAST(RenderingServer::ArrayCustomFormat);
VARIANT_ENUM_CAST(RenderingServer::PrimitiveType);
VARIANT_ENUM_CAST(RenderingServer::BlendShapeMode);