diff --git a/core/doc_data.cpp b/core/doc_data.cpp index 2d909f5335ea..7549ba884ea4 100644 --- a/core/doc_data.cpp +++ b/core/doc_data.cpp @@ -51,6 +51,7 @@ void DocData::return_doc_from_retinfo(DocData::MethodDoc &p_method, const Proper if (p_method.return_enum.begins_with("_")) { //proxy class p_method.return_enum = p_method.return_enum.substr(1, p_method.return_enum.length()); } + p_method.return_is_bitfield = p_retinfo.usage & PROPERTY_USAGE_CLASS_IS_BITFIELD; p_method.return_type = "int"; } else if (p_retinfo.class_name != StringName()) { p_method.return_type = p_retinfo.class_name; @@ -82,6 +83,7 @@ void DocData::argument_doc_from_arginfo(DocData::ArgumentDoc &p_argument, const if (p_argument.enumeration.begins_with("_")) { //proxy class p_argument.enumeration = p_argument.enumeration.substr(1, p_argument.enumeration.length()); } + p_argument.is_bitfield = p_arginfo.usage & PROPERTY_USAGE_CLASS_IS_BITFIELD; p_argument.type = "int"; } else if (p_arginfo.class_name != StringName()) { p_argument.type = p_arginfo.class_name; diff --git a/core/doc_data.h b/core/doc_data.h index fc184c411cc1..0fe7414b9890 100644 --- a/core/doc_data.h +++ b/core/doc_data.h @@ -50,6 +50,7 @@ public: String name; String type; String enumeration; + bool is_bitfield = false; String default_value; bool operator<(const ArgumentDoc &p_arg) const { if (name == p_arg.name) { @@ -70,6 +71,9 @@ public: if (p_dict.has("enumeration")) { doc.enumeration = p_dict["enumeration"]; + if (p_dict.has("is_bitfield")) { + doc.is_bitfield = p_dict["is_bitfield"]; + } } if (p_dict.has("default_value")) { @@ -91,6 +95,7 @@ public: if (!p_doc.enumeration.is_empty()) { dict["enumeration"] = p_doc.enumeration; + dict["is_bitfield"] = p_doc.is_bitfield; } if (!p_doc.default_value.is_empty()) { @@ -105,6 +110,7 @@ public: String name; String return_type; String return_enum; + bool return_is_bitfield = false; String qualifiers; String description; bool is_deprecated = false; @@ -152,6 +158,9 @@ public: if (p_dict.has("return_enum")) { doc.return_enum = p_dict["return_enum"]; + if (p_dict.has("return_is_bitfield")) { + doc.return_is_bitfield = p_dict["return_is_bitfield"]; + } } if (p_dict.has("qualifiers")) { @@ -201,6 +210,7 @@ public: if (!p_doc.return_enum.is_empty()) { dict["return_enum"] = p_doc.return_enum; + dict["return_is_bitfield"] = p_doc.return_is_bitfield; } if (!p_doc.qualifiers.is_empty()) { @@ -264,10 +274,9 @@ public: if (p_dict.has("enumeration")) { doc.enumeration = p_dict["enumeration"]; - } - - if (p_dict.has("is_bitfield")) { - doc.is_bitfield = p_dict["is_bitfield"]; + if (p_dict.has("is_bitfield")) { + doc.is_bitfield = p_dict["is_bitfield"]; + } } if (p_dict.has("description")) { @@ -299,10 +308,9 @@ public: if (!p_doc.enumeration.is_empty()) { dict["enumeration"] = p_doc.enumeration; + dict["is_bitfield"] = p_doc.is_bitfield; } - dict["is_bitfield"] = p_doc.is_bitfield; - if (!p_doc.description.is_empty()) { dict["description"] = p_doc.description; } @@ -319,6 +327,7 @@ public: String name; String type; String enumeration; + bool is_bitfield = false; String description; String setter, getter; String default_value; @@ -342,6 +351,9 @@ public: if (p_dict.has("enumeration")) { doc.enumeration = p_dict["enumeration"]; + if (p_dict.has("is_bitfield")) { + doc.is_bitfield = p_dict["is_bitfield"]; + } } if (p_dict.has("description")) { @@ -391,6 +403,7 @@ public: if (!p_doc.enumeration.is_empty()) { dict["enumeration"] = p_doc.enumeration; + dict["is_bitfield"] = p_doc.is_bitfield; } if (!p_doc.description.is_empty()) { diff --git a/core/io/ip.cpp b/core/io/ip.cpp index 65728f34f6d4..772f700916c8 100644 --- a/core/io/ip.cpp +++ b/core/io/ip.cpp @@ -35,8 +35,6 @@ #include "core/templates/hash_map.h" #include "core/variant/typed_array.h" -VARIANT_ENUM_CAST(IP::ResolverStatus); - /************* RESOLVER ******************/ struct _IP_ResolverPrivate { diff --git a/core/io/ip.h b/core/io/ip.h index b768f0b9d479..4816d59ac2df 100644 --- a/core/io/ip.h +++ b/core/io/ip.h @@ -109,5 +109,6 @@ public: }; VARIANT_ENUM_CAST(IP::Type); +VARIANT_ENUM_CAST(IP::ResolverStatus); #endif // IP_H diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp index 5c0a017bfc9b..958734addf7e 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -34,8 +34,6 @@ //#define DEBUG_XML -VARIANT_ENUM_CAST(XMLParser::NodeType); - static inline bool _is_white_space(char c) { return (c == ' ' || c == '\t' || c == '\n' || c == '\r'); } diff --git a/core/io/xml_parser.h b/core/io/xml_parser.h index b96478c7a579..77df99a881b4 100644 --- a/core/io/xml_parser.h +++ b/core/io/xml_parser.h @@ -126,4 +126,6 @@ public: ~XMLParser(); }; +VARIANT_ENUM_CAST(XMLParser::NodeType); + #endif // XML_PARSER_H diff --git a/core/os/time.cpp b/core/os/time.cpp index 038e4adc0364..bad5cc2e4fa2 100644 --- a/core/os/time.cpp +++ b/core/os/time.cpp @@ -52,9 +52,6 @@ static const uint8_t MONTH_DAYS_TABLE[2][12] = { { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } }; -VARIANT_ENUM_CAST(Month); -VARIANT_ENUM_CAST(Weekday); - #define UNIX_TIME_TO_HMS \ uint8_t hour, minute, second; \ { \ diff --git a/core/os/time.h b/core/os/time.h index 19bc900aeecf..ccd2d92b8b28 100644 --- a/core/os/time.h +++ b/core/os/time.h @@ -81,4 +81,7 @@ public: virtual ~Time(); }; +VARIANT_ENUM_CAST(Month); +VARIANT_ENUM_CAST(Weekday); + #endif // TIME_H diff --git a/doc/class.xsd b/doc/class.xsd index d29d053006dc..83880ed5f951 100644 --- a/doc/class.xsd +++ b/doc/class.xsd @@ -33,6 +33,7 @@ + @@ -44,6 +45,7 @@ + @@ -69,6 +71,7 @@ + @@ -88,6 +91,7 @@ + @@ -115,6 +119,7 @@ + @@ -182,6 +187,7 @@ + @@ -193,6 +199,7 @@ + @@ -236,6 +243,7 @@ + @@ -247,6 +255,7 @@ + diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml index 91b333ae899a..6d2b05e72912 100644 --- a/doc/classes/ArrayMesh.xml +++ b/doc/classes/ArrayMesh.xml @@ -65,7 +65,7 @@ - + Creates a new surface. [method Mesh.get_surface_count] will become the [code]surf_idx[/code] for this new surface. Surfaces are created to be rendered using a [param primitive], which may be any of the values defined in [enum Mesh.PrimitiveType]. @@ -145,7 +145,7 @@ - + Returns the format mask of the requested surface (see [method add_surface_from_arrays]). diff --git a/doc/classes/BaseButton.xml b/doc/classes/BaseButton.xml index 1290bfc0f2ca..cc95c97e6806 100644 --- a/doc/classes/BaseButton.xml +++ b/doc/classes/BaseButton.xml @@ -51,7 +51,7 @@ The [ButtonGroup] associated with the button. Not to be confused with node groups. [b]Note:[/b] The button will be configured as a radio button if a [ButtonGroup] is assigned to it. - + Binary mask to choose which mouse buttons this button will respond to. To allow both left-click and right-click, use [code]MOUSE_BUTTON_MASK_LEFT | MOUSE_BUTTON_MASK_RIGHT[/code]. diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index cb1036718311..ba280ab0fa50 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -193,8 +193,8 @@ - - + + @@ -212,8 +212,8 @@ - - + + @@ -309,7 +309,7 @@ - + @@ -346,7 +346,7 @@ - + diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index e0dd0eb9a865..e20651b1ee95 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -1028,13 +1028,13 @@ The size of the node's bounding rectangle, in the node's coordinate system. [Container] nodes update this property automatically. - + Tells the parent [Container] nodes how they should resize and place the node on the X axis. Use a combination of the [enum SizeFlags] constants to change the flags. See the constants to learn what each does. 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. - + Tells the parent [Container] nodes how they should resize and place the node on the Y axis. Use a combination of the [enum SizeFlags] constants to change the flags. See the constants to learn what each does. diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index cd39543c4530..52121e5c5fd0 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -807,7 +807,7 @@ - + Returns the current state of mouse buttons (whether each button is pressed) as a bitmask. If multiple mouse buttons are pressed at the same time, the bits are added together. Equivalent to [method Input.get_mouse_button_mask]. diff --git a/doc/classes/EditorInspectorPlugin.xml b/doc/classes/EditorInspectorPlugin.xml index f6bd0ee844ca..340e22c46a3d 100644 --- a/doc/classes/EditorInspectorPlugin.xml +++ b/doc/classes/EditorInspectorPlugin.xml @@ -60,7 +60,7 @@ - + Called to allow adding property-specific editors to the property list for [param object]. The added editor control must extend [EditorProperty]. Returning [code]true[/code] removes the built-in editor for this property, otherwise allows to insert a custom editor before the built-in one. diff --git a/doc/classes/EditorSpinSlider.xml b/doc/classes/EditorSpinSlider.xml index 9ef778f7b64a..045a1796dd37 100644 --- a/doc/classes/EditorSpinSlider.xml +++ b/doc/classes/EditorSpinSlider.xml @@ -22,7 +22,7 @@ If [code]true[/code], the slider can't be interacted with. - + 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. diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml index 57c31bebb553..5d34e38b1377 100644 --- a/doc/classes/Font.xml +++ b/doc/classes/Font.xml @@ -44,8 +44,8 @@ - - + + @@ -64,8 +64,8 @@ - - + + @@ -82,7 +82,7 @@ - + @@ -100,7 +100,7 @@ - + @@ -168,7 +168,7 @@ - + Returns font style flags, see [enum TextServer.FontStyle]. @@ -200,8 +200,8 @@ - - + + @@ -240,7 +240,7 @@ - + diff --git a/doc/classes/FontFile.xml b/doc/classes/FontFile.xml index 1430f79614ee..7f438435bd77 100644 --- a/doc/classes/FontFile.xml +++ b/doc/classes/FontFile.xml @@ -580,7 +580,7 @@ Font stretch amount, compared to a normal width. A percentage value between [code]50%[/code] and [code]200%[/code]. - + Font style flags, see [enum TextServer.FontStyle]. diff --git a/doc/classes/ImageFormatLoaderExtension.xml b/doc/classes/ImageFormatLoaderExtension.xml index 98d682d8685e..be695de6298d 100644 --- a/doc/classes/ImageFormatLoaderExtension.xml +++ b/doc/classes/ImageFormatLoaderExtension.xml @@ -20,7 +20,7 @@ - + Loads the content of [param fileaccess] into the provided [param image]. diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index fab4d2385b05..cea8e66e528e 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -156,7 +156,7 @@ - + Returns mouse buttons as a bitmask. If multiple mouse buttons are pressed at the same time, the bits are added together. Equivalent to [method DisplayServer.mouse_get_button_state]. diff --git a/doc/classes/InputEventMouse.xml b/doc/classes/InputEventMouse.xml index 0f3794a1f62f..061438dd9add 100644 --- a/doc/classes/InputEventMouse.xml +++ b/doc/classes/InputEventMouse.xml @@ -10,7 +10,7 @@ $DOCS_URL/tutorials/inputs/inputevent.html - + The mouse button mask identifier, one of or a bitwise combination of the [enum MouseButton] button masks. diff --git a/doc/classes/InputEventWithModifiers.xml b/doc/classes/InputEventWithModifiers.xml index 9ba0d5d641c2..9de6469dfbda 100644 --- a/doc/classes/InputEventWithModifiers.xml +++ b/doc/classes/InputEventWithModifiers.xml @@ -11,7 +11,7 @@ - + Returns the keycode combination of modifier keys. diff --git a/doc/classes/Label.xml b/doc/classes/Label.xml index 466b353f1506..d54f2092440d 100644 --- a/doc/classes/Label.xml +++ b/doc/classes/Label.xml @@ -48,7 +48,7 @@ Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the [enum HorizontalAlignment] constants. - + Line fill alignment rules. For more info see [enum TextServer.JustificationFlag]. @@ -64,7 +64,7 @@ Limits the lines of text the node shows on screen. - + Set BiDi algorithm override for the structured text. diff --git a/doc/classes/Label3D.xml b/doc/classes/Label3D.xml index 7b2f0547031d..79e96d0d45ea 100644 --- a/doc/classes/Label3D.xml +++ b/doc/classes/Label3D.xml @@ -71,7 +71,7 @@ Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the [enum HorizontalAlignment] constants. - + Line fill alignment rules. For more info see [enum TextServer.JustificationFlag]. diff --git a/doc/classes/NavigationAgent2D.xml b/doc/classes/NavigationAgent2D.xml index 00aedb490dcd..332219be1ea6 100644 --- a/doc/classes/NavigationAgent2D.xml +++ b/doc/classes/NavigationAgent2D.xml @@ -184,7 +184,7 @@ The maximum distance the agent is allowed away from the ideal path to the final position. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path. - + Additional information to return with the navigation path. diff --git a/doc/classes/NavigationAgent3D.xml b/doc/classes/NavigationAgent3D.xml index f341686d577c..2450f8492914 100644 --- a/doc/classes/NavigationAgent3D.xml +++ b/doc/classes/NavigationAgent3D.xml @@ -187,7 +187,7 @@ The maximum distance the agent is allowed away from the ideal path to the final position. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path. - + Additional information to return with the navigation path. diff --git a/doc/classes/NavigationPathQueryParameters2D.xml b/doc/classes/NavigationPathQueryParameters2D.xml index 0e4850819745..a4fd04696da8 100644 --- a/doc/classes/NavigationPathQueryParameters2D.xml +++ b/doc/classes/NavigationPathQueryParameters2D.xml @@ -13,7 +13,7 @@ The navigation [code]map[/code] [RID] used in the path query. - + Additional information to include with the navigation path. diff --git a/doc/classes/NavigationPathQueryParameters3D.xml b/doc/classes/NavigationPathQueryParameters3D.xml index 7564c6a8581a..e63a3582bd7f 100644 --- a/doc/classes/NavigationPathQueryParameters3D.xml +++ b/doc/classes/NavigationPathQueryParameters3D.xml @@ -13,7 +13,7 @@ The navigation [code]map[/code] [RID] used in the path query. - + Additional information to include with the navigation path. diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 1557b5f3c279..1b6f972b3619 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -877,7 +877,7 @@ Change the process thread group order. Groups with a lesser order will process before groups with a greater order. This is useful when a large amount of nodes process in sub thread and, afterwards, another group wants to collect their result in the main thread, as an example. - + Set whether the current thread group will process messages (calls to [method call_deferred_thread_group] on threads, and whether it wants to receive them during regular process or physics process callbacks. @@ -1115,11 +1115,11 @@ Process this node (and children nodes set to inherit) on a sub-thread. See [member process_thread_group] for more information. - + - + - + Duplicate the node's signals. diff --git a/doc/classes/RDTextureFormat.xml b/doc/classes/RDTextureFormat.xml index ff674a8d7e29..7308127c3f29 100644 --- a/doc/classes/RDTextureFormat.xml +++ b/doc/classes/RDTextureFormat.xml @@ -44,7 +44,7 @@ The texture type. - + The texture's usage bits, which determine what can be done using the texture. diff --git a/doc/classes/Range.xml b/doc/classes/Range.xml index a6b29f9e2639..e75b47af24b7 100644 --- a/doc/classes/Range.xml +++ b/doc/classes/Range.xml @@ -62,7 +62,7 @@ If [code]true[/code], [member value] will always be rounded to the nearest integer. - + If greater than 0, [member value] will always be rounded to a multiple of this property's value. If [member rounded] is also [code]true[/code], [member value] will first be rounded to a multiple of this property's value, then rounded to the nearest integer. diff --git a/doc/classes/RenderingDevice.xml b/doc/classes/RenderingDevice.xml index e19bb440ec74..f557dc2fdd54 100644 --- a/doc/classes/RenderingDevice.xml +++ b/doc/classes/RenderingDevice.xml @@ -16,8 +16,8 @@ - - + + Puts a memory barrier in place. This is used for synchronization to avoid data races. See also [method full_barrier], which may be useful for debugging. @@ -27,7 +27,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -114,7 +114,7 @@ - + Finishes a list of compute commands created with the [code]compute_*[/code] methods. @@ -296,7 +296,7 @@ - + Finishes a list of raster drawing commands created with the [code]draw_*[/code] methods. @@ -534,7 +534,7 @@ - + @@ -643,7 +643,7 @@ - + Creates a [url=https://vkguide.dev/docs/chapter-4/storage_buffers/]storage buffer[/url] with the specified [param data] and [param usage]. It can be accessed with the RID that is returned. Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. @@ -682,7 +682,7 @@ - + Clears the specified [param texture] by replacing all of its pixels with the specified [param color]. [param base_mipmap] and [param mipmap_count] determine which mipmaps of the texture are affected by this clear operation, while [param base_layer] and [param layer_count] determine which layers of a 3D texture (or texture array) are affected by this clear operation. For 2D textures (which only have one layer by design), [param base_layer] and [param layer_count] must both be [code]0[/code]. [b]Note:[/b] [param texture] can't be cleared while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to [constant FINAL_ACTION_CONTINUE]) to clear this texture. @@ -699,7 +699,7 @@ - + Copies the [param from_texture] to [param to_texture] with the specified [param from_pos], [param to_pos] and [param size] coordinates. The Z axis of the [param from_pos], [param to_pos] and [param size] must be [code]0[/code] for 2-dimensional textures. Source and destination mipmaps/layers must also be specified, with these parameters being [code]0[/code] for textures without mipmaps or single-layer textures. Returns [constant @GlobalScope.OK] if the texture copy was successful or [constant @GlobalScope.ERR_INVALID_PARAMETER] otherwise. [b]Note:[/b] [param from_texture] texture can't be copied while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to [constant FINAL_ACTION_CONTINUE]) to copy this texture. @@ -763,7 +763,7 @@ - + Returns [code]true[/code] if the specified [param format] is supported for the given [param usage_flags], [code]false[/code] otherwise. @@ -786,7 +786,7 @@ - + Resolves the [param from_texture] texture onto [param to_texture] with multisample antialiasing enabled. This must be used when rendering a framebuffer for MSAA to work. Returns [constant @GlobalScope.OK] if successful, [constant @GlobalScope.ERR_INVALID_PARAMETER] otherwise. [b]Note:[/b] [param from_texture] and [param to_texture] textures must have the same dimension, format and type (color or depth). @@ -803,7 +803,7 @@ - + Updates texture data with new data, replacing the previous data in place. The updated texture data must have the same dimensions and format. For 2D textures (which only have one layer), [param layer] must be [code]0[/code]. Returns [constant @GlobalScope.OK] if the update was successful, [constant @GlobalScope.ERR_INVALID_PARAMETER] otherwise. [b]Note:[/b] Updating textures is forbidden during creation of a draw or compute list. diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index 6b65302a7dd6..21796e86d7a7 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -2096,7 +2096,7 @@ - + @@ -2199,14 +2199,14 @@ - + - + @@ -2214,14 +2214,14 @@ - + - + diff --git a/doc/classes/ResourceSaver.xml b/doc/classes/ResourceSaver.xml index f173f34c5a87..9d19d81f0548 100644 --- a/doc/classes/ResourceSaver.xml +++ b/doc/classes/ResourceSaver.xml @@ -37,7 +37,7 @@ - + Saves a resource to disk to the given path, using a [ResourceFormatSaver] that recognizes the resource object. If [param path] is empty, [ResourceSaver] will try to use [member Resource.resource_path]. The [param flags] bitmask can be specified to customize the save behavior using [enum SaverFlags] flags. diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml index 44936925ce76..6fbdb4faadbc 100644 --- a/doc/classes/RichTextLabel.xml +++ b/doc/classes/RichTextLabel.xml @@ -410,7 +410,7 @@ - + Adds a [code][p][/code] tag to the tag stack. diff --git a/doc/classes/SpinBox.xml b/doc/classes/SpinBox.xml index 8fbd97e78ba7..e276ca69034d 100644 --- a/doc/classes/SpinBox.xml +++ b/doc/classes/SpinBox.xml @@ -60,7 +60,7 @@ 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. - + Adds the specified [code]suffix[/code] string after the numerical value of the [SpinBox]. diff --git a/doc/classes/TextLine.xml b/doc/classes/TextLine.xml index 93cd8065e2a8..e9bdd67167b5 100644 --- a/doc/classes/TextLine.xml +++ b/doc/classes/TextLine.xml @@ -151,7 +151,7 @@ Text writing direction. - + Line alignment rules. For more info see [TextServer]. diff --git a/doc/classes/TextMesh.xml b/doc/classes/TextMesh.xml index 9258dca6573c..e1999c5f6a50 100644 --- a/doc/classes/TextMesh.xml +++ b/doc/classes/TextMesh.xml @@ -29,7 +29,7 @@ Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the [enum HorizontalAlignment] constants. - + Line fill alignment rules. For more info see [enum TextServer.JustificationFlag]. diff --git a/doc/classes/TextParagraph.xml b/doc/classes/TextParagraph.xml index c7e9880fe759..2452c9d26234 100644 --- a/doc/classes/TextParagraph.xml +++ b/doc/classes/TextParagraph.xml @@ -265,7 +265,7 @@ Paragraph horizontal alignment. - + Line breaking rules. For more info see [TextServer]. @@ -274,7 +274,7 @@ Text writing direction. - + Line fill alignment rules. For more info see [enum TextServer.JustificationFlag]. diff --git a/doc/classes/TextServer.xml b/doc/classes/TextServer.xml index 6d4ecb255eef..17805f259cd9 100644 --- a/doc/classes/TextServer.xml +++ b/doc/classes/TextServer.xml @@ -386,7 +386,7 @@ - + Returns font style flags, see [enum FontStyle]. @@ -840,7 +840,7 @@ - + Sets the font style flags, see [enum FontStyle]. [b]Note:[/b] This value is used for font matching only and will not affect font rendering. Use [method font_set_face_index], [method font_set_variation_coordinates], [method font_set_embolden], or [method font_set_transform] instead. @@ -1168,7 +1168,7 @@ - + Adjusts text width to fit to specified width, returns new text width. @@ -1275,7 +1275,7 @@ - + Breaks text to the lines and returns character ranges for each line. @@ -1286,7 +1286,7 @@ - + Breaks text to the lines and columns. Returns character ranges for each segment. @@ -1397,7 +1397,7 @@ - + Breaks text into words and returns array of character ranges. Use [param grapheme_flags] to set what characters are used for breaking (see [enum GraphemeFlag]). @@ -1444,7 +1444,7 @@ - + Trims text if it exceeds the given width. diff --git a/doc/classes/TextServerExtension.xml b/doc/classes/TextServerExtension.xml index 7efd5a2a7588..3240b025bf31 100644 --- a/doc/classes/TextServerExtension.xml +++ b/doc/classes/TextServerExtension.xml @@ -332,7 +332,7 @@ - + @@ -734,7 +734,7 @@ - + @@ -1008,7 +1008,7 @@ - + @@ -1100,7 +1100,7 @@ - + @@ -1110,7 +1110,7 @@ - + @@ -1205,7 +1205,7 @@ - + @@ -1240,7 +1240,7 @@ - + diff --git a/doc/classes/TextureProgressBar.xml b/doc/classes/TextureProgressBar.xml index c969573d378f..5fd90e6b4de8 100644 --- a/doc/classes/TextureProgressBar.xml +++ b/doc/classes/TextureProgressBar.xml @@ -43,7 +43,7 @@ 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]. - + 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. diff --git a/doc/classes/VScrollBar.xml b/doc/classes/VScrollBar.xml index 3a6acb529ab3..9ecbcdef8ad4 100644 --- a/doc/classes/VScrollBar.xml +++ b/doc/classes/VScrollBar.xml @@ -9,8 +9,8 @@ - - + + diff --git a/doc/classes/VSlider.xml b/doc/classes/VSlider.xml index 5c1d61d0f966..964facc45c60 100644 --- a/doc/classes/VSlider.xml +++ b/doc/classes/VSlider.xml @@ -9,8 +9,8 @@ - - + + diff --git a/doc/tools/make_rst.py b/doc/tools/make_rst.py index 2594fa8cbd04..7cc05087b7f0 100755 --- a/doc/tools/make_rst.py +++ b/doc/tools/make_rst.py @@ -27,7 +27,7 @@ MARKUP_ALLOWED_SUBSEQUENT = " -.,:;!?\\/'\")]}>" # Used to translate section headings and other hardcoded strings when required with # the --lang argument. The BASE_STRINGS list should be synced with what we actually # write in this script (check `translate()` uses), and also hardcoded in -# `doc/translations/extract.py` to include them in the source POT file. +# `scripts/extract_classes.py` (godotengine/godot-editor-l10n repo) to include them in the source POT file. BASE_STRINGS = [ "All classes", "Globals", @@ -65,6 +65,7 @@ BASE_STRINGS = [ "This method is used to construct a type.", "This method doesn't need an instance to be called, so it can be called directly using the class name.", "This method describes a valid operator to use with this type as left-hand operand.", + "This value is an integer composed as a bitmask of the following flags.", ] strings_l10n: Dict[str, str] = {} @@ -362,13 +363,14 @@ class State: class TypeName: - def __init__(self, type_name: str, enum: Optional[str] = None) -> None: + def __init__(self, type_name: str, enum: Optional[str] = None, is_bitfield: bool = False) -> None: self.type_name = type_name self.enum = enum + self.is_bitfield = is_bitfield def to_rst(self, state: State) -> str: if self.enum is not None: - return make_enum(self.enum, state) + return make_enum(self.enum, self.is_bitfield, state) elif self.type_name == "void": return "void" else: @@ -376,7 +378,7 @@ class TypeName: @classmethod def from_element(cls, element: ET.Element) -> "TypeName": - return cls(element.attrib["type"], element.get("enum")) + return cls(element.attrib["type"], element.get("enum"), element.get("is_bitfield") == "true") class DefinitionBase: @@ -1280,7 +1282,7 @@ def make_type(klass: str, state: State) -> str: return klass -def make_enum(t: str, state: State) -> str: +def make_enum(t: str, is_bitfield: bool, state: State) -> str: p = t.find(".") if p >= 0: c = t[0:p] @@ -1296,7 +1298,12 @@ def make_enum(t: str, state: State) -> str: c = "@GlobalScope" if c in state.classes and e in state.classes[c].enums: - return f":ref:`{e}`" + if is_bitfield: + if not state.classes[c].enums[e].is_bitfield: + print_error(f'{state.current_class}.xml: Enum "{t}" is not bitfield.', state) + return f"|bitfield|\<:ref:`{e}`\>" + else: + return f":ref:`{e}`" # Don't fail for `Vector3.Axis`, as this enum is a special case which is expected not to be resolved. if f"{c}.{e}" != "Vector3.Axis": @@ -1412,6 +1419,7 @@ def make_footer() -> str: "This method doesn't need an instance to be called, so it can be called directly using the class name." ) operator_msg = translate("This method describes a valid operator to use with this type as left-hand operand.") + bitfield_msg = translate("This value is an integer composed as a bitmask of the following flags.") return ( f".. |virtual| replace:: :abbr:`virtual ({virtual_msg})`\n" @@ -1420,6 +1428,7 @@ def make_footer() -> str: f".. |constructor| replace:: :abbr:`constructor ({constructor_msg})`\n" f".. |static| replace:: :abbr:`static ({static_msg})`\n" f".. |operator| replace:: :abbr:`operator ({operator_msg})`\n" + f".. |bitfield| replace:: :abbr:`BitField ({bitfield_msg})`\n" ) @@ -1834,7 +1843,7 @@ def format_text_block( escape_post = True elif cmd.startswith("enum"): - tag_text = make_enum(link_target, state) + tag_text = make_enum(link_target, False, state) escape_pre = True escape_post = True diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp index 67a8814aa180..91358c3475cf 100644 --- a/editor/doc_tools.cpp +++ b/editor/doc_tools.cpp @@ -502,6 +502,7 @@ void DocTools::generate(bool p_basic_types) { found_type = true; if (retinfo.type == Variant::INT && retinfo.usage & (PROPERTY_USAGE_CLASS_IS_ENUM | PROPERTY_USAGE_CLASS_IS_BITFIELD)) { prop.enumeration = retinfo.class_name; + prop.is_bitfield = retinfo.usage & PROPERTY_USAGE_CLASS_IS_BITFIELD; prop.type = "int"; } else if (retinfo.class_name != StringName()) { prop.type = retinfo.class_name; @@ -1065,6 +1066,9 @@ static Error _parse_methods(Ref &parser, Vector & method.return_type = parser->get_named_attribute_value("type"); if (parser->has_attribute("enum")) { method.return_enum = parser->get_named_attribute_value("enum"); + if (parser->has_attribute("is_bitfield")) { + method.return_is_bitfield = parser->get_named_attribute_value("is_bitfield").to_lower() == "true"; + } } } else if (name == "returns_error") { ERR_FAIL_COND_V(!parser->has_attribute("number"), ERR_FILE_CORRUPT); @@ -1077,6 +1081,9 @@ static Error _parse_methods(Ref &parser, Vector & argument.type = parser->get_named_attribute_value("type"); if (parser->has_attribute("enum")) { argument.enumeration = parser->get_named_attribute_value("enum"); + if (parser->has_attribute("is_bitfield")) { + argument.is_bitfield = parser->get_named_attribute_value("is_bitfield").to_lower() == "true"; + } } method.arguments.push_back(argument); @@ -1267,6 +1274,9 @@ Error DocTools::_load(Ref parser) { } if (parser->has_attribute("enum")) { prop2.enumeration = parser->get_named_attribute_value("enum"); + if (parser->has_attribute("is_bitfield")) { + prop2.is_bitfield = parser->get_named_attribute_value("is_bitfield").to_lower() == "true"; + } } if (parser->has_attribute("is_deprecated")) { prop2.is_deprecated = parser->get_named_attribute_value("is_deprecated").to_lower() == "true"; @@ -1334,9 +1344,9 @@ Error DocTools::_load(Ref parser) { constant2.is_value_valid = true; if (parser->has_attribute("enum")) { constant2.enumeration = parser->get_named_attribute_value("enum"); - } - if (parser->has_attribute("is_bitfield")) { - constant2.is_bitfield = parser->get_named_attribute_value("is_bitfield").to_lower() == "true"; + if (parser->has_attribute("is_bitfield")) { + constant2.is_bitfield = parser->get_named_attribute_value("is_bitfield").to_lower() == "true"; + } } if (parser->has_attribute("is_deprecated")) { constant2.is_deprecated = parser->get_named_attribute_value("is_deprecated").to_lower() == "true"; @@ -1407,6 +1417,9 @@ static void _write_method_doc(Ref f, const String &p_name, Vector"); } @@ -1422,6 +1435,9 @@ static void _write_method_doc(Ref f, const String &p_name, Vectorpush_color(Color(theme_cache.type_color, 0.5)); class_desc->push_hint(TTR("No return value.")); @@ -304,6 +304,7 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) { } bool is_enum_type = !p_enum.is_empty(); + bool is_bitfield = p_is_bitfield && is_enum_type; bool can_ref = !p_type.contains("*") || is_enum_type; String link_t = p_type; // For links in metadata @@ -327,6 +328,13 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) { class_desc->add_text("Array"); class_desc->pop(); class_desc->add_text("["); + } else if (is_bitfield) { + class_desc->push_color(Color(theme_cache.type_color, 0.5)); + class_desc->push_hint(TTR("This value is an integer composed as a bitmask of the following flags.")); + class_desc->add_text("BitField"); + class_desc->pop(); + class_desc->add_text("["); + class_desc->pop(); } if (is_enum_type) { @@ -340,6 +348,10 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) { class_desc->pop(); // Pushed meta above. if (add_array) { class_desc->add_text("]"); + } else if (is_bitfield) { + class_desc->push_color(Color(theme_cache.type_color, 0.5)); + class_desc->add_text("]"); + class_desc->pop(); } } class_desc->pop(); @@ -403,7 +415,7 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview _add_bulletpoint(); } - _add_type(p_method.return_type, p_method.return_enum); + _add_type(p_method.return_type, p_method.return_enum, p_method.return_is_bitfield); if (p_overview) { class_desc->pop(); // align @@ -437,7 +449,7 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview _add_text(p_method.arguments[j].name); class_desc->add_text(": "); - _add_type(p_method.arguments[j].type, p_method.arguments[j].enumeration); + _add_type(p_method.arguments[j].type, p_method.arguments[j].enumeration, p_method.arguments[j].is_bitfield); if (!p_method.arguments[j].default_value.is_empty()) { class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(" = "); @@ -953,7 +965,7 @@ void EditorHelp::_update_doc() { class_desc->push_cell(); class_desc->push_paragraph(HORIZONTAL_ALIGNMENT_RIGHT, Control::TEXT_DIRECTION_AUTO, ""); _push_code_font(); - _add_type(cd.properties[i].type, cd.properties[i].enumeration); + _add_type(cd.properties[i].type, cd.properties[i].enumeration, cd.properties[i].is_bitfield); _pop_code_font(); class_desc->pop(); class_desc->pop(); // cell @@ -1252,7 +1264,7 @@ void EditorHelp::_update_doc() { _add_text(cd.signals[i].arguments[j].name); class_desc->add_text(": "); - _add_type(cd.signals[i].arguments[j].type, cd.signals[i].arguments[j].enumeration); + _add_type(cd.signals[i].arguments[j].type, cd.signals[i].arguments[j].enumeration, cd.signals[i].arguments[j].is_bitfield); if (!cd.signals[i].arguments[j].default_value.is_empty()) { class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(" = "); @@ -1630,7 +1642,7 @@ void EditorHelp::_update_doc() { _push_code_font(); _add_bulletpoint(); - _add_type(cd.properties[i].type, cd.properties[i].enumeration); + _add_type(cd.properties[i].type, cd.properties[i].enumeration, cd.properties[i].is_bitfield); class_desc->add_text(" "); _pop_code_font(); class_desc->pop(); // cell diff --git a/editor/editor_help.h b/editor/editor_help.h index 4175ece81648..0aa8302b27c6 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -158,7 +158,7 @@ class EditorHelp : public VBoxContainer { bool scroll_locked = false; //void _button_pressed(int p_idx); - void _add_type(const String &p_type, const String &p_enum = String()); + void _add_type(const String &p_type, const String &p_enum = String(), bool p_is_bitfield = false); void _add_type_icon(const String &p_type, int p_size = 0, const String &p_fallback = ""); void _add_method(const DocData::MethodDoc &p_method, bool p_overview = true); diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp index 8b19b653fcb2..58dad4040375 100644 --- a/scene/2d/line_2d.cpp +++ b/scene/2d/line_2d.cpp @@ -34,11 +34,6 @@ #include "core/math/geometry_2d.h" #include "line_builder.h" -// Needed so we can bind functions -VARIANT_ENUM_CAST(Line2D::LineJointMode) -VARIANT_ENUM_CAST(Line2D::LineCapMode) -VARIANT_ENUM_CAST(Line2D::LineTextureMode) - Line2D::Line2D() { } diff --git a/scene/2d/line_2d.h b/scene/2d/line_2d.h index b98c27138f74..aa873ca6420d 100644 --- a/scene/2d/line_2d.h +++ b/scene/2d/line_2d.h @@ -138,4 +138,9 @@ private: bool _antialiased = false; }; +// Needed so we can bind functions +VARIANT_ENUM_CAST(Line2D::LineJointMode) +VARIANT_ENUM_CAST(Line2D::LineCapMode) +VARIANT_ENUM_CAST(Line2D::LineTextureMode) + #endif // LINE_2D_H diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 54e1b0251867..ea89a719e8c9 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -46,11 +46,6 @@ #include -VARIANT_ENUM_CAST(Node::ProcessMode); -VARIANT_ENUM_CAST(Node::ProcessThreadGroup); -VARIANT_BITFIELD_CAST(Node::ProcessThreadMessages); -VARIANT_ENUM_CAST(Node::InternalMode); - int Node::orphan_node_count = 0; thread_local Node *Node::current_process_thread_group = nullptr; @@ -3446,9 +3441,9 @@ void Node::_bind_methods() { BIND_ENUM_CONSTANT(PROCESS_THREAD_GROUP_MAIN_THREAD); BIND_ENUM_CONSTANT(PROCESS_THREAD_GROUP_SUB_THREAD); - BIND_ENUM_CONSTANT(FLAG_PROCESS_THREAD_MESSAGES); - BIND_ENUM_CONSTANT(FLAG_PROCESS_THREAD_MESSAGES_PHYSICS); - BIND_ENUM_CONSTANT(FLAG_PROCESS_THREAD_MESSAGES_ALL); + BIND_BITFIELD_FLAG(FLAG_PROCESS_THREAD_MESSAGES); + BIND_BITFIELD_FLAG(FLAG_PROCESS_THREAD_MESSAGES_PHYSICS); + BIND_BITFIELD_FLAG(FLAG_PROCESS_THREAD_MESSAGES_ALL); BIND_ENUM_CONSTANT(DUPLICATE_SIGNALS); BIND_ENUM_CONSTANT(DUPLICATE_GROUPS); diff --git a/scene/main/node.h b/scene/main/node.h index bb29e473e062..ed8f699d7b8b 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -711,6 +711,10 @@ public: }; VARIANT_ENUM_CAST(Node::DuplicateFlags); +VARIANT_ENUM_CAST(Node::ProcessMode); +VARIANT_ENUM_CAST(Node::ProcessThreadGroup); +VARIANT_BITFIELD_CAST(Node::ProcessThreadMessages); +VARIANT_ENUM_CAST(Node::InternalMode); typedef HashSet NodeSet;