diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index c66416ea6d00..513c7a94709d 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -597,7 +597,15 @@ void _OS::native_video_stop() { OS::get_singleton()->native_video_stop(); }; +bool _OS::is_debug_build() const { +#ifdef DEBUG_ENABLED + return true; +#else + return false; +#endif + +} String _OS::get_custom_level() const { return OS::get_singleton()->get_custom_level(); @@ -668,6 +676,8 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("can_use_threads"),&_OS::can_use_threads); + ObjectTypeDB::bind_method(_MD("is_debug_build"),&_OS::is_debug_build); + //ObjectTypeDB::bind_method(_MD("get_mouse_button_state"),&_OS::get_mouse_button_state); ObjectTypeDB::bind_method(_MD("dump_memory_to_file","file"),&_OS::dump_memory_to_file); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 2d824955df4a..b3040a96cab8 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -154,6 +154,8 @@ public: bool has_touchscreen_ui_hint() const; + bool is_debug_build() const; + String get_unique_ID() const; /* diff --git a/core/object.h b/core/object.h index 8e0164b13b51..7ce07869a64e 100644 --- a/core/object.h +++ b/core/object.h @@ -81,6 +81,7 @@ enum PropertyUsageFlags { PROPERTY_USAGE_BUNDLE=128, //used for optimized bundles PROPERTY_USAGE_CATEGORY=256, PROPERTY_USAGE_STORE_IF_NONZERO=512, //only store if nonzero + PROPERTY_USAGE_NO_INSTANCE_STATE=1024, PROPERTY_USAGE_DEFAULT=PROPERTY_USAGE_STORAGE|PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_NETWORK, PROPERTY_USAGE_DEFAULT_INTL=PROPERTY_USAGE_STORAGE|PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_NETWORK|PROPERTY_USAGE_INTERNATIONALIZED, diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index b78fd89883fc..2c4d9e16a85e 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -243,6 +243,11 @@ void UndoRedo::_process_operation_list(List::Element *E) { case Operation::TYPE_PROPERTY: { obj->set(op.name,op.args[0]); +#ifdef TOOLS_ENABLED + Resource* res = obj->cast_to(); + if (res) + res->set_edited(true); +#endif } break; case Operation::TYPE_REFERENCE: { //do nothing diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 527991d147be..b28c050a6132 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -9,271 +9,271 @@ - + - + Standard sine function. - + - + Standard cosine function. - + - + Standard tangent function. - + - + Hyperbolic sine. - + - + Hyperbolic cosine. - + - + Hyperbolic tangent. - + - + Arc-sine. - + - + Arc-cosine. - + - + Arc-tangent. - + - + - + Arc-tangent that takes a 2D vector as argument, retuns the full -pi to +pi range. - + - + Square root. - + - + - + Module (remainder of x/y). - + - + - + Module (remainder of x/y) that wraps equally in positive and negative. - + - + Floor (rounds down to nearest integer). - + - + Ceiling (rounds up to nearest integer). - + - + Round to nearest integer. - + - + Remove sign (works for integer and float). - + - + Return sign (-1 or +1). - + - + - + Power function, x elevate to y. - + - + Natural logarithm. - + - + Exponential logarithm. - + - + Return true if the float is not a number. - + - + Return true if the float is infinite. - + - + - + Easing function, based on exponent. 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in. - + - + Return the amount of decimals in the floating point value. - + - + - + Snap float value to a given step. - + - + - + - + - + - + - + - + @@ -297,18 +297,18 @@ - + Random value (0 to 1 float). - + - + - + Random range, any floating point value between @@ -318,78 +318,78 @@ - + Random from seed, pass a seed and an array with both number and new seed is returned. - + - + Convert from degrees to radians. - + - + Convert from radias to degrees. - + - + Convert from linear energy to decibels (audio). - + - + Convert from decibels to linear energy (audio). - + - + - + Return the maximum of two values. - + - + - + Return the minimum of two values. - + - + - + - + Clamp both values to a range. @@ -538,6 +538,14 @@ back into an instance. Useful for deserializing. + + + + + + + + @@ -549,7 +557,7 @@ - Constant that represents how many times the diameter of a + Constant that represents how many times the diameter of a circumference fits around it's perimeter. @@ -568,79 +576,52 @@ - The file engine.cfg is read into this singleton. - Global IP protocol functions (like hostname resolution). - Geometry helpers. - Singleton that loads resources (load() calls this) - Singleton that saves resources. - Uset to setup remaps for the filesystem. - Operating system functions. - Used to serialize and deserialize, helpers. - Server that takes care of translating between different - languages. - Short version for TranslationServer. - Global input variables and functions. - - Deprecaed. + - Server that handles anything visual at low level. - Short for VisualServer. - Server that handles anything audio at low level. - Short for AudioServer. - Server that handles anything 3D physics at low level. - Short for PhysicsServer. - Server that handles anything 2D physics at low level. - Short for Physics2DServer. - Server that handles spatial audio positioning in 3D at low - level. - Short for SpatialSoundServer. - Server that handles spatial audio positioning in 2D at low - level. - Short for SpatialSound2DServer. @@ -1443,20 +1424,38 @@ Property hint is an enumerated value, like "Hello,Something,Else". This is valid for integers, floats and strings properties. + + + + Property hint is a bitmask description, for bits 0,1,2,3 abd 5 the hint would be like "Bit0,Bit1,Bit2,Bit3,,Bit5". Valid only for integers. + + String property is a file (so pop up a file dialog when edited). Hint string can be a set of wildcards like "*.doc". String property is a directory (so pop up a file dialog when edited). + + + + String property is a resource, so open the resource popup menu when edited. + + + + + + + + Property will be used as storage (default). @@ -1586,7 +1585,7 @@ - + Get the area inside the [AABB] @@ -1617,7 +1616,7 @@ - + Return the scalar length of the longest axis of the @@ -1640,7 +1639,7 @@ - + Return the scalar length of the shortest axis of the @@ -1660,7 +1659,7 @@ - + Return a copy of the AABB grown a given a mount of @@ -1718,6 +1717,16 @@ Return true if the AABB is at both sides of a plane. + + + + + + + + + + @@ -1744,7 +1753,6 @@ - Same as pos+size. @@ -1792,7 +1800,11 @@ - + + + + + @@ -1933,7 +1945,7 @@ Set the visible sprite frame index (from the list of - frames inside the [SpriteFrames] resource). + frames inside the [SpriteFrames] resource). @@ -1961,6 +1973,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Contains data used to animate everything in the engine. @@ -2048,7 +2094,7 @@ - + @@ -2063,11 +2109,11 @@ - + - + Insert a generic key in a given track. @@ -2085,7 +2131,7 @@ - + Remove a key by position (seconds) in a given track. @@ -2107,7 +2153,7 @@ - + Set the transition curve (easing) for a specific key (see built-in @@ -2115,7 +2161,7 @@ - + @@ -2145,7 +2191,7 @@ - + @@ -2160,7 +2206,7 @@ - + @@ -2191,7 +2237,7 @@ - + Return the interpolated value of a transform track at a given time (in seconds). An array consisting of 3 elements: position ([Vector3]), rotation ([Quat]) and scale ([Vector3]). @@ -2220,9 +2266,9 @@ - + - + Return all the key indices of a value track, given a position and delta time. @@ -2233,9 +2279,9 @@ - + - + Return all the key indices of a method track, given a position and delta time. @@ -2264,14 +2310,14 @@ - + Set the total length of the animation (in seconds). Note that length is not delimited by the last key, as this one may be before or after the end to ensure correct interpolation and looping. - + Return the total length of the animation (in seconds). @@ -2292,13 +2338,13 @@ - + - + @@ -2395,14 +2441,14 @@ - + Specify a blend time (in seconds) between two animations, referemced by their names. - + @@ -2413,14 +2459,14 @@ - + Set the default blend time between animations. - + Return the default blend time between animations. @@ -2429,9 +2475,9 @@ - + - + @@ -2501,14 +2547,14 @@ - + Set a speed scaling ratio in a given animation channel (or channel 0 if none is provided). Default ratio is [i]1[/i] (no scaling). - + Get the speed scaling ratio in a given animation channel (or channel 0 if none is provided). Default ratio is [i]1[/i] (no scaling). @@ -2545,7 +2591,7 @@ - + @@ -2557,7 +2603,7 @@ - + Return the playback position (in seconds) in an animation channel (or channel 0 if none is provided) @@ -2592,7 +2638,7 @@ - + Get the position (in seconds) of the currently being @@ -2600,13 +2646,19 @@ - + Get the length (in seconds) of the currently being played animation. + + + + + + @@ -2627,11 +2679,11 @@ - Process animation on fixed process. This is specially useful + Process animation on fixed process. This is specially useful when animating kinematic bodies. - Process animation on idle process. + Process animation on idle process. @@ -2742,13 +2794,13 @@ - + - + @@ -2758,13 +2810,13 @@ - + - + @@ -2782,7 +2834,7 @@ - + @@ -2790,7 +2842,7 @@ - + @@ -2804,7 +2856,7 @@ - + @@ -2812,7 +2864,7 @@ - + @@ -2852,13 +2904,13 @@ - + - + @@ -2868,13 +2920,13 @@ - + - + @@ -2894,13 +2946,13 @@ - + - + @@ -2926,13 +2978,13 @@ - + - + @@ -2942,7 +2994,7 @@ - + @@ -2994,13 +3046,13 @@ - + - + @@ -3182,37 +3234,37 @@ - + - + - + - + - + - + @@ -3319,37 +3371,37 @@ - + - + - + - + - + - + @@ -3793,7 +3845,7 @@ - + Change the volume of a currently playing voice."#10;"#9;"#9;"#9;Volume is expressed as linear gain where 0.0 is mute"#10;"#9;"#9;"#9;and 1.0 is default. @@ -3802,11 +3854,11 @@ - + - + - + Change the pan of a currently playing voice and,"#10;"#9;"#9;"#9;optionally, the depth and height for a positional/3D"#10;"#9;"#9;"#9;sound. Panning values are expressed within the -1 to"#10;"#9;"#9;"#9;+1 range. @@ -3817,11 +3869,11 @@ - + - + - + Set a resonant filter post processing for the voice."#10;"#9;"#9;"#9;Filter type is a value from the FILTER_* enum. @@ -3830,7 +3882,7 @@ - + Set chorus send post processing for the voice (from"#10;"#9;"#9;"#9;0 to 1). @@ -3841,7 +3893,7 @@ - + Set the reverb send post processing for the voice (from"#10;"#9;"#9;"#9;0 to 1) and the reverb type, from the REVERB_* enum. @@ -3866,7 +3918,7 @@ - + @@ -3875,7 +3927,7 @@ - + @@ -3884,7 +3936,7 @@ - + @@ -3893,7 +3945,7 @@ - + @@ -3911,7 +3963,7 @@ - + @@ -3920,7 +3972,7 @@ - + @@ -3929,7 +3981,7 @@ - + @@ -3947,7 +3999,7 @@ - + @@ -3988,39 +4040,39 @@ - + Set global scale for stream playback. Default is 1.0. - + Return the global scale for stream playback. - + - + - + - + @@ -4141,21 +4193,21 @@ - + Seek to a certain position (in seconds) in an audio"#10;"#9;"#9;"#9;stream. - + Return the current playing position (in seconds) of the audio"#10;"#9;"#9;"#9;stream (if supported). Since this value is updated"#10;"#9;"#9;"#9;internally, it may not be exact or updated"#10;"#9;"#9;"#9;continuosly. Accuracy depends on the sample buffer"#10;"#9;"#9;"#9;size of the audio driver. - + @@ -4208,42 +4260,42 @@ - + Set pitch scale for the speech. Animating this value holds amusing results. - + Return the pitch scale. - + Set the random scaling for the pitch. - + Return the pitch random scaling. - + Set the cross-fade time between random phonemes. - + Return the cross-fade time between random phonemes. @@ -4329,6 +4381,374 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides a base class for different kinds of buttons. @@ -4351,6 +4771,12 @@ Return when the button is pressed (only if toggle_mode is active). + + + + + + @@ -4393,6 +4819,13 @@ Return the state of the click_on_press property (see [method set_click_on_press]). + + + + + Return the visual state used to draw the button. This is useful mainly when implementing your own draw code by either overiding _draw() or connecting to "draw" signal. The visual state of the button is defined by the DRAW_* enum. + + @@ -4409,6 +4842,14 @@ + + + + + + + + @@ -4594,6 +5035,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -4820,22 +5285,22 @@ - + - + - + Set the camera projection to perspective mode, by specifying a [i]FOV[/i] Y angle in degrees (FOV means Field of View), and the [i]near[/i] and [i]far[/i] clip planes in worldspace units. - + - + - + Set the camera projection to orthogonal mode, by specifying a"#10;"#9;"#9;"#9;width and the [i]near[/i] and [i]far[/i] clip planes in worldspace units. (As a hint, 2D games often use this projection, with values specified in pixels) @@ -4865,25 +5330,25 @@ - + - + - + - + @@ -4936,14 +5401,14 @@ - - + + - - + + @@ -4956,6 +5421,10 @@ Orthogonal Projection (objects remain the same size on the screen no matter how far away they are). + + + + @@ -5067,25 +5536,25 @@ - + - + - + - + @@ -5093,14 +5562,14 @@ - + Set the margins needed to drag the camera (relative to the screen size). Margin uses the MARGIN_* enum. Drag margins of 0,0,0,0 will keep the camera at the center of the screen, while drag margins of 1,1,1,1 will only move when the camera is at the edges. - + @@ -5134,13 +5603,13 @@ - + - + @@ -5189,7 +5658,7 @@ - + Used for editing, handle rotation. @@ -5267,27 +5736,27 @@ - + Set canvas item opacity. This will affect the canvas item and all the children. - + Return the canvas item opacity. This affects the canvas item and all the children. - + - + Set canvas item self-opacity. This does not affect the opacity of children items. @@ -5312,7 +5781,7 @@ - + Draw a line from a 2D point to another, with a given color and width. @@ -5330,7 +5799,7 @@ - + @@ -5391,7 +5860,7 @@ - + Draw a custom primitive, 1 point for a point, 2 points for a line, 3 points for a triangle and 4 points for a quad. @@ -5402,11 +5871,9 @@ - + - - - + Draw a polygon of any amount of points, convex or concave. @@ -5415,13 +5882,11 @@ - + - + - - - + Draw a colored polygon of any amount of points, convex or concave. @@ -5443,7 +5908,7 @@ - + @@ -5462,7 +5927,7 @@ - + @@ -5506,12 +5971,6 @@ - - - - - - @@ -5548,6 +6007,8 @@ Multiplicative blending mode. + + CanvasItem is requested to draw. @@ -5616,14 +6077,14 @@ - + Set the base rotation for this layer (helper). - + Return the base rotation for this layer (helper). @@ -5670,28 +6131,28 @@ - + Set the capsule radius. - + Return the capsule radius. - + Set the capsule height. - + Return the capsule height. @@ -5710,28 +6171,28 @@ - + Radius of the [CapsuleShape2D]. - + Return the radius of the [CapsuleShape2D]. - + Height of the [CapsuleShape2D]. - + Return the height of the [CapsuleShape2D]. @@ -5741,230 +6202,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Keeps children controls centered. @@ -5973,6 +6210,18 @@ CenterContainer Keeps children controls centered. This container keeps all children to their minimum size, in the center. + + + + + + + + + + + + @@ -5988,6 +6237,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5998,14 +6277,14 @@ - + Set the radius of the circle shape; - + Return the radius of the circle shape. @@ -6021,6 +6300,20 @@ + + + + + + + + + + + + + + @@ -6093,6 +6386,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -6100,6 +6417,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -6201,6 +6542,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Editor-Only class. @@ -6259,7 +6646,7 @@ - + Convert the color to gray. @@ -6277,7 +6664,7 @@ - + Return the linear interpolation with another color. @@ -6307,24 +6694,38 @@ - + - + - + - + Construct the color from an RGBA profile. - + - + - + + + + Construct the color from an RGBA profile. + + + + + + + Construct the color from an RGBA profile. + + + + Construct the color from an RGBA profile. @@ -6332,19 +6733,19 @@ - + - + - + - + - + - + - + @@ -6466,6 +6867,18 @@ + + + + + + + + + + + + @@ -6508,6 +6921,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -6561,6 +6998,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -6800,7 +7275,7 @@ - + Set a margin offset. Margin can be one of (MARGIN_LEFT, MARGIN_TOP, MARGIN_RIGHT, MARGIN_BOTTOM). Offset value being set depends on the anchor mode. @@ -6811,7 +7286,7 @@ - + Change the anchor (ANCHOR_BEGIN, ANCHOR_END, ANCHOR_RATIO) type for a margin (MARGIN_LEFT, MARGIN_TOP, MARGIN_RIGHT, MARGIN_BOTTOM), and also set its offset. This is a helper (see [method set_anchor] and [method set_margin]). @@ -6859,7 +7334,7 @@ - + @@ -6987,14 +7462,14 @@ - + Hint for containers, set the stretch ratio. This value is relative to other stretch ratio, so if this control has 2 and another has 1, this one will be twice as big. - + Hint for containers, return the stretch ratio. This value is relative to other stretch ratio, so if this control has 2 and another has 1, this one will be twice as big. @@ -7282,6 +7757,8 @@ X and Y are a ratio (0 to 1) relative to the parent size 0 is left/top, 1 is right/bottom. + + Control can't acquire focus. @@ -7476,13 +7953,13 @@ - + - + @@ -7536,6 +8013,8 @@ + + @@ -7598,50 +8077,48 @@ - + - - + + - + - - + + - - - - - - - - - - - - - - + + - - + + - + + + + + + + + + + + @@ -7694,13 +8171,13 @@ - + - + @@ -7750,7 +8227,7 @@ - + @@ -7758,25 +8235,25 @@ - + - + - + - + @@ -7784,7 +8261,7 @@ - + @@ -7816,56 +8293,56 @@ - + Set the maximum length of the sprint joint. - + Return the maximum length of the sprint joint. - + Set the resting length of the sprint joint. The joint will always try to go to back this length when pulled apart. - + Return the resting length of the sprint joint. The joint will always try to go to back this length when pulled apart. - + Set the stiffness of the spring joint. - + Return the stiffness of the spring joint. - + Set the damping of the spring joint. - + Return the damping of the spring joint. @@ -7973,13 +8450,13 @@ - + - + @@ -7992,7 +8469,9 @@ - + + + @@ -8090,6 +8569,14 @@ + + + + + + + + @@ -8128,38 +8615,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -8488,67 +8943,97 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -8559,13 +9044,13 @@ - + - + @@ -8609,49 +9094,49 @@ - + - + - + - + - + - + - + - + @@ -8669,13 +9154,13 @@ - + - + @@ -8695,13 +9180,13 @@ - + - + @@ -8709,13 +9194,13 @@ - + - + @@ -8752,6 +9237,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -8827,19 +9336,19 @@ - + - + - + @@ -8917,19 +9426,19 @@ - + - + - + @@ -9123,6 +9632,12 @@ + + + + + + @@ -9214,26 +9729,26 @@ Returns the special transform used to post-transform UV coordinates of the uv_xfrom tecoord mode: TEXCOORD_UV_TRANSFORM + + + + + + + + + + + + - + - - - - - - - - - - - - - + @@ -9283,234 +9798,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -9522,35 +9811,35 @@ - + Set the total font height (ascent plus descent) in pixels. - + Return the total font height (ascent plus descent) in pixels. - + Set the font ascent (number of pixels above the baseline). - + Return the font ascent (number of pixels above the baseline). - + Return the font descent (number of pixels below the baseline). @@ -9594,7 +9883,7 @@ - + Add a character to the font, where "character" is the unicode value, "texture" is the texture index, "rect" is the region in the texture (in pixels!), "align" is the (optional) alignment for the character and "advance" is the (optional) advance. @@ -9641,7 +9930,7 @@ - + @@ -9709,6 +9998,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -9737,6 +10048,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -9754,9 +10209,9 @@ - + - + @@ -9768,9 +10223,9 @@ - + - + @@ -9782,7 +10237,7 @@ - + @@ -9790,7 +10245,7 @@ - + @@ -9847,6 +10302,14 @@ + + + + + + + + @@ -9884,7 +10347,7 @@ - + @@ -9896,9 +10359,9 @@ - + - + @@ -9923,6 +10386,14 @@ + + + + + + + + @@ -9966,36 +10437,42 @@ - + - + - + - + + + + + + + + + + + + + - - - - - - @@ -10011,7 +10488,7 @@ - + @@ -10115,6 +10592,14 @@ + + + + + + + + @@ -10140,6 +10625,10 @@ + + + + @@ -10172,13 +10661,13 @@ - + - + @@ -10287,7 +10776,7 @@ - + @@ -10340,13 +10829,13 @@ - + - + @@ -10385,6 +10874,18 @@ + + + + + + + + + + + + @@ -10404,28 +10905,28 @@ - + Set the length of the groove. - + Return the length of the groove. - + Set the initial offset of the groove on body A. - + Set the final offset of the groove on body A. @@ -10446,6 +10947,10 @@ + + + + @@ -10458,6 +10963,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -10470,6 +10997,24 @@ + + + + + + + + + + + + + + + + + + @@ -10482,6 +11027,12 @@ + + + + + + @@ -10494,6 +11045,20 @@ + + + + + + + + + + + + + + @@ -10506,6 +11071,16 @@ + + + + + + + + + + @@ -10520,6 +11095,10 @@ + + + + @@ -10605,6 +11184,18 @@ + + + + + + + + + + + + @@ -10655,6 +11246,8 @@ + + @@ -10755,6 +11348,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IP Protocol support functions. @@ -10806,6 +11465,12 @@ Erase a queue ID, removing it from the queue if needed. This should be used after a queue is completed to free it and enable more queries to happen. + + + + + + @@ -10880,6 +11545,20 @@ + + + + + + + + + + + + + + @@ -10944,6 +11623,18 @@ + + + + + + + + + + + + @@ -11014,48 +11705,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -11119,13 +11768,13 @@ - + - + @@ -11134,6 +11783,10 @@ + + + + @@ -11150,6 +11803,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -11191,7 +11916,7 @@ - + @@ -11200,6 +11925,14 @@ + + + + + + + + @@ -11239,7 +11972,23 @@ + + + + + + + + + + + + + + + + @@ -11420,7 +12169,7 @@ - + @@ -11480,7 +12229,7 @@ - + @@ -11722,9 +12471,9 @@ - + - + @@ -11786,21 +12535,21 @@ - + - + - + - + - + - + @@ -11862,9 +12611,9 @@ - + - + @@ -11900,6 +12649,90 @@ Singleton that manages actions. InputMap has a list of the actions used in InputEvent, which can be modified. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -11981,19 +12814,19 @@ - + - + - + @@ -12014,6 +12847,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Base node for all joint constraints in 2D phyisics. @@ -12051,13 +12930,143 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -12126,6 +13135,16 @@ + + + + + + + + + + @@ -12175,13 +13194,13 @@ - + - + @@ -12291,13 +13310,13 @@ - + - + @@ -12329,6 +13348,20 @@ Align the whole text by spreading the rows. + + + + + + + + + + + + + + @@ -12337,6 +13370,8 @@ + + @@ -12344,6 +13379,22 @@ + + + + + + + + + + + + + + + + @@ -12391,13 +13442,13 @@ - + - + @@ -12456,6 +13507,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -12472,11 +13559,17 @@ - + - + - + + + + + + + @@ -12575,9 +13668,11 @@ Return the [i]secret[/i] status of the [LineEdit] (see [method set_secret]). - - - + + + + + @@ -12600,6 +13695,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -12624,14 +13739,14 @@ - + Set the line distance from the origin. - + Return the line distance from the origin. @@ -12665,6 +13780,8 @@ + + @@ -12678,6 +13795,10 @@ + + + + @@ -12729,22 +13850,6 @@ Return a [Material] flag, which toggles on or off a behavior when rendering. See enumeration FLAG_* for a list. - - - - - - - - - - - - - - - - @@ -12759,32 +13864,32 @@ Return blend mode for the material, which can be one of BLEND_MODE_MIX (default), BLEND_MODE_ADD, BLEND_MODE_SUB. Keep in mind that only BLEND_MODE_MIX ensures that the material [i]may[/i] be opaque, any other blend mode will render with alpha blending enabled in raster-based [VisualServer] implementations. - - - - - - - - - - - - - + Set the line width for geometry drawn with FLAG_WIREFRAME enabled, or LINE primitives. Note that not all hardware or VisualServer backends support this (like DirectX). - + Return the line width for geometry drawn with FLAG_WIREFRAME enabled, or LINE primitives. Note that not all hardware or VisualServer backends support this (like DirectX). + + + + + + + + + + + + @@ -12801,40 +13906,20 @@ - - Triangle geometry is drawn as lines if this flag is enabled. + - - Geometry world transform is computed as billboard if this flag is enabled, often used for impostors. + Maximum amount of flags - + - + - + - - - - - - - - - - - - - - - - - - - + Use the regular alpha blending equation (source and dest colors are faded) (default). @@ -12845,6 +13930,10 @@ Use substractive blending equation, often used for some smoke effects or types of glass. + + + + @@ -12856,7 +13945,7 @@ - + Return the determinant of the matrix. @@ -12875,6 +13964,12 @@ + + + + + + @@ -12894,7 +13989,7 @@ - + Return the rotated version of the matrix, by a given axis and angle. @@ -12910,7 +14005,7 @@ - + @@ -12919,7 +14014,7 @@ - + @@ -12928,7 +14023,7 @@ - + @@ -12975,7 +14070,7 @@ - + Create a matrix from 3 axis vectors. @@ -13014,6 +14109,22 @@ + + + + + + + + + + + + + + + + @@ -13021,7 +14132,13 @@ - + + + + + + + @@ -13031,7 +14148,7 @@ - + @@ -13051,7 +14168,7 @@ - + @@ -13100,11 +14217,11 @@ - + - + - + @@ -13134,6 +14251,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -13280,6 +14419,22 @@ + + + + + + + + + + + + + + + + @@ -13685,6 +14840,18 @@ Return the current [Mesh] resource for the instance. + + + + + + + + + + + + @@ -13947,6 +15114,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -13966,7 +15299,7 @@ - + @@ -14152,7 +15485,7 @@ - + Called for fixed processing (synced to the physics). @@ -14166,7 +15499,7 @@ - + Called for processing. This is called every frame, with the delta time from the previous frame. @@ -14261,7 +15594,7 @@ - Fetch a node. NodePath must be valid (or else error will occur) and can be either the path to child node, a relative path (from the current node to another node), or an absolute path to a node.[br] Note: fetching absolute paths only works when the node is inside the scene tree (see [method is_inside_scene]). Examples. Assume your current node is Character and following tree:[br] + Fetch a node. NodePath must be valid (or else error will occur) and can be either the path to child node, a relative path (from the current node to another node), or an absolute path to a node.[br] Note: fetching absolute paths only works when the node is inside the scene tree (see [method is_inside_scene]). Examples. Assume your current node is Character and following tree:[br] root/[br] root/Character[br] root/Character/Sword[br] @@ -14375,6 +15708,12 @@ Move a child node to a different position (order) amongst the other children. Since calls, signals, etc are performed by tree order, changing the order of chilren nodes may be useful. + + + + + + Move this node to the top of the array of nodes of the parent node. This is often useful on GUIs ([Control]), because their order of drawing fully depends on their order in the tree. @@ -14440,7 +15779,7 @@ - + Return the time elapsed since the last fixed frame. This is always the same in fixed proecssing unless the frames per second is changed in [OS]. @@ -14461,7 +15800,7 @@ - + Return the time elapsed (in seconds) since the last process callback. This is almost always different each time. @@ -14502,6 +15841,18 @@ Return true if the node is processing unhandled input (see [method set_process_unhandled_input]). + + + + + + + + + + + + @@ -14554,6 +15905,12 @@ Replace a node in a scene by a given one. Subscriptions that pass through this node will be lost. + + + + + + @@ -14628,7 +15985,7 @@ - + Set the rotation of the 2d node. @@ -14649,7 +16006,7 @@ - + Return the rotation of the 2D node. @@ -14662,6 +16019,28 @@ Return the scale of the 2D node. + + + + + + + + + + + + + + + + + + + + + + @@ -14669,6 +16048,12 @@ Return the global position of the 2D node. + + + + + + @@ -14857,6 +16242,30 @@ Return the amount of fixed iterations per second (for fixed process and physics). + + + + + + + + + + + + + + + + + + + + + + + + @@ -14900,6 +16309,8 @@ + + Execute the binary file in given path, optionally blocking until it returns. A process ID is returned. @@ -14921,6 +16332,12 @@ + + + + + + @@ -15052,6 +16469,12 @@ + + + + + + @@ -15109,7 +16532,7 @@ - + @@ -15118,11 +16541,19 @@ + + + + + + + + @@ -15140,6 +16571,12 @@ + + + + + + @@ -15208,6 +16645,10 @@ Return the property list, array of dictionaries, dictionaries must countain: name:String, type:int (see TYPE_* enum in globals) and optionally: hint:int (see PROPERTY_HINT_* in globals), hint_string:String, usage:int (see PROPERTY_USAGE_* in globals). + + + + @@ -15419,6 +16860,8 @@ + + @@ -15479,9 +16922,9 @@ Set true if this object can translate strings (in calls to tr() ). Default is true. - - - + + + Return true if this object can translate strings. @@ -15716,6 +17159,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -15830,6 +17339,12 @@ + + + + + + @@ -15865,6 +17380,14 @@ + + + + + + + + @@ -15877,6 +17400,10 @@ + + + + @@ -16001,49 +17528,49 @@ - + - + - + - + - + - + - + - + @@ -16191,14 +17718,14 @@ - + Set a specific variable for the particle system (see VAR_* enum). - + @@ -16209,14 +17736,14 @@ - + Set the randomness for a specific variable of the particle system. Randomness produces small changes from the default each time a particle is emitted. - + @@ -16227,14 +17754,14 @@ - + Set the position of a color phase (0 to 1) - + @@ -16275,13 +17802,13 @@ - + - + @@ -16385,49 +17912,49 @@ - + - + - + - + - + - + - + - + @@ -16435,13 +17962,13 @@ - + - + @@ -16451,13 +17978,13 @@ - + - + @@ -16555,13 +18082,13 @@ - + - + @@ -16569,7 +18096,7 @@ - + @@ -16599,13 +18126,13 @@ - + - + @@ -16640,13 +18167,13 @@ - + - + - + - + @@ -16703,49 +18230,49 @@ - + - + - + - + - + - + - + - + @@ -16798,6 +18325,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Singleton containing the list of remapped resources. @@ -16858,7 +18479,7 @@ - + @@ -16909,7 +18530,19 @@ - + + + + + + + + + + + + + @@ -16929,21 +18562,21 @@ - + Return the space density currently being applied to this body. - + Return the inverse of the mass of the body. - + Return the inverse of the inertia of the body. @@ -16964,14 +18597,14 @@ - + Change the angular velocity of the body. - + Return the angular velocity of the body. @@ -17083,6 +18716,12 @@ Return the collider shape index. + + + + + + @@ -17093,7 +18732,7 @@ - + Return the timestep (delta) used for the simulation. @@ -17134,13 +18773,17 @@ + + - + + + Intersect a ray in a given space, the returned object is a dictionary with the following fields: [br] @@ -17155,36 +18798,56 @@ - + + + - - - - - - - + Intersect a given shape (RID or [Shape2D]) against the space, the intersected shapes are returned in a special result object. - + + + - + + + + + + + - + - - - + + + + + + + + + + + + + + + + + + + @@ -17252,13 +18915,13 @@ - + - + @@ -17316,20 +18979,20 @@ - + - + - - - + + + @@ -17517,6 +19180,16 @@ + + + + + + + + + + @@ -17545,6 +19218,14 @@ + + + + + + + + @@ -17611,18 +19292,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -17732,13 +19449,13 @@ - + - + @@ -17794,13 +19511,13 @@ - + - + @@ -17829,6 +19546,14 @@ + + + + + + + + @@ -17913,6 +19638,12 @@ + + + + + + @@ -17925,6 +19656,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -17981,6 +19812,30 @@ PhysicsBody is an abstract base class for implementing a physics body. All PhysicsBody types inherit from it. + + + + + + + + + + + + + + + + + + + + + + + + @@ -17991,6 +19846,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -18008,13 +19887,13 @@ - + - + @@ -18069,6 +19948,14 @@ + + + + + + + + @@ -18160,7 +20047,7 @@ - + @@ -18196,33 +20083,73 @@ + + - + + + - + + + - + - + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -18288,13 +20215,13 @@ - + - + @@ -18352,20 +20279,20 @@ - + - + - - - + + + @@ -18421,19 +20348,21 @@ - + + + - - - + + + @@ -18479,6 +20408,22 @@ + + + + + + + + + + + + + + + + @@ -18632,13 +20577,13 @@ - + - + @@ -18647,14 +20592,6 @@ - - - - - - - - @@ -18691,6 +20628,22 @@ + + + + + + + + + + + + + + + + @@ -18751,6 +20704,296 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -18763,8 +21006,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -18831,6 +21208,12 @@ + + + + + + @@ -18843,6 +21226,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Result of a shape query in Physics2DServer. @@ -18892,6 +21363,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pin Joint for 2D Shapes. @@ -18919,7 +21422,7 @@ - + @@ -18937,7 +21440,7 @@ - + Returns true if "p" is inside the plane (by a very minimum treshold). @@ -19002,13 +21505,13 @@ - + - + - + - + @@ -19026,7 +21529,7 @@ - + @@ -19035,13 +21538,13 @@ - + - + - + - + @@ -19069,6 +21572,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Base container control for popups and dialogs. @@ -19085,7 +21806,7 @@ - + Popup (show the control in modal form) in the center of the screen, scalled at a ratio of size of the screen. @@ -19116,6 +21837,10 @@ + + + + This signal is emitted when a popup is about to be shown. (often used in [PopupMenu] for clearing the list of options and creating a new one according to the current context). @@ -19125,6 +21850,8 @@ + + @@ -19197,7 +21924,7 @@ - + @@ -19416,6 +22143,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -19427,6 +22184,10 @@ + + + + @@ -19466,14 +22227,14 @@ - + Set the distance threshold for disabling the portal. Every time that the portal goes beyond "distance", it disables itself, becoming the opaque color (see [method set_disabled_color]). - + Return the distance threshold for disabling the portal. Every time that the portal goes beyond "distance", it disables itself, becoming the opaque color (see [method set_disabled_color]). @@ -19494,14 +22255,14 @@ - + Set the range for auto-connecting two portals from different rooms sharing the same space. - + Return the range for auto-connecting two portals from different rooms sharing the same space. @@ -19543,9 +22304,33 @@ General purpose progres bar. Shows fill percentage from right to left. + + + + + + + + + + + + + + + + + + + + + + + + @@ -19676,13 +22461,13 @@ - + - + @@ -19698,14 +22483,14 @@ - + Returns the length of the quaternion. - + Returns the length of the quaternion, minus the square root. @@ -19723,7 +22508,7 @@ - + Perform a spherical-linear interpolation with another quaternion. @@ -19734,19 +22519,19 @@ - + - + - + - + - + @@ -19759,13 +22544,13 @@ - + - + - + - + @@ -19802,48 +22587,48 @@ - + Return the current value. - + - + Return the minimum value. - + Return the maximum value. - + Return the stepping, if step is 0, stepping is disabled. - + Return the page size, if page is 0, paging is disabled. - + Return value mapped to 0 to 1 (unit) range. @@ -19856,46 +22641,46 @@ - + - + - + Set minimum value, clamped range value to it if it"apos;s less. - + - + Set step value. If step is 0, stepping will be disabled. - + Set page size. Page is mainly used for scrollbars or anything that controls text scrolling. - + Set value mapped to 0 to 1 (unit) range, it will then be converted to the actual value within min and max. @@ -19932,7 +22717,7 @@ - + This signal is emitted when value changes. @@ -20135,6 +22920,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -20146,13 +22971,13 @@ - + - + @@ -20170,13 +22995,13 @@ - + - + @@ -20194,7 +23019,7 @@ - + @@ -20202,7 +23027,7 @@ - + @@ -20216,7 +23041,7 @@ - + @@ -20268,7 +23093,7 @@ - + @@ -20276,7 +23101,7 @@ - + @@ -20320,13 +23145,13 @@ - + - + - + - + @@ -20410,6 +23235,10 @@ + + + + @@ -20494,6 +23323,12 @@ Set the path of the resource. This is useful mainly for editors when saving/loading, and shouldn"apos;t be changed by anything else. + + + + + + @@ -20836,6 +23671,18 @@ + + + + + + + + + + + + @@ -20972,6 +23819,22 @@ Return true if selecting the text inside this richtext is allowed. + + + + + + + + + + + + + + + + @@ -21019,6 +23882,20 @@ + + + + + + + + + + + + + + @@ -21045,49 +23922,49 @@ - + - + - + - + - + - + - + - + @@ -21178,13 +24055,13 @@ - - + + - + @@ -21202,6 +24079,18 @@ + + + + + + + + + + + + @@ -21284,56 +24173,56 @@ - + Set the body mass. - + Return the body mass. - + Set the body mass given standard earth-weight (gravity 9.8). Not really useful for 2D since most measuers for this node are in pixels. - + Return the body mass given standard earth-weight (gravity 9.8). - + Set the body friction, from 0 (friction less) to 1 (full friction). - + Return the body friction. - + Set the body bounciness, from 0 (no bounce) to 1 (bounce). - + Return the body bouncyness. @@ -21354,14 +24243,14 @@ - + Set the body angular velocity. Can be used sporadically, but[b] DONT SET THIS IN EVERY FRAME [/b], because physics may be running in another thread and definitely runs at a different granularity. Use [_integrate_forces] as your process loop if you want to have precise control of the body state. - + Return the body angular velocity. This changes by physics granularity. See [set_angular_velocity]. @@ -21449,18 +24338,16 @@ - - + + - Change the body state between sleeping/active states. As a note, static bodies can never be active. - + - Return the body state. As a note, static bodies are never active. @@ -21799,13 +24686,13 @@ - + - + @@ -21815,13 +24702,13 @@ - + - + @@ -21900,7 +24787,7 @@ - + Scale the pitch (mix rate) of a voice by a ratio value "ratio". A ratio of 1.0 means the voice is unscaled. @@ -21909,7 +24796,7 @@ - + Set the volume of a voice, 0db is maximum volume (every about -6db, volume is reduced in half). "db" does in fact go from zero to negative. @@ -21918,7 +24805,7 @@ - + @@ -21926,11 +24813,11 @@ - + - + - + Set the panning of a voice. Panning goes from -1 (left) to +1 (right). Optionally, if the hardware supports 3D sound, also set depth and height (also in range -1 to +1). @@ -21941,11 +24828,11 @@ - + - + - + Set and enable a filter of a voice, with type "type" (see FILTER_* enum), cutoff (0 to 22khz) frequency and resonance (0+). @@ -21954,7 +24841,7 @@ - + Set the chorus send level of a voice (0 to 1). For setting chorus parameters, see [AudioServer]. @@ -21965,7 +24852,7 @@ - + Set the reverb send level and type of a voice (0 to 1). (see REVERB_* enum for type). @@ -21981,7 +24868,7 @@ - + @@ -21990,7 +24877,7 @@ - + @@ -21999,7 +24886,7 @@ - + @@ -22007,7 +24894,7 @@ - + @@ -22016,7 +24903,7 @@ - + @@ -22025,7 +24912,7 @@ - + @@ -22043,7 +24930,7 @@ - + @@ -22052,7 +24939,7 @@ - + @@ -22061,7 +24948,7 @@ - + @@ -22069,7 +24956,7 @@ - + @@ -22078,7 +24965,7 @@ - + @@ -22087,7 +24974,7 @@ - + @@ -22096,29 +24983,29 @@ - + - + - + - + - + - + @@ -22126,17 +25013,17 @@ - + - + - + - + @@ -22144,43 +25031,43 @@ - + - + - + - + - + - + - + @@ -22192,37 +25079,37 @@ - + - + - + - + - + - + @@ -22331,7 +25218,7 @@ - + Change the pitch scale of a currently playing voice. @@ -22340,7 +25227,7 @@ - + Change the volume scale of a currently playing voice (using dB). @@ -22368,13 +25255,13 @@ - + - + @@ -22388,80 +25275,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Scene-Based implementation of the MainLoop. @@ -22531,6 +25344,18 @@ Return true if the scene is being run inside an editor. + + + + + + + + + + + + @@ -22568,6 +25393,16 @@ Quit the application. + + + + + + + + + + @@ -22629,42 +25464,20 @@ Call a group only once, even if call is performed many times. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -22732,13 +25545,13 @@ - + - + @@ -22900,10 +25713,12 @@ - + + + @@ -22919,6 +25734,12 @@ + + + + + + @@ -22955,6 +25776,20 @@ + + + + + + + + + + + + + + @@ -22978,14 +25813,14 @@ - + Use a custom solver bias. No need to change this unless you really know what you are doing. - + Return the custom solver bias. No need to change this unless you really know what you are doing. @@ -23032,10 +25867,14 @@ - + + + + + @@ -23169,6 +26008,22 @@ Return the pose transform for bone "bone_idx". + + + + + + + + + + + + + + + + @@ -23239,6 +26094,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Base class for playing spatial 2D sound. @@ -23250,13 +26177,13 @@ - + - + @@ -23288,13 +26215,13 @@ - + - + @@ -23448,7 +26375,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + Spatial nodes receive this notifacation with their global transform changes. This means that either the current or a parent node changed it's transform. @@ -23457,6 +26410,8 @@ + + @@ -23468,13 +26423,13 @@ - + - + @@ -23544,7 +26499,7 @@ - + @@ -23552,7 +26507,7 @@ - + @@ -23682,13 +26637,13 @@ - + - + @@ -23704,13 +26659,13 @@ - + - + @@ -23777,6 +26732,10 @@ + + + + @@ -24008,6 +26967,240 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sprite frame library for AnimatedSprite. @@ -24073,18 +27266,6 @@ StaticBody implements a static collision [Node], by utilizing a rigid body in the [PhysicsServer]. Static bodies are used for static collision. For more information on physics body nodes, see [PhysicsBody]. - - - - - - - - - - - - @@ -24109,6 +27290,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -24131,7 +27336,7 @@ - + Set a constant angular velocity for the body. @@ -24145,32 +27350,32 @@ - + Return the constant angular velocity for the body. - + - + - + - + @@ -24227,6 +27432,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP Stream peer. @@ -24251,6 +27504,12 @@ + + + + + + @@ -24269,6 +27528,14 @@ + + + + + + + + @@ -24330,25 +27597,25 @@ - + - + - + - + @@ -24366,13 +27633,13 @@ - + - + @@ -24390,7 +27657,7 @@ - + @@ -24600,6 +27867,18 @@ Do a simple, case insensitive, expression matching, using ? and * wildcards. + + + + + + + + + + + + @@ -24746,7 +28025,7 @@ - + @@ -24863,14 +28142,14 @@ - + Set the default offset "offset" of the margin "margin" (see MARGIN_* enum) for a StyleBox, Controls that draw styleboxes with context inside need to know the margin, so the border of the stylebox is not occluded. - + @@ -24879,7 +28158,7 @@ - + @@ -25054,14 +28333,14 @@ - + Set an expand margin size (from enum MARGIN_*). Parts of the image below the size of the margin (and in the direction of the margin) will not expand. - + @@ -25096,13 +28375,13 @@ - + - + @@ -25112,13 +28391,13 @@ - + - + @@ -25203,6 +28482,12 @@ + + + + + + @@ -25217,15 +28502,7 @@ - - - - - - - - - + @@ -25392,6 +28669,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -25457,6 +28766,14 @@ + + + + + + + + @@ -25468,6 +28785,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -25648,6 +28987,12 @@ Return the text inside the selection. + + + + + + @@ -25765,6 +29110,48 @@ Search from end to begining. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -25868,12 +29255,16 @@ Turn on magnifying filter. - + Texture is a video surface Default flags + + + + @@ -26393,15 +29784,51 @@ Return the current tileset. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + Set the cell size. - + Return the cell size. @@ -26449,6 +29876,42 @@ Return true if tiles are to be centered in y coordinate (by default this is false and they are drawn from upper left cell corner). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -26502,11 +29965,47 @@ Clear all cells. + + + + + + + + + + + + + + + + + + + + + + + + Returned when a cell doesn't exist. + + + + + + + + + + + + @@ -26690,14 +30189,14 @@ - + Set wait time. When the time is over, it will emit timeout signal. - + Return the wait time. When the time is over, it will emit timeout signal. @@ -26742,7 +30241,7 @@ - + Return the time left for timeout if the timer is active. @@ -26845,11 +30344,11 @@ - + - + @@ -26899,7 +30398,7 @@ - + @@ -27040,6 +30539,12 @@ Return all the messages (keys). + + + + + + @@ -27083,6 +30588,10 @@ + + + + @@ -27310,6 +30819,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -27416,13 +30985,13 @@ - + - + @@ -27432,11 +31001,11 @@ - + - + - + @@ -27691,6 +31260,368 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -27748,6 +31679,10 @@ + + + + @@ -27760,6 +31695,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -27771,6 +31728,24 @@ + + + + + + + + + + + + + + + + + + @@ -27783,6 +31758,12 @@ + + + + + + @@ -27795,6 +31776,18 @@ + + + + + + + + + + + + @@ -27807,6 +31800,16 @@ + + + + + + + + + + @@ -27816,13 +31819,27 @@ - + + + + + + + + + + + + + + + @@ -27832,13 +31849,13 @@ - + - + @@ -27846,7 +31863,7 @@ - + @@ -27855,7 +31872,7 @@ - + @@ -27877,20 +31894,20 @@ - + - + Returns the length of the vector. - + @@ -27900,7 +31917,7 @@ - + Returns the result of the linear interpolation between this vector and "b", by amount "i". @@ -27914,7 +31931,7 @@ - + @@ -27924,13 +31941,13 @@ - + - + @@ -27952,22 +31969,22 @@ - + - + - + - + - + - + @@ -28055,14 +32072,14 @@ - + Perform a cubic interpolation between vectors a,b,c,d (b is current), by the given amount (i). - + @@ -28071,7 +32088,7 @@ - + @@ -28080,7 +32097,7 @@ - + @@ -28096,14 +32113,14 @@ - + Return the length of the vector. - + Return the length of the vector, without the square root step. @@ -28114,7 +32131,7 @@ - + Linearly interpolates the vector to a given one (b), by the given amount (i) @@ -28139,12 +32156,28 @@ Return a copy of the normalized vector to unit length. This is the same as v / v.length() + + + + + + + + - + + + + + + + + + @@ -28152,29 +32185,29 @@ - + Return a copy of the vector, snapped to the lowest neared multiple. - + - + - + - + - + - + @@ -28236,6 +32269,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -28281,25 +32514,25 @@ - + - + - + - + @@ -28311,7 +32544,7 @@ - + @@ -28344,7 +32577,7 @@ - + @@ -28357,8 +32590,8 @@ - - + + @@ -28372,16 +32605,6 @@ - - - - - - - - - - Creates a sub-view into the screen. @@ -28540,6 +32763,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -28558,6 +32817,18 @@ + + + + + + + + + + + + @@ -28565,10 +32836,40 @@ Get the viewport RID from the visual server. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -28593,6 +32894,12 @@ + + + + + + @@ -28611,6 +32918,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -28955,13 +33320,13 @@ - + - + @@ -29205,13 +33570,13 @@ - + - + @@ -29225,13 +33590,13 @@ - + - + @@ -29261,13 +33626,13 @@ - + - + @@ -29337,13 +33702,13 @@ - + - + @@ -29467,13 +33832,13 @@ - + - + @@ -29587,13 +33952,13 @@ - + - + @@ -29625,11 +33990,11 @@ - + - + - + @@ -29637,11 +34002,11 @@ - + - + - + @@ -29865,11 +34230,9 @@ - + - - - + @@ -29953,17 +34316,17 @@ - + - + - + @@ -29971,17 +34334,17 @@ - + - + - + @@ -29995,7 +34358,7 @@ - + @@ -30057,7 +34420,7 @@ - + @@ -30087,7 +34450,7 @@ - + @@ -30132,6 +34495,18 @@ + + + + + + + + + + + + @@ -30139,7 +34514,7 @@ - + @@ -30156,6 +34531,10 @@ + + + + @@ -30196,7 +34575,7 @@ - + @@ -30226,10 +34605,6 @@ - - - - @@ -30350,11 +34725,9 @@ - + - - - + @@ -30366,7 +34739,7 @@ - + @@ -30378,15 +34751,15 @@ - + - + - + - + - + @@ -30442,6 +34815,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -30677,6 +35070,28 @@ + + + + + + + + + + + + + + + + + + + + + + Boolean built-in type @@ -30692,7 +35107,7 @@ - + @@ -30707,6 +35122,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Integer built-in type. @@ -30722,7 +35165,7 @@ - + @@ -30737,34 +35180,4 @@ - - - Real (float) built-in type. - - - Real (float) built-in type. - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index bb0fd2e5939c..4044496953c8 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -360,17 +360,19 @@ void RasterizerGLES2::_draw_primitive(int p_points, const Vector3 *p_vertices, c /* TEXTURE API */ -Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::Format p_format, uint32_t p_flags,GLenum& r_gl_format,int &r_gl_components,bool &r_has_alpha_cache,bool &r_compressed) { +Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::Format p_format, uint32_t p_flags,GLenum& r_gl_format,GLenum& r_gl_internal_format,int &r_gl_components,bool &r_has_alpha_cache,bool &r_compressed) { r_has_alpha_cache=false; r_compressed=false; + r_gl_format=0; Image image=p_image; switch(p_format) { case Image::FORMAT_GRAYSCALE: { r_gl_components=1; - r_gl_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_SLUMINANCE_NV:GL_LUMINANCE; + r_gl_format=GL_LUMINANCE; + r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_SLUMINANCE_NV:GL_LUMINANCE; } break; case Image::FORMAT_INTENSITY: { @@ -378,14 +380,16 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (!image.empty()) image.convert(Image::FORMAT_RGBA); r_gl_components=4; - r_gl_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_GL_SRGB_ALPHA_EXT:GL_RGBA; + r_gl_format=GL_RGBA; + r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_GL_SRGB_ALPHA_EXT:GL_RGBA; r_has_alpha_cache=true; } break; case Image::FORMAT_GRAYSCALE_ALPHA: { //image.convert(Image::FORMAT_RGBA); r_gl_components=2; - r_gl_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_SLUMINANCE_ALPHA_NV:GL_LUMINANCE_ALPHA; + r_gl_format=GL_LUMINANCE_ALPHA; + r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_SLUMINANCE_ALPHA_NV:GL_LUMINANCE_ALPHA; r_has_alpha_cache=true; } break; @@ -394,7 +398,8 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (!image.empty()) image.convert(Image::FORMAT_RGB); r_gl_components=3; - r_gl_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_GL_SRGB_EXT:GL_RGB; + r_gl_format=GL_RGB; + r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_GL_SRGB_EXT:GL_RGB; } break; @@ -407,14 +412,15 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { if (srgb_supported) { - r_gl_format=_GL_SRGB_ALPHA_EXT; - } else { r_gl_format=GL_RGBA; + r_gl_internal_format=_GL_SRGB_ALPHA_EXT; + } else { + r_gl_internal_format=GL_RGBA; if (!image.empty()) image.srgb_to_linear(); } } else { - r_gl_format=GL_RGBA; + r_gl_internal_format=GL_RGBA; } r_has_alpha_cache=true; @@ -426,14 +432,15 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { if (srgb_supported) { - r_gl_format=_GL_SRGB_EXT; - } else { + r_gl_internal_format=_GL_SRGB_EXT; r_gl_format=GL_RGB; + } else { + r_gl_internal_format=GL_RGB; if (!image.empty()) image.srgb_to_linear(); } } else { - r_gl_format=GL_RGB; + r_gl_internal_format=GL_RGB; } } break; case Image::FORMAT_RGBA: { @@ -442,14 +449,16 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { if (srgb_supported) { - r_gl_format=_GL_SRGB_ALPHA_EXT; - } else { + r_gl_internal_format=_GL_SRGB_ALPHA_EXT; r_gl_format=GL_RGBA; + //r_gl_internal_format=GL_RGBA; + } else { + r_gl_internal_format=GL_RGBA; if (!image.empty()) image.srgb_to_linear(); } } else { - r_gl_format=GL_RGBA; + r_gl_internal_format=GL_RGBA; } r_has_alpha_cache=true; @@ -465,21 +474,22 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { if (srgb_supported) { - r_gl_format=_GL_SRGB_ALPHA_EXT; - } else { r_gl_format=GL_RGBA; + r_gl_internal_format=_GL_SRGB_ALPHA_EXT; + } else { + r_gl_internal_format=GL_RGBA; if (!image.empty()) image.srgb_to_linear(); } } else { - r_gl_format=GL_RGBA; + r_gl_internal_format=GL_RGBA; } r_has_alpha_cache=true; } else { r_gl_components=1; //doesn't matter much - r_gl_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV:_EXT_COMPRESSED_RGBA_S3TC_DXT1_EXT; + r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV:_EXT_COMPRESSED_RGBA_S3TC_DXT1_EXT; r_compressed=true; }; @@ -495,20 +505,21 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { if (srgb_supported) { - r_gl_format=_GL_SRGB_ALPHA_EXT; - } else { r_gl_format=GL_RGBA; + r_gl_internal_format=_GL_SRGB_ALPHA_EXT; + } else { + r_gl_internal_format=GL_RGBA; if (!image.empty()) image.srgb_to_linear(); } } else { - r_gl_format=GL_RGBA; + r_gl_internal_format=GL_RGBA; } r_has_alpha_cache=true; } else { r_gl_components=1; //doesn't matter much - r_gl_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV:_EXT_COMPRESSED_RGBA_S3TC_DXT3_EXT; + r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV:_EXT_COMPRESSED_RGBA_S3TC_DXT3_EXT; r_has_alpha_cache=true; r_compressed=true; @@ -526,20 +537,21 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { if (srgb_supported) { - r_gl_format=_GL_SRGB_ALPHA_EXT; - } else { r_gl_format=GL_RGBA; + r_gl_internal_format=_GL_SRGB_ALPHA_EXT; + } else { + r_gl_internal_format=GL_RGBA; if (!image.empty()) image.srgb_to_linear(); } } else { - r_gl_format=GL_RGBA; + r_gl_internal_format=GL_RGBA; } r_has_alpha_cache=true; } else { r_gl_components=1; //doesn't matter much - r_gl_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV:_EXT_COMPRESSED_RGBA_S3TC_DXT5_EXT; + r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV:_EXT_COMPRESSED_RGBA_S3TC_DXT5_EXT; r_has_alpha_cache=true; r_compressed=true; }; @@ -556,20 +568,21 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { if (srgb_supported) { - r_gl_format=_GL_SRGB_ALPHA_EXT; - } else { r_gl_format=GL_RGBA; + r_gl_internal_format=_GL_SRGB_ALPHA_EXT; + } else { + r_gl_internal_format=GL_RGBA; if (!image.empty()) image.srgb_to_linear(); } } else { - r_gl_format=GL_RGBA; + r_gl_internal_format=GL_RGBA; } r_has_alpha_cache=true; } else { - r_gl_format=_EXT_COMPRESSED_LUMINANCE_LATC1_EXT; + r_gl_internal_format=_EXT_COMPRESSED_LUMINANCE_LATC1_EXT; r_gl_components=1; //doesn't matter much r_compressed=true; }; @@ -586,19 +599,20 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { if (srgb_supported) { - r_gl_format=_GL_SRGB_ALPHA_EXT; - } else { r_gl_format=GL_RGBA; + r_gl_internal_format=_GL_SRGB_ALPHA_EXT; + } else { + r_gl_internal_format=GL_RGBA; if (!image.empty()) image.srgb_to_linear(); } } else { - r_gl_format=GL_RGBA; + r_gl_internal_format=GL_RGBA; } r_has_alpha_cache=true; } else { - r_gl_format=_EXT_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; + r_gl_internal_format=_EXT_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; r_gl_components=1; //doesn't matter much r_compressed=true; }; @@ -614,21 +628,22 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { if (srgb_supported) { - r_gl_format=_GL_SRGB_ALPHA_EXT; - } else { r_gl_format=GL_RGBA; + r_gl_internal_format=_GL_SRGB_ALPHA_EXT; + } else { + r_gl_internal_format=GL_RGBA; if (!image.empty()) image.srgb_to_linear(); } } else { - r_gl_format=GL_RGBA; + r_gl_internal_format=GL_RGBA; } r_has_alpha_cache=true; } else { - r_gl_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT:_EXT_COMPRESSED_RGB_PVRTC_2BPPV1_IMG; + r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT:_EXT_COMPRESSED_RGB_PVRTC_2BPPV1_IMG; r_gl_components=1; //doesn't matter much r_compressed=true; @@ -645,22 +660,23 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { if (srgb_supported) { - r_gl_format=_GL_SRGB_ALPHA_EXT; - } else { r_gl_format=GL_RGBA; + r_gl_internal_format=_GL_SRGB_ALPHA_EXT; + } else { + r_gl_internal_format=GL_RGBA; if (!image.empty()) image.srgb_to_linear(); } } else { - r_gl_format=GL_RGBA; + r_gl_internal_format=GL_RGBA; } r_has_alpha_cache=true; } else { - r_gl_format=_EXT_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; - r_gl_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT:_EXT_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; + r_gl_internal_format=_EXT_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; + r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT:_EXT_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; r_gl_components=1; //doesn't matter much r_compressed=true; @@ -677,19 +693,20 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { if (srgb_supported) { - r_gl_format=_GL_SRGB_ALPHA_EXT; - } else { r_gl_format=GL_RGBA; + r_gl_internal_format=_GL_SRGB_ALPHA_EXT; + } else { + r_gl_internal_format=GL_RGBA; if (!image.empty()) image.srgb_to_linear(); } } else { - r_gl_format=GL_RGBA; + r_gl_internal_format=GL_RGBA; } r_has_alpha_cache=true; } else { - r_gl_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT:_EXT_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; + r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT:_EXT_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; r_gl_components=1; //doesn't matter much r_compressed=true; } @@ -705,19 +722,20 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { if (srgb_supported) { - r_gl_format=_GL_SRGB_ALPHA_EXT; - } else { r_gl_format=GL_RGBA; + r_gl_internal_format=_GL_SRGB_ALPHA_EXT; + } else { + r_gl_internal_format=GL_RGBA; if (!image.empty()) image.srgb_to_linear(); } } else { - r_gl_format=GL_RGBA; + r_gl_internal_format=GL_RGBA; } r_has_alpha_cache=true; } else { - r_gl_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT:_EXT_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; + r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT:_EXT_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; r_gl_components=1; //doesn't matter much r_compressed=true; } @@ -734,21 +752,22 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { if (srgb_supported) { - r_gl_format=_GL_SRGB_EXT; - } else { r_gl_format=GL_RGB; + r_gl_internal_format=_GL_SRGB_EXT; + } else { + r_gl_internal_format=GL_RGB; if (!image.empty()) image.srgb_to_linear(); } } else { - r_gl_format=GL_RGB; + r_gl_internal_format=GL_RGB; } - r_gl_format=GL_RGB; + r_gl_internal_format=GL_RGB; } else { - r_gl_format=_EXT_ETC1_RGB8_OES; + r_gl_internal_format=_EXT_ETC1_RGB8_OES; r_gl_components=1; //doesn't matter much r_compressed=true; } @@ -762,12 +781,12 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For image.decompress(); } r_gl_components=3; - r_gl_format=GL_RGB; + r_gl_internal_format=GL_RGB; } else { - r_gl_format=_EXT_ATC_RGB_AMD; + r_gl_internal_format=_EXT_ATC_RGB_AMD; r_gl_components=1; //doesn't matter much r_compressed=true; } @@ -781,12 +800,12 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For image.decompress(); } r_gl_components=4; - r_gl_format=GL_RGBA; + r_gl_internal_format=GL_RGBA; } else { - r_gl_format=_EXT_ATC_RGBA_EXPLICIT_ALPHA_AMD; + r_gl_internal_format=_EXT_ATC_RGBA_EXPLICIT_ALPHA_AMD; r_gl_components=1; //doesn't matter much r_compressed=true; } @@ -800,12 +819,12 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For image.decompress(); } r_gl_components=4; - r_gl_format=GL_RGBA; + r_gl_internal_format=GL_RGBA; } else { - r_gl_format=_EXT_ATC_RGBA_INTERPOLATED_ALPHA_AMD; + r_gl_internal_format=_EXT_ATC_RGBA_INTERPOLATED_ALPHA_AMD; r_gl_components=1; //doesn't matter much r_compressed=true; } @@ -816,7 +835,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For if (!image.empty()) image.convert(Image::FORMAT_RGB); - r_gl_format=GL_RGB; + r_gl_internal_format=GL_RGB; r_gl_components=3; } break; @@ -827,6 +846,10 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For } } + if (r_gl_format==0) { + r_gl_format=r_gl_internal_format; + } + return image; } @@ -858,6 +881,7 @@ void RasterizerGLES2::texture_allocate(RID p_texture,int p_width, int p_height,I bool has_alpha_cache; int components; GLenum format; + GLenum internal_format; bool compressed; int po2_width = nearest_power_of_2(p_width); @@ -876,7 +900,7 @@ void RasterizerGLES2::texture_allocate(RID p_texture,int p_width, int p_height,I texture->flags=p_flags; texture->target = (p_flags & VS::TEXTURE_FLAG_CUBEMAP) ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D; - _get_gl_image_and_format(Image(),texture->format,texture->flags,format,components,has_alpha_cache,compressed); + _get_gl_image_and_format(Image(),texture->format,texture->flags,format,internal_format,components,has_alpha_cache,compressed); bool scale_textures = !compressed && !(p_flags&VS::TEXTURE_FLAG_VIDEO_SURFACE) && (!npo2_textures_available || p_flags&VS::TEXTURE_FLAG_MIPMAPS); @@ -894,6 +918,7 @@ void RasterizerGLES2::texture_allocate(RID p_texture,int p_width, int p_height,I texture->gl_components_cache=components; texture->gl_format_cache=format; + texture->gl_internal_format_cache=internal_format; texture->format_has_alpha=has_alpha_cache; texture->compressed=compressed; texture->has_alpha=false; //by default it doesn't have alpha unless something with alpha is blitteds @@ -908,7 +933,7 @@ void RasterizerGLES2::texture_allocate(RID p_texture,int p_width, int p_height,I if (p_flags&VS::TEXTURE_FLAG_VIDEO_SURFACE) { //prealloc if video - glTexImage2D(texture->target, 0, format, p_width, p_height, 0, format, GL_UNSIGNED_BYTE,NULL); + glTexImage2D(texture->target, 0, internal_format, p_width, p_height, 0, format, GL_UNSIGNED_BYTE,NULL); } texture->active=true; @@ -926,6 +951,7 @@ void RasterizerGLES2::texture_set_data(RID p_texture,const Image& p_image,VS::Cu int components; GLenum format; + GLenum internal_format; bool alpha; bool compressed; @@ -933,7 +959,7 @@ void RasterizerGLES2::texture_set_data(RID p_texture,const Image& p_image,VS::Cu texture->image[p_cube_side]=p_image; } - Image img = _get_gl_image_and_format(p_image, p_image.get_format(),texture->flags,format,components,alpha,compressed); + Image img = _get_gl_image_and_format(p_image, p_image.get_format(),texture->flags,format,internal_format,components,alpha,compressed); if (texture->alloc_width != img.get_width() || texture->alloc_height != img.get_height()) { @@ -1017,7 +1043,7 @@ void RasterizerGLES2::texture_set_data(RID p_texture,const Image& p_image,VS::Cu if (texture->flags&VS::TEXTURE_FLAG_VIDEO_SURFACE) { glTexSubImage2D( blit_target, i, 0,0,w,h,format,GL_UNSIGNED_BYTE,&read[ofs] ); } else { - glTexImage2D(blit_target, i, format, w, h, 0, format, GL_UNSIGNED_BYTE,&read[ofs]); + glTexImage2D(blit_target, i, internal_format, w, h, 0, format, GL_UNSIGNED_BYTE,&read[ofs]); } } diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h index 91395054d9ad..27f7848b1367 100644 --- a/drivers/gles2/rasterizer_gles2.h +++ b/drivers/gles2/rasterizer_gles2.h @@ -106,7 +106,7 @@ class RasterizerGLES2 : public Rasterizer { Vector skel_default; - Image _get_gl_image_and_format(const Image& p_image, Image::Format p_format, uint32_t p_flags,GLenum& r_gl_format,int &r_gl_components,bool &r_has_alpha_cache,bool &r_compressed); + Image _get_gl_image_and_format(const Image& p_image, Image::Format p_format, uint32_t p_flags,GLenum& r_gl_format,GLenum& r_gl_internal_format,int &r_gl_components,bool &r_has_alpha_cache,bool &r_compressed); class RenderTarget; @@ -119,6 +119,7 @@ class RasterizerGLES2 : public Rasterizer { GLenum target; GLenum gl_format_cache; + GLenum gl_internal_format_cache; int gl_components_cache; int data_size; //original data size, useful for retrieving back bool has_alpha; diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index 316397ed8017..6fc20f36f73a 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -102,6 +102,9 @@ Error ImageLoaderPNG::_load_image(void *rf_up,png_rw_ptr p_func,Image *p_image) png_read_info(png, info); png_get_IHDR(png, info, &width, &height, &depth, &color, NULL, NULL, NULL); + png_textp t; + //https://svn.gov.pt/projects/ccidadao/repository/middleware-offline/trunk/_src/eidmw/FreeImagePTEiD/Source/FreeImage/PluginPNG.cpp + //png_get_text(png,info,) /* printf("Image width:%i\n", width); printf("Image Height:%i\n", height); diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp index a898f6e61818..9b394e8a8cf8 100644 --- a/drivers/png/resource_saver_png.cpp +++ b/drivers/png/resource_saver_png.cpp @@ -30,6 +30,7 @@ #include "scene/resources/texture.h" #include "drivers/png/png.h" #include "os/file_access.h" +#include "globals.h" static void _write_png_data(png_structp png_ptr,png_bytep data, png_size_t p_length) { @@ -165,6 +166,42 @@ Error ResourceSaverPNG::save(const String &p_path,const RES& p_resource,uint32_t memdelete(f); + if (true) { + + bool global_filter = Globals::get_singleton()->get("image_loader/filter"); + bool global_mipmaps = Globals::get_singleton()->get("image_loader/gen_mipmaps"); + bool global_repeat = Globals::get_singleton()->get("image_loader/repeat"); + + String text; + + if (global_filter!=bool(texture->get_flags()&Texture::FLAG_FILTER)) { + text+=bool(texture->get_flags()&Texture::FLAG_FILTER)?"filter=true\n":"filter=false\n"; + } + if (global_mipmaps!=bool(texture->get_flags()&Texture::FLAG_MIPMAPS)) { + text+=bool(texture->get_flags()&Texture::FLAG_FILTER)?"gen_mipmaps=true\n":"gen_mipmaps=false\n"; + } + if (global_repeat!=bool(texture->get_flags()&Texture::FLAG_REPEAT)) { + text+=bool(texture->get_flags()&Texture::FLAG_FILTER)?"repeat=true\n":"repeat=false\n"; + } + if (bool(texture->get_flags()&Texture::FLAG_ANISOTROPIC_FILTER)) { + text+="anisotropic=true\n"; + } + if (bool(texture->get_flags()&Texture::FLAG_CONVERT_TO_LINEAR)) { + text+="tolinear=true\n"; + } + + if (text!="" || FileAccess::exists(p_path+".flags")) { + + f = FileAccess::open(p_path+".flags",FileAccess::WRITE); + if (f) { + + f->store_string(text); + memdelete(f); + } + } + } + + /* cleanup heap allocation */ return OK; diff --git a/drivers/theoraplayer/video_stream_theoraplayer.cpp b/drivers/theoraplayer/video_stream_theoraplayer.cpp index b2ff8062cccd..04210f0209c7 100644 --- a/drivers/theoraplayer/video_stream_theoraplayer.cpp +++ b/drivers/theoraplayer/video_stream_theoraplayer.cpp @@ -306,18 +306,28 @@ int VideoStreamTheoraplayer::get_pending_frame_count() const { if (!clip) return 0; - if (!frame.empty()) - return 1; + TheoraVideoFrame* f = clip->getNextFrame(); + return f ? 1 : 0; +}; + + +void VideoStreamTheoraplayer::pop_frame(Ref p_tex) { TheoraVideoFrame* f = clip->getNextFrame(); - if (!f) - return 0; + if (!f) { + return; + }; + +#ifdef GLES2_ENABLED +// RasterizerGLES2* r = RasterizerGLES2::get_singleton(); +// r->_texture_set_data(p_tex, f->mBpp == 3 ? Image::Format_RGB : Image::Format_RGBA, f->mBpp, w, h, f->getBuffer()); + +#endif float w=clip->getWidth(),h=clip->getHeight(); int imgsize = w * h * f->mBpp; int size = f->getStride() * f->getHeight() * f->mBpp; - DVector data; data.resize(imgsize); DVector::Write wr = data.write(); uint8_t* ptr = wr.ptr(); @@ -329,24 +339,32 @@ int VideoStreamTheoraplayer::get_pending_frame_count() const { copymem(ptr + dstofs, f->getBuffer() + dstofs, w * f->mBpp); }; */ - frame = Image(); + Image frame = Image(); frame.create(w, h, 0, f->mBpp == 3 ? Image::FORMAT_RGB : Image::FORMAT_RGBA, data); clip->popFrame(); - return 1; + if (p_tex->get_width() == 0) { + p_tex->create(frame.get_width(),frame.get_height(),frame.get_format(),Texture::FLAG_VIDEO_SURFACE|Texture::FLAG_FILTER); + p_tex->set_data(frame); + } else { + + p_tex->set_data(frame); + }; }; +/* Image VideoStreamTheoraplayer::pop_frame() { Image ret = frame; frame = Image(); return ret; }; +*/ Image VideoStreamTheoraplayer::peek_frame() const { - return frame; + return Image(); }; void VideoStreamTheoraplayer::update(float p_time) { @@ -386,7 +404,7 @@ void VideoStreamTheoraplayer::set_file(const String& p_file) { if (p_file.find(".mp4") != -1) { std::string file = p_file.replace("res://", "").utf8().get_data(); - clip = mgr->createVideoClip(file); + clip = mgr->createVideoClip(file, TH_BGRX, 16); memdelete(f); } else { diff --git a/drivers/theoraplayer/video_stream_theoraplayer.h b/drivers/theoraplayer/video_stream_theoraplayer.h index 063bf389532a..67a2db710b32 100644 --- a/drivers/theoraplayer/video_stream_theoraplayer.h +++ b/drivers/theoraplayer/video_stream_theoraplayer.h @@ -3,6 +3,7 @@ #include "scene/resources/video_stream.h" #include "io/resource_loader.h" +#include "scene/resources/texture.h" class TheoraVideoManager; class TheoraVideoClip; @@ -11,7 +12,7 @@ class VideoStreamTheoraplayer : public VideoStream { OBJ_TYPE(VideoStreamTheoraplayer,VideoStream); - mutable Image frame; + mutable DVector data; TheoraVideoManager* mgr; TheoraVideoClip* clip; bool started; @@ -37,7 +38,7 @@ public: virtual float get_length() const; virtual int get_pending_frame_count() const; - virtual Image pop_frame(); + virtual void pop_frame(Ref p_tex); virtual Image peek_frame() const; void update(float p_time); diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index 4c5646829729..5595db95dedd 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp @@ -65,18 +65,18 @@ bool GDCompiler::_create_unary_operator(CodeGen& codegen,const GDParser::Operato return true; } -bool GDCompiler::_create_binary_operator(CodeGen& codegen,const GDParser::OperatorNode *on,Variant::Operator op, int p_stack_level) { +bool GDCompiler::_create_binary_operator(CodeGen& codegen,const GDParser::OperatorNode *on,Variant::Operator op, int p_stack_level,bool p_initializer) { ERR_FAIL_COND_V(on->arguments.size()!=2,false); - int src_address_a = _parse_expression(codegen,on->arguments[0],p_stack_level); + int src_address_a = _parse_expression(codegen,on->arguments[0],p_stack_level,false,p_initializer); if (src_address_a<0) return false; if (src_address_a&GDFunction::ADDR_TYPE_STACK<arguments[1],p_stack_level); + int src_address_b = _parse_expression(codegen,on->arguments[1],p_stack_level,false,p_initializer); if (src_address_b<0) return false; @@ -111,6 +111,7 @@ int GDCompiler::_parse_assign_right_expression(CodeGen& codegen,const GDParser:: Variant::Operator var_op=Variant::OP_MAX; + switch(p_expression->op) { case GDParser::OperatorNode::OP_ASSIGN_ADD: var_op=Variant::OP_ADD; break; @@ -123,6 +124,7 @@ int GDCompiler::_parse_assign_right_expression(CodeGen& codegen,const GDParser:: case GDParser::OperatorNode::OP_ASSIGN_BIT_AND: var_op=Variant::OP_BIT_AND; break; case GDParser::OperatorNode::OP_ASSIGN_BIT_OR: var_op=Variant::OP_BIT_OR; break; case GDParser::OperatorNode::OP_ASSIGN_BIT_XOR: var_op=Variant::OP_BIT_XOR; break; + case GDParser::OperatorNode::OP_INIT_ASSIGN: case GDParser::OperatorNode::OP_ASSIGN: { //none @@ -133,12 +135,14 @@ int GDCompiler::_parse_assign_right_expression(CodeGen& codegen,const GDParser:: } } + bool initializer = p_expression->op==GDParser::OperatorNode::OP_INIT_ASSIGN; + if (var_op==Variant::OP_MAX) { - return _parse_expression(codegen,p_expression->arguments[1],p_stack_level); + return _parse_expression(codegen,p_expression->arguments[1],p_stack_level,false,initializer); } - if (!_create_binary_operator(codegen,p_expression,var_op,p_stack_level)) + if (!_create_binary_operator(codegen,p_expression,var_op,p_stack_level,initializer)) return -1; int dst_addr=(p_stack_level)|(GDFunction::ADDR_TYPE_STACK<type) { @@ -165,17 +169,16 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre StringName identifier = in->name; // TRY STACK! - if (codegen.stack_identifiers.has(identifier)) { + if (!p_initializer && codegen.stack_identifiers.has(identifier)) { int pos = codegen.stack_identifiers[identifier]; return pos|(GDFunction::ADDR_TYPE_STACK_VARIABLE<_static) { // TRY MEMBER VARIABLES! - //static function if (codegen.script->member_indices.has(identifier)) { @@ -686,6 +689,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre case GDParser::OperatorNode::OP_ASSIGN_BIT_AND: case GDParser::OperatorNode::OP_ASSIGN_BIT_OR: case GDParser::OperatorNode::OP_ASSIGN_BIT_XOR: + case GDParser::OperatorNode::OP_INIT_ASSIGN: case GDParser::OperatorNode::OP_ASSIGN: { ERR_FAIL_COND_V(on->arguments.size()!=2,-1); @@ -843,7 +847,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre int slevel = p_stack_level; - int dst_address_a = _parse_expression(codegen,on->arguments[0],slevel); + int dst_address_a = _parse_expression(codegen,on->arguments[0],slevel,false,on->op==GDParser::OperatorNode::OP_INIT_ASSIGN); if (dst_address_a<0) return -1; diff --git a/modules/gdscript/gd_compiler.h b/modules/gdscript/gd_compiler.h index cda221dab00f..b83d0ded4b53 100644 --- a/modules/gdscript/gd_compiler.h +++ b/modules/gdscript/gd_compiler.h @@ -153,11 +153,11 @@ class GDCompiler { void _set_error(const String& p_error,const GDParser::Node *p_node); bool _create_unary_operator(CodeGen& codegen,const GDParser::OperatorNode *on,Variant::Operator op, int p_stack_level); - bool _create_binary_operator(CodeGen& codegen,const GDParser::OperatorNode *on,Variant::Operator op, int p_stack_level); + bool _create_binary_operator(CodeGen& codegen,const GDParser::OperatorNode *on,Variant::Operator op, int p_stack_level,bool p_initializer=false); //int _parse_subexpression(CodeGen& codegen,const GDParser::BlockNode *p_block,const GDParser::Node *p_expression); int _parse_assign_right_expression(CodeGen& codegen,const GDParser::OperatorNode *p_expression, int p_stack_level); - int _parse_expression(CodeGen& codegen,const GDParser::Node *p_expression, int p_stack_level,bool p_root=false); + int _parse_expression(CodeGen& codegen,const GDParser::Node *p_expression, int p_stack_level,bool p_root=false,bool p_initializer=false); Error _parse_block(CodeGen& codegen,const GDParser::BlockNode *p_block,int p_stack_level=0,int p_break_addr=-1,int p_continue_addr=-1); Error _parse_function(GDScript *p_script,const GDParser::ClassNode *p_class,const GDParser::FunctionNode *p_func); Error _parse_class(GDScript *p_script,GDScript *p_owner,const GDParser::ClassNode *p_class); diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index d1f511b46ed5..b1db087fb38e 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -33,6 +33,7 @@ void GDScriptLanguage::get_comment_delimiters(List *p_delimiters) const { p_delimiters->push_back("#"); + p_delimiters->push_back("\"\"\""); } void GDScriptLanguage::get_string_delimiters(List *p_delimiters) const { diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index 659e19a9d044..dc6b0ff962d8 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -2429,7 +2429,7 @@ void GDParser::_parse_class(ClassNode *p_class) { id->name=member.identifier; OperatorNode *op = alloc_node(); - op->op=OperatorNode::OP_ASSIGN; + op->op=OperatorNode::OP_INIT_ASSIGN; op->arguments.push_back(id); op->arguments.push_back(subexpr); diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h index 16a9a8529060..5fac34396ca7 100644 --- a/modules/gdscript/gd_parser.h +++ b/modules/gdscript/gd_parser.h @@ -215,6 +215,7 @@ public: OP_MOD, OP_SHIFT_LEFT, OP_SHIFT_RIGHT, + OP_INIT_ASSIGN, OP_ASSIGN, OP_ASSIGN_ADD, OP_ASSIGN_SUB, diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index b20fc51a0376..8738185d4138 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -2448,6 +2448,7 @@ void GDScriptLanguage::get_reserved_words(List *p_words) const { "if" , "in" , "null" , + "not" , "return" , "self" , "while" , diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 0fa83b9eb480..0f6ee4161654 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -239,8 +239,7 @@ void GDTokenizerText::_advance() { bool is_node_path = false; - bool is_string = false; - bool is_string_alt = false; + StringMode string_mode=STRING_DOUBLE_QUOTE; switch(GETCHAR(0)) { case 0: @@ -538,22 +537,35 @@ void GDTokenizerText::_advance() { is_node_path=true; case '\'': - is_string_alt = true; + string_mode=STRING_SINGLE_QUOTE; case '"': { - is_string = is_string_alt ? false : true; int i=1; + if (string_mode==STRING_DOUBLE_QUOTE && GETCHAR(i)=='"' && GETCHAR(i+1)=='"') { + i+=2; + string_mode=STRING_MULTILINE; + + } + + String str; while(true) { - if (CharType(GETCHAR(i)==0)) { + if (CharType(GETCHAR(i))==0) { _make_error("Unterminated String"); return; - } else if( CharType(GETCHAR(i)=='"') && is_string ) { + } else if( string_mode==STRING_DOUBLE_QUOTE && CharType(GETCHAR(i))=='"' ) { break; - } else if( CharType(GETCHAR(i)=='\'') && is_string_alt ) { - break; - } else if (CharType(GETCHAR(i)=='\\')) { + } else if( string_mode==STRING_SINGLE_QUOTE && CharType(GETCHAR(i))=='\'' ) { + break; + } else if( string_mode==STRING_MULTILINE && CharType(GETCHAR(i))=='\"' && CharType(GETCHAR(i+1))=='\"' && CharType(GETCHAR(i+2))=='\"') { + i+=2; + break; + } else if( string_mode!=STRING_MULTILINE && CharType(GETCHAR(i))=='\n') { + _make_error("Unexpected EOL at String."); + return; + + } else if (CharType(GETCHAR(i))=='\\') { //escaped characters... i++; CharType next = GETCHAR(i); diff --git a/modules/gdscript/gd_tokenizer.h b/modules/gdscript/gd_tokenizer.h index 4f9522fb560d..fe7bfa73ca5c 100644 --- a/modules/gdscript/gd_tokenizer.h +++ b/modules/gdscript/gd_tokenizer.h @@ -122,6 +122,13 @@ public: }; protected: + + enum StringMode { + STRING_SINGLE_QUOTE, + STRING_DOUBLE_QUOTE, + STRING_MULTILINE + }; + static const char* token_names[TK_MAX]; public: static const char *get_token_name(Token p_token); diff --git a/platform/osx/audio_driver_osx.cpp b/platform/osx/audio_driver_osx.cpp index 8f28e8ff63d3..638ac7e50480 100644 --- a/platform/osx/audio_driver_osx.cpp +++ b/platform/osx/audio_driver_osx.cpp @@ -101,7 +101,16 @@ OSStatus AudioDriverOSX::output_callback(void *inRefCon, AudioBuffer *abuf; AudioDriverOSX* ad = (AudioDriverOSX*)inRefCon; - if (!ad->active) { + bool mix = true; + + if (!ad->active) + mix = false; + else if (ad->mutex) { + mix = ad->mutex->try_lock() == OK; + }; + + + if (!mix) { for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) { abuf = &ioData->mBuffers[i]; zeromem(abuf->mData, abuf->mDataByteSize); @@ -120,9 +129,9 @@ OSStatus AudioDriverOSX::output_callback(void *inRefCon, while (frames_left) { int frames = MIN(frames_left, ad->buffer_frames); - ad->lock(); + //ad->lock(); ad->audio_server_process(frames, ad->samples_in); - ad->unlock(); + //ad->unlock(); for(int i = 0; i < frames * ad->channels; i++) { @@ -134,6 +143,9 @@ OSStatus AudioDriverOSX::output_callback(void *inRefCon, }; }; + if (ad->mutex) + ad->mutex->unlock(); + return 0; }; @@ -149,12 +161,27 @@ AudioDriverSW::OutputFormat AudioDriverOSX::get_output_format() const { return OUTPUT_STEREO; }; -void AudioDriverOSX::lock() {}; -void AudioDriverOSX::unlock() {}; +void AudioDriverOSX::lock() { + if (active && mutex) + mutex->lock(); +}; +void AudioDriverOSX::unlock() { + if (active && mutex) + mutex->unlock(); +}; void AudioDriverOSX::finish() { memdelete_arr(samples_in); }; +AudioDriverOSX::AudioDriverOSX() { + + mutex=Mutex::create();//NULL; +}; + +AudioDriverOSX::~AudioDriverOSX() { + +}; + #endif diff --git a/platform/osx/audio_driver_osx.h b/platform/osx/audio_driver_osx.h index daa388fb8603..c0336eb81696 100644 --- a/platform/osx/audio_driver_osx.h +++ b/platform/osx/audio_driver_osx.h @@ -39,6 +39,7 @@ class AudioDriverOSX : public AudioDriverSW { AudioComponentInstance audio_unit; bool active; + Mutex *mutex; int channels; int32_t* samples_in; @@ -64,6 +65,9 @@ public: virtual void lock(); virtual void unlock(); virtual void finish(); + + AudioDriverOSX(); + ~AudioDriverOSX(); }; #endif diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 16f70b60d0a9..be92ee8f6dad 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -209,6 +209,16 @@ def configure(env): env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED']) env.Append(CCFLAGS=['-DGLES2_ENABLED','-DGLES1_ENABLED','-DGLEW_ENABLED']) env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','wsock32','kernel32']) + + if (env["bits"]=="32" and env["mingw64_for_32"]!="yes"): +# env.Append(LIBS=['gcc_s']) + #--with-arch=i686 + env.Append(CPPFLAGS=['-march=i686']) + env.Append(LINKFLAGS=['-march=i686']) + + + + #'d3dx9d' env.Append(CPPFLAGS=['-DMINGW_ENABLED']) env.Append(LINKFLAGS=['-g']) diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index e5d9872a28f5..56359e6015a3 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -156,13 +156,13 @@ bool CollisionObject2D::_get(const StringName& p_name,Variant &r_ret) const { void CollisionObject2D::_get_property_list( List *p_list) const { - p_list->push_back( PropertyInfo(Variant::INT,"shape_count",PROPERTY_HINT_RANGE,"0,256,1",PROPERTY_USAGE_NOEDITOR) ); + p_list->push_back( PropertyInfo(Variant::INT,"shape_count",PROPERTY_HINT_RANGE,"0,256,1",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_NO_INSTANCE_STATE) ); for(int i=0;ipush_back( PropertyInfo(Variant::OBJECT,path+"shape",PROPERTY_HINT_RESOURCE_TYPE,"Shape2D",PROPERTY_USAGE_NOEDITOR) ); - p_list->push_back( PropertyInfo(Variant::TRANSFORM,path+"transform",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR) ); - p_list->push_back( PropertyInfo(Variant::BOOL,path+"trigger",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR) ); + p_list->push_back( PropertyInfo(Variant::OBJECT,path+"shape",PROPERTY_HINT_RESOURCE_TYPE,"Shape2D",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_NO_INSTANCE_STATE) ); + p_list->push_back( PropertyInfo(Variant::TRANSFORM,path+"transform",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_NO_INSTANCE_STATE) ); + p_list->push_back( PropertyInfo(Variant::BOOL,path+"trigger",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_NO_INSTANCE_STATE) ); } } diff --git a/scene/3d/body_shape.cpp b/scene/3d/body_shape.cpp index b291ce7c72cc..947acc65495f 100644 --- a/scene/3d/body_shape.cpp +++ b/scene/3d/body_shape.cpp @@ -44,7 +44,6 @@ void CollisionShape::_update_body() { - if (get_parent() && get_parent()->cast_to()) get_parent()->cast_to()->_update_shapes_from_children(); @@ -72,7 +71,7 @@ void CollisionShape::make_convex_from_brothers() { } } - +/* void CollisionShape::_update_indicator() { @@ -300,9 +299,12 @@ void CollisionShape::_update_indicator() { } - +*/ void CollisionShape::_add_to_collision_object(Object* p_cshape) { + if (unparenting) + return; + CollisionObject *co=p_cshape->cast_to(); ERR_FAIL_COND(!co); @@ -318,22 +320,25 @@ void CollisionShape::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_ENTER_WORLD: { - indicator_instance = VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario()); + case NOTIFICATION_ENTER_SCENE: { + unparenting=false; + + //indicator_instance = VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario()); } break; case NOTIFICATION_TRANSFORM_CHANGED: { - VisualServer::get_singleton()->instance_set_transform(indicator_instance,get_global_transform()); + // VisualServer::get_singleton()->instance_set_transform(indicator_instance,get_global_transform()); if (updating_body) { _update_body(); } } break; - case NOTIFICATION_EXIT_WORLD: { - if (indicator_instance.is_valid()) { + case NOTIFICATION_EXIT_SCENE: { + /* if (indicator_instance.is_valid()) { VisualServer::get_singleton()->free(indicator_instance); indicator_instance=RID(); - } + }*/ } break; case NOTIFICATION_UNPARENTED: { + unparenting=true; if (updating_body) _update_body(); } break; @@ -411,15 +416,16 @@ bool CollisionShape::is_trigger() const{ CollisionShape::CollisionShape() { - indicator = VisualServer::get_singleton()->mesh_create(); + //indicator = VisualServer::get_singleton()->mesh_create(); updating_body=true; + unparenting=false; trigger=false; } CollisionShape::~CollisionShape() { if (!shape.is_null()) shape->unregister_owner(this); - VisualServer::get_singleton()->free(indicator); + //VisualServer::get_singleton()->free(indicator); } #if 0 diff --git a/scene/3d/body_shape.h b/scene/3d/body_shape.h index d1cb229f7021..b3fbaca17820 100644 --- a/scene/3d/body_shape.h +++ b/scene/3d/body_shape.h @@ -37,19 +37,23 @@ class CollisionShape : public Spatial { OBJ_TYPE( CollisionShape, Spatial ); OBJ_CATEGORY("3D Physics Nodes"); + Ref shape; + + /* RID _get_visual_instance_rid() const; - Ref shape; void _update_indicator(); RID material; RID indicator; RID indicator_instance; + */ void resource_changed(RES res); bool updating_body; + bool unparenting; bool trigger; void _update_body(); diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp index e9d3e739060f..47d29cec1c12 100644 --- a/scene/3d/collision_object.cpp +++ b/scene/3d/collision_object.cpp @@ -160,13 +160,13 @@ bool CollisionObject::_get(const StringName& p_name,Variant &r_ret) const { void CollisionObject::_get_property_list( List *p_list) const { - p_list->push_back( PropertyInfo(Variant::INT,"shape_count",PROPERTY_HINT_RANGE,"0,256,1",PROPERTY_USAGE_NOEDITOR) ); + p_list->push_back( PropertyInfo(Variant::INT,"shape_count",PROPERTY_HINT_RANGE,"0,256,1",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_NO_INSTANCE_STATE) ); for(int i=0;ipush_back( PropertyInfo(Variant::OBJECT,path+"shape",PROPERTY_HINT_RESOURCE_TYPE,"Shape",PROPERTY_USAGE_NOEDITOR) ); - p_list->push_back( PropertyInfo(Variant::TRANSFORM,path+"transform",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR) ); - p_list->push_back( PropertyInfo(Variant::BOOL,path+"trigger",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR) ); + p_list->push_back( PropertyInfo(Variant::OBJECT,path+"shape",PROPERTY_HINT_RESOURCE_TYPE,"Shape",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_NO_INSTANCE_STATE) ); + p_list->push_back( PropertyInfo(Variant::TRANSFORM,path+"transform",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_NO_INSTANCE_STATE) ); + p_list->push_back( PropertyInfo(Variant::BOOL,path+"trigger",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_NO_INSTANCE_STATE) ); } } diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp index 4d8c9cf7a520..f795f935ae9e 100644 --- a/scene/3d/interpolated_camera.cpp +++ b/scene/3d/interpolated_camera.cpp @@ -50,7 +50,7 @@ void InterpolatedCamera::_notification(int p_what) { float delta = speed*get_process_delta_time(); Transform target_xform = node->get_global_transform(); - Transform local_transform = get_transform(); + Transform local_transform = get_global_transform(); local_transform = local_transform.interpolate_with(target_xform,delta); set_global_transform(local_transform); @@ -136,7 +136,7 @@ void InterpolatedCamera::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_target_path","target_path"),&InterpolatedCamera::set_target_path); ObjectTypeDB::bind_method(_MD("get_target_path"),&InterpolatedCamera::get_target_path); - ObjectTypeDB::bind_method(_MD("set_target","target"),&InterpolatedCamera::_set_target); + ObjectTypeDB::bind_method(_MD("set_target","target:Camera"),&InterpolatedCamera::_set_target); ObjectTypeDB::bind_method(_MD("set_speed","speed"),&InterpolatedCamera::set_speed); ObjectTypeDB::bind_method(_MD("get_speed"),&InterpolatedCamera::get_speed); diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 7745ce11fc45..cf9fcfa72a5f 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -346,6 +346,8 @@ bool BaseButton::get_click_on_press() const { } + + void BaseButton::_bind_methods() { ObjectTypeDB::bind_method(_MD("_input_event"),&BaseButton::_input_event); @@ -358,6 +360,7 @@ void BaseButton::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_disabled"),&BaseButton::is_disabled); ObjectTypeDB::bind_method(_MD("set_click_on_press","enable"),&BaseButton::set_click_on_press); ObjectTypeDB::bind_method(_MD("get_click_on_press"),&BaseButton::get_click_on_press); + ObjectTypeDB::bind_method(_MD("get_draw_mode"),&BaseButton::get_draw_mode); ADD_SIGNAL( MethodInfo("pressed" ) ); ADD_SIGNAL( MethodInfo("toggled", PropertyInfo( Variant::BOOL,"pressed") ) ); @@ -365,6 +368,11 @@ void BaseButton::_bind_methods() { ADD_PROPERTY( PropertyInfo( Variant::BOOL, "toggle_mode"), _SCS("set_toggle_mode"), _SCS("is_toggle_mode")); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "click_on_press"), _SCS("set_click_on_press"), _SCS("get_click_on_press")); + BIND_CONSTANT( DRAW_NORMAL ); + BIND_CONSTANT( DRAW_PRESSED ); + BIND_CONSTANT( DRAW_HOVER ); + BIND_CONSTANT( DRAW_DISABLED ); + } BaseButton::BaseButton() { diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h index a2c640b9cfb1..a376591ebbd3 100644 --- a/scene/gui/base_button.h +++ b/scene/gui/base_button.h @@ -61,15 +61,8 @@ class BaseButton : public Control { protected: - enum DrawMode { - DRAW_NORMAL, - DRAW_PRESSED, - DRAW_HOVER, - DRAW_DISABLED, - }; - DrawMode get_draw_mode() const; virtual void pressed(); virtual void toggled(bool p_pressed); @@ -78,7 +71,16 @@ protected: void _notification(int p_what); public: - + + enum DrawMode { + DRAW_NORMAL, + DRAW_PRESSED, + DRAW_HOVER, + DRAW_DISABLED, + }; + + DrawMode get_draw_mode() const; + /* Signals */ bool is_pressed() const; ///< return wether button is pressed (toggled in) @@ -101,4 +103,6 @@ public: }; +VARIANT_ENUM_CAST( BaseButton::DrawMode ); + #endif diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index 9a1c07052916..0d77560d7bca 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -45,20 +45,15 @@ void VideoPlayer::_notification(int p_notification) { return; if (paused) return; + if (!stream->is_playing()) + return; stream->update(get_scene()->get_idle_process_time()); - while (stream->get_pending_frame_count()) { - - Image img = stream->pop_frame(); - if (texture->get_width() == 0) { - texture->create(img.get_width(),img.get_height(),img.get_format(),Texture::FLAG_VIDEO_SURFACE|Texture::FLAG_FILTER); - update(); - minimum_size_changed(); - } else { - - if (stream->get_pending_frame_count() == 0) - texture->set_data(img); - }; + int prev_width = texture->get_width(); + stream->pop_frame(texture); + if (prev_width == 0) { + update(); + minimum_size_changed(); }; } break; @@ -257,9 +252,9 @@ void VideoPlayer::_bind_methods() { VideoPlayer::VideoPlayer() { volume=1; - loops=false; - paused=false; - autoplay=false; + loops = false; + paused = false; + autoplay = false; expand = true; loops = false; }; diff --git a/scene/io/resource_format_image.cpp b/scene/io/resource_format_image.cpp index b0fcf9717b0d..16c2ec97068a 100644 --- a/scene/io/resource_format_image.cpp +++ b/scene/io/resource_format_image.cpp @@ -131,14 +131,55 @@ RES ResourceFormatLoaderImage::load(const String &p_path,const String& p_origina uint32_t flags=0; - if (bool(GLOBAL_DEF("image_loader/filter",true))) + + FileAccess *f2 = FileAccess::open(p_path+".flags",FileAccess::READ); + Map flags_found; + if (f2) { + + while(!f2->eof_reached()) { + String l2 = f2->get_line(); + int eqpos = l2.find("="); + if (eqpos!=-1) { + String flag=l2.substr(0,eqpos).strip_edges(); + String val=l2.substr(eqpos+1,l2.length()).strip_edges().to_lower(); + flags_found[flag]=(val=="true" || val=="1")?true:false; + } + } + memdelete(f2); + } + + + if (flags_found.has("filter")) { + if (flags_found["filter"]) + flags|=Texture::FLAG_FILTER; + } else if (bool(GLOBAL_DEF("image_loader/filter",true))) { flags|=Texture::FLAG_FILTER; - if (bool(GLOBAL_DEF("image_loader/gen_mipmaps",true))) + } + + + if (flags_found.has("gen_mipmaps")) { + if (flags_found["gen_mipmaps"]) + flags|=Texture::FLAG_MIPMAPS; + } else if (bool(GLOBAL_DEF("image_loader/gen_mipmaps",true))) { flags|=Texture::FLAG_MIPMAPS; - if (bool(GLOBAL_DEF("image_loader/repeat",false))) + } + + if (flags_found.has("repeat")) { + if (flags_found["repeat"]) + flags|=Texture::FLAG_REPEAT; + } else if (bool(GLOBAL_DEF("image_loader/repeat",true))) { flags|=Texture::FLAG_REPEAT; + } + if (flags_found.has("anisotropic")) { + if (flags_found["anisotropic"]) + flags|=Texture::FLAG_ANISOTROPIC_FILTER; + } + if (flags_found.has("tolinear")) { + if (flags_found["tolinear"]) + flags|=Texture::FLAG_CONVERT_TO_LINEAR; + } if (debug_load_times) begtime=OS::get_singleton()->get_ticks_usec(); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index e511a057c5e7..667b4639a9d5 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1234,7 +1234,7 @@ void Node::generate_instance_state() { for( List::Element *E=properties.front();E;E=E->next() ) { PropertyInfo &pi=E->get(); - if (!(pi.usage&PROPERTY_USAGE_EDITOR) || !(pi.usage&PROPERTY_USAGE_STORAGE)) + if ((pi.usage&PROPERTY_USAGE_NO_INSTANCE_STATE) || !(pi.usage&PROPERTY_USAGE_EDITOR) || !(pi.usage&PROPERTY_USAGE_STORAGE)) continue; data.instance_state[pi.name]=get(pi.name); @@ -1424,6 +1424,20 @@ Node *Node::duplicate_and_reown(const Map& p_reown_map) const { node->set_name(get_name()); + List plist; + + get_property_list(&plist); + + for(List::Element *E=plist.front();E;E=E->next()) { + + if (!(E->get().usage&PROPERTY_USAGE_STORAGE)) + continue; + String name = E->get().name; + node->set( name, get(name) ); + + } + + for(int i=0;i_duplicate_and_reown(node,p_reown_map); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 6b7ed66463c3..ac496cac4e75 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -243,7 +243,7 @@ void Viewport::update_worlds() { void Viewport::_test_new_mouseover(ObjectID new_collider) { - +#ifndef _3D_DISABLED if (new_collider!=physics_object_over) { if (physics_object_over) { @@ -271,7 +271,7 @@ void Viewport::_test_new_mouseover(ObjectID new_collider) { physics_object_over=new_collider; } - +#endif } @@ -353,7 +353,7 @@ void Viewport::_notification(int p_what) { case NOTIFICATION_FIXED_PROCESS: { if (physics_object_picking) { - +#ifndef _3D_DISABLED Vector2 last_pos(1e20,1e20); CollisionObject *last_object; ObjectID last_id=0; @@ -499,6 +499,7 @@ void Viewport::_notification(int p_what) { } } +#endif } } break; diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index f3b13f30bf86..679f474ada39 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -397,6 +397,13 @@ void register_scene_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); + ObjectTypeDB::register_virtual_type(); + ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); + //scenariofx OS::get_singleton()->yield(); //may take time to init @@ -405,6 +412,7 @@ void register_scene_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); + #endif ObjectTypeDB::register_type(); AcceptDialog::set_swap_ok_cancel( GLOBAL_DEF("display/swap_ok_cancel",bool(OS::get_singleton()->get_swap_ok_cancel())) ); @@ -422,12 +430,6 @@ void register_scene_types() { //ObjectTypeDB::register_type(); - ObjectTypeDB::register_virtual_type(); - ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index e6359f920b22..5561b5ef9030 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -1266,7 +1266,7 @@ T Animation::_interpolate( const Vector< TKey >& p_keys, float p_time, Inter } } else { // no loop - + if (idx>=0) { if ((idx+1) < len) { diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 3aeccdc551b5..f4bb3088c326 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -743,6 +743,225 @@ Ref Mesh::generate_triangle_mesh() const { } +Ref Mesh::create_outline(float p_margin) const { + + + Array arrays; + int index_accum=0; + for(int i=0;i v=a[ARRAY_VERTEX]; + index_accum+=v.size(); + } else { + + for(int j=0;j dst = arrays[j]; + DVector src = a[j]; + if (j==ARRAY_VERTEX) + vcount=src.size(); + if (dst.size()==0 || src.size()==0) { + arrays[j]=Variant(); + continue; + } + dst.append_array(src); + arrays[j]=dst; + } break; + case ARRAY_TANGENT: + case ARRAY_BONES: + case ARRAY_WEIGHTS: { + + DVector dst = arrays[j]; + DVector src = a[j]; + if (dst.size()==0 || src.size()==0) { + arrays[j]=Variant(); + continue; + } + dst.append_array(src); + arrays[j]=dst; + + } break; + case ARRAY_COLOR: { + DVector dst = arrays[j]; + DVector src = a[j]; + if (dst.size()==0 || src.size()==0) { + arrays[j]=Variant(); + continue; + } + dst.append_array(src); + arrays[j]=dst; + + } break; + case ARRAY_TEX_UV: + case ARRAY_TEX_UV2: { + DVector dst = arrays[j]; + DVector src = a[j]; + if (dst.size()==0 || src.size()==0) { + arrays[j]=Variant(); + continue; + } + dst.append_array(src); + arrays[j]=dst; + + } break; + case ARRAY_INDEX: { + DVector dst = arrays[j]; + DVector src = a[j]; + if (dst.size()==0 || src.size()==0) { + arrays[j]=Variant(); + continue; + } + { + int ss = src.size(); + DVector::Write w = src.write(); + for(int k=0;k::Write ir; + DVector indices =arrays[ARRAY_INDEX]; + bool has_indices=false; + DVector vertices =arrays[ARRAY_VERTEX]; + int vc = vertices.size(); + ERR_FAIL_COND_V(!vc,Ref()); + DVector::Write r=vertices.write(); + + + if (indices.size()) { + vc=indices.size(); + ir=indices.write(); + has_indices=true; + } + + Map normal_accum; + + //fill normals with triangle normals + for(int i=0;i::Element *E=normal_accum.find(t[j]); + if (!E) { + normal_accum[t[j]]=n; + } else { + float d = n.dot(E->get()); + if (d<1.0) + E->get()+=n*(1.0-d); + //E->get()+=n; + } + } + } + + //normalize + + for (Map::Element *E=normal_accum.front();E;E=E->next()) { + E->get().normalize(); + } + + + //displace normals + int vc2 = vertices.size(); + + for(int i=0;i::Element *E=normal_accum.find(t); + ERR_CONTINUE(!E); + + t+=E->get()*p_margin; + r[i]=t; + } + + r = DVector::Write(); + arrays[ARRAY_VERTEX]=vertices; + + if (!has_indices) { + + DVector new_indices; + new_indices.resize(vertices.size()); + DVector::Write iw = new_indices.write(); + + for(int j=0;j::Write(); + arrays[ARRAY_INDEX]=new_indices; + + } else { + + for(int j=0;j::Write(); + arrays[ARRAY_INDEX]=indices; + + } + } + + + + + Ref newmesh = memnew( Mesh ); + newmesh->add_surface(PRIMITIVE_TRIANGLES,arrays); + return newmesh; +} + + void Mesh::_bind_methods() { ObjectTypeDB::bind_method(_MD("add_morph_target","name"),&Mesh::add_morph_target); diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index d6ab6a1198bb..5aacc8be57b6 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -166,6 +166,8 @@ public: Ref create_trimesh_shape() const; Ref create_convex_shape() const; + Ref create_outline(float p_margin) const; + void center_geometry(); void regen_normalmaps(); diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 75a1b765ee20..5883686f205d 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -272,6 +272,10 @@ Error PackedScene::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map< continue; }*/ + if (E->get().usage & PROPERTY_USAGE_NO_INSTANCE_STATE) { + continue; + } + if (instance_state[name]==value) { continue; } diff --git a/scene/resources/video_stream.h b/scene/resources/video_stream.h index eafacce159b5..1bc8a5e5bc8d 100644 --- a/scene/resources/video_stream.h +++ b/scene/resources/video_stream.h @@ -30,7 +30,7 @@ #define VIDEO_STREAM_H #include "audio_stream_resampled.h" - +#include "scene/resources/texture.h" class VideoStream : public Resource { @@ -59,7 +59,7 @@ public: virtual void seek_pos(float p_time)=0; virtual int get_pending_frame_count() const=0; - virtual Image pop_frame()=0; + virtual void pop_frame(Ref p_tex)=0; virtual Image peek_frame() const=0; virtual void update(float p_time)=0; diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp index fbad19f6bea0..591bf046ef05 100644 --- a/servers/physics_2d/body_2d_sw.cpp +++ b/servers/physics_2d/body_2d_sw.cpp @@ -65,7 +65,13 @@ void Body2DSW::update_inertias() { float mass = area * this->mass / total_area; - _inertia += shape->get_moment_of_inertia(mass) + mass * get_shape_transform(i).get_origin().length_squared(); + Matrix32 mtx = get_shape_transform(i); + Vector2 scale = mtx.get_scale(); + _inertia += shape->get_moment_of_inertia(mass,scale) + mass * mtx.get_origin().length_squared(); + //Rect2 ab = get_shape_aabb(i); + //_inertia+=mass*ab.size.dot(ab.size)/12.0f; + + } diff --git a/servers/physics_2d/collision_solver_2d_sat.cpp b/servers/physics_2d/collision_solver_2d_sat.cpp index f73ed5732e58..9ed594e0eb03 100644 --- a/servers/physics_2d/collision_solver_2d_sat.cpp +++ b/servers/physics_2d/collision_solver_2d_sat.cpp @@ -1086,6 +1086,7 @@ static void _collision_rectangle_convex_polygon(const Shape2DSW* p_a,const Matri SeparatorAxisTest2D separator(rectangle_A,p_transform_a,convex_B,p_transform_b,p_collector,p_motion_a,p_motion_b,p_margin_A,p_margin_B); + if (!separator.test_previous_axis()) return; diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index 012c4ed40423..336eec73b542 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -131,7 +131,7 @@ bool LineShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_en return true; } -real_t LineShape2DSW::get_moment_of_inertia(float p_mass) const { +real_t LineShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { return 0; } @@ -180,7 +180,7 @@ bool RayShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_end } -real_t RayShape2DSW::get_moment_of_inertia(float p_mass) const { +real_t RayShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { return 0; //rays are mass-less } @@ -237,10 +237,12 @@ bool SegmentShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p return true; } -real_t SegmentShape2DSW::get_moment_of_inertia(float p_mass) const { +real_t SegmentShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { - real_t l = b.distance_to(a); - Vector2 ofs = (a+b)*0.5; + Vector2 s[2]={a*p_scale,b*p_scale}; + + real_t l = s[1].distance_to(s[0]); + Vector2 ofs = (s[0]+s[1])*0.5; return p_mass*(l*l/12.0f + ofs.length_squared()); } @@ -312,9 +314,10 @@ bool CircleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_ return true; } -real_t CircleShape2DSW::get_moment_of_inertia(float p_mass) const { +real_t CircleShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { + + return (radius*radius)*(p_scale.x*0.5+p_scale.y*0.5); - return radius*radius; } void CircleShape2DSW::set_data(const Variant& p_data) { @@ -377,9 +380,9 @@ bool RectangleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& return get_aabb().intersects_segment(p_begin,p_end,&r_point,&r_normal); } -real_t RectangleShape2DSW::get_moment_of_inertia(float p_mass) const { +real_t RectangleShape2DSW::get_moment_of_inertia(float p_mass,const Vector2& p_scale) const { - Vector2 he2=half_extents*2; + Vector2 he2=half_extents*2*p_scale; return p_mass*he2.dot(he2)/12.0f; } @@ -499,9 +502,9 @@ bool CapsuleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p return collided; //todo } -real_t CapsuleShape2DSW::get_moment_of_inertia(float p_mass) const { +real_t CapsuleShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { - Vector2 he2(radius*2,height+radius*2); + Vector2 he2=Vector2(radius*2,height+radius*2)*p_scale; return p_mass*he2.dot(he2)/12.0f; } @@ -610,16 +613,16 @@ bool ConvexPolygonShape2DSW::intersect_segment(const Vector2& p_begin,const Vect return inters; //todo } -real_t ConvexPolygonShape2DSW::get_moment_of_inertia(float p_mass) const { +real_t ConvexPolygonShape2DSW::get_moment_of_inertia(float p_mass,const Vector2& p_scale) const { Rect2 aabb; - aabb.pos=points[0].pos; + aabb.pos=points[0].pos*p_scale; for(int i=0;i>1)*2-1)*half_extents.y ))); - r_min = distance - length; - r_max = distance + length; + if (d>r_max) + r_max=d; + if (dr) distance=r; - float mult = powf(1.0-distance/r,att)*str; + float mult = Math::pow(1.0-distance/r,att)*str; if (mult>0) { col.r*=mult; col.g*=mult; diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 701704fbfa83..b23f6c276592 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -1310,6 +1310,8 @@ void EditorNode::_edit_current() { p->add_item("Copy Params",OBJECT_COPY_PARAMS); p->add_item("Set Params",OBJECT_PASTE_PARAMS); p->add_separator(); + p->add_item("Make Resources Unique",OBJECT_UNIQUE_RESOURCES); + p->add_separator(); p->add_icon_item(gui_base->get_icon("Help","EditorIcons"),"Class Reference",OBJECT_REQUEST_HELP); List methods; current_obj->get_method_list(&methods); @@ -2023,6 +2025,47 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { editor_data.paste_object_params(current); editor_data.get_undo_redo().clear_history(); } break; + case OBJECT_UNIQUE_RESOURCES: { + + editor_data.apply_changes_in_editors();; + if (current) { + List props; + current->get_property_list(&props); + Map duplicates; + for (List::Element *E=props.front();E;E=E->next()) { + + if (!(E->get().usage&PROPERTY_USAGE_STORAGE)) + continue; + + Variant v = current->get(E->get().name); + if (v.is_ref()) { + REF ref = v; + if (ref.is_valid()) { + + RES res = ref; + if (res.is_valid()) { + + if (!duplicates.has(res)) { + duplicates[res]=res->duplicate(); + } + res=duplicates[res]; + + current->set(E->get().name,res); + } + + } + } + + } + } + + editor_data.get_undo_redo().clear_history(); + if (editor_plugin_screen) { //reload editor plugin + editor_plugin_over->edit(NULL); + editor_plugin_over->edit(current); + } + + } break; case OBJECT_CALL_METHOD: { editor_data.apply_changes_in_editors();; @@ -3950,8 +3993,8 @@ EditorNode::EditorNode() { Ref _scene_import = memnew(EditorSceneImportPlugin(this) ); Ref _collada_import = memnew( EditorSceneImporterCollada); _scene_import->add_importer(_collada_import); - Ref _fbxconv_import = memnew( EditorSceneImporterFBXConv); - _scene_import->add_importer(_fbxconv_import); +// Ref _fbxconv_import = memnew( EditorSceneImporterFBXConv); +// _scene_import->add_importer(_fbxconv_import); editor_import_export->add_import_plugin( _scene_import); editor_import_export->add_import_plugin( Ref( memnew(EditorSceneAnimationImportPlugin(this)))); editor_import_export->add_import_plugin( Ref( memnew(EditorMeshImportPlugin(this)))); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 2cec301cf616..7b66a7809e0e 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -133,6 +133,7 @@ class EditorNode : public Node { RESOURCE_COPY, OBJECT_COPY_PARAMS, OBJECT_PASTE_PARAMS, + OBJECT_UNIQUE_RESOURCES, OBJECT_CALL_METHOD, OBJECT_REQUEST_HELP, RUN_PLAY, diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index e86356ebe9d0..3fb45d18703c 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -61,6 +61,7 @@ struct ColladaImport { Color ambient; bool found_directional; bool force_make_tangents; + float bake_fps; @@ -95,6 +96,7 @@ struct ColladaImport { found_ambient=false; found_directional=false; force_make_tangents=false; + bake_fps=15; } }; @@ -1835,7 +1837,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones Vector base_snapshots; float f=0; - float snapshot_interval = 1.0/20.0; //should be customizable somewhere... + float snapshot_interval = 1.0/bake_fps; //should be customizable somewhere... float anim_length=collada.state.animation_length; if (p_clip>=0 && collada.state.animation_clips[p_clip].end) @@ -2142,14 +2144,14 @@ void EditorSceneImporterCollada::get_extensions(List *r_extensions) cons r_extensions->push_back("dae"); } -Node* EditorSceneImporterCollada::import_scene(const String& p_path, uint32_t p_flags, List *r_missing_deps, Error* r_err) { - +Node* EditorSceneImporterCollada::import_scene(const String& p_path, uint32_t p_flags,int p_bake_fps, List *r_missing_deps, Error* r_err) { ColladaImport state; uint32_t flags=Collada::IMPORT_FLAG_SCENE; if (p_flags&IMPORT_ANIMATION) flags|=Collada::IMPORT_FLAG_ANIMATION; + state.bake_fps=p_bake_fps; Error err = state.load(p_path,flags,p_flags&EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS); @@ -2174,7 +2176,7 @@ Node* EditorSceneImporterCollada::import_scene(const String& p_path, uint32_t p_ if (p_flags&IMPORT_ANIMATION) { - state.create_animations(p_flags&IMPORT_ANIMATION_FORCE_TRACKS_IN_ALL_BONES); + state.create_animations(p_flags&IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS); AnimationPlayer *ap = memnew( AnimationPlayer ); for(int i=0;i EditorSceneImporterCollada::import_animation(const String& p_path ERR_FAIL_COND_V(err!=OK,RES()); - state.create_animations(p_flags&EditorSceneImporter::IMPORT_ANIMATION_FORCE_TRACKS_IN_ALL_BONES); + state.create_animations(p_flags&EditorSceneImporter::IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS); if (state.scene) memdelete(state.scene); diff --git a/tools/editor/io_plugins/editor_import_collada.h b/tools/editor/io_plugins/editor_import_collada.h index 9580f42ed02a..ae4cedeff6c6 100644 --- a/tools/editor/io_plugins/editor_import_collada.h +++ b/tools/editor/io_plugins/editor_import_collada.h @@ -40,7 +40,7 @@ public: virtual uint32_t get_import_flags() const; virtual void get_extensions(List *r_extensions) const; - virtual Node* import_scene(const String& p_path,uint32_t p_flags,List *r_missing_deps=NULL,Error* r_err=NULL); + virtual Node* import_scene(const String& p_path,uint32_t p_flags,int p_bake_fps,List *r_missing_deps=NULL,Error* r_err=NULL); virtual Ref import_animation(const String& p_path,uint32_t p_flags); EditorSceneImporterCollada(); diff --git a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp index d76a778433b6..6ebdb6cc4148 100644 --- a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp @@ -425,7 +425,7 @@ Error EditorMeshImportPlugin::import(const String& p_path, const Ref clips; + Tree *flags; + Tree *clips_tree; Vector items; bool updating; + bool validating; void _changed(); + void _item_edited(); + void _button_action(Object *p_obj,int p_col,int p_id); + protected: static void _bind_methods(); void _notification(int p_what); @@ -93,6 +104,14 @@ public: void set_flags(uint32_t p_flags); uint32_t get_flags() const; + void set_fps(int p_fps); + int get_fps() const; + + void setup_clips(const Array& p_clips); + Array get_clips() const; + + void set_filter(const String& p_filter); + String get_filter() const; EditorImportAnimationOptions(); @@ -141,6 +160,9 @@ class EditorSceneImportDialog : public ConfirmationDialog { Map,Ref > collision_map; ConfirmationDialog *error_dialog; + OptionButton *this_import; + OptionButton *next_import; + void _choose_file(const String& p_path); void _choose_save_file(const String& p_path); void _choose_script(const String& p_path); @@ -178,7 +200,7 @@ static const char *anim_flag_names[]={ "Detect Loop (-loop,-cycle)", "Keep Value Tracks", "Optimize", - "Force Tracks in All Bones", + "Force All Tracks in All Clips", NULL }; @@ -223,9 +245,101 @@ void EditorImportAnimationOptions::_changed() { } +void EditorImportAnimationOptions::_button_action(Object *p_obj,int p_col,int p_id) { + + memdelete(p_obj); + +} + + +void EditorImportAnimationOptions::_item_edited() { + + if (validating) + return; + + if (clips.size()==0) + return; + validating=true; + print_line("edited"); + TreeItem *item = clips_tree->get_edited(); + if (item==clips[clips.size()-1]) { + //add new + print_line("islast"); + if (item->get_text(0).find("<")!=-1 || item->get_text(0).find(">")!=-1) { + validating=false; + return; //fuckit + } + + item->set_editable(1,true); + item->set_editable(2,true); + item->add_button(0,EditorNode::get_singleton()->get_gui_base()->get_icon("Del","EditorIcons")); + item->set_cell_mode(1,TreeItem::CELL_MODE_RANGE); + item->set_range_config(1,0,3600,0.01); + item->set_range(1,0); + item->set_editable(1,true); + item->set_cell_mode(2,TreeItem::CELL_MODE_RANGE); + item->set_range_config(2,0,3600,0.01); + item->set_range(2,0); + item->set_cell_mode(3,TreeItem::CELL_MODE_CHECK); + item->set_editable(3,true); + + TreeItem *newclip = clips_tree->create_item(clips_base); + newclip->set_text(0,""); + newclip->set_editable(0,true); + newclip->set_editable(1,false); + newclip->set_editable(2,false); + clips.push_back(newclip); + + + + } + + + //make name unique JUST IN CASE + String name = item->get_text(0); + name=name.replace("/","_").replace(":","_").strip_edges(); + if (name=="") + name="New Clip"; + + if (clips.size()>2) { + int index=1; + while(true) { + bool valid = true; + String try_name=name; + if (index>1) + try_name+=" "+itos(index); + + for(int i=0;iget_text(0)==try_name) { + index++; + valid=false; + break; + } + } + + if (valid) { + name=try_name; + break; + } + + } + } + + if (item->get_text(0)!=name) + item->set_text(0,name); + + validating=false; + +} + void EditorImportAnimationOptions::_bind_methods() { ObjectTypeDB::bind_method("_changed",&EditorImportAnimationOptions::_changed); + ObjectTypeDB::bind_method("_item_edited",&EditorImportAnimationOptions::_item_edited); + ObjectTypeDB::bind_method("_button_action",&EditorImportAnimationOptions::_button_action); // ObjectTypeDB::bind_method("_changedp",&EditorImportAnimationOptions::_changedp); ADD_SIGNAL(MethodInfo("changed")); @@ -237,17 +351,84 @@ void EditorImportAnimationOptions::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_SCENE) { flags->connect("item_edited",this,"_changed"); + clips_tree->connect("item_edited",this,"_item_edited"); + clips_tree->connect("button_pressed",this,"_button_action",varray(),CONNECT_DEFERRED); // format->connect("item_selected",this,"_changedp"); } } + +Array EditorImportAnimationOptions::get_clips() const { + + Array arr; + for(int i=0;iget_text(0)); + arr.push_back(clips[i]->get_range(1)); + arr.push_back(clips[i]->get_range(2)); + arr.push_back(clips[i]->is_checked(3)); + } + + return arr; +} + + +void EditorImportAnimationOptions::setup_clips(const Array& p_clips) { + + ERR_FAIL_COND(p_clips.size()%4!=0); + for(int i=0;icreate_item(clips_base); + clip->set_text(0,p_clips[i]); + clip->add_button(0,EditorNode::get_singleton()->get_gui_base()->get_icon("Del","EditorIcons")); + clip->set_editable(0,true); + clip->set_cell_mode(1,TreeItem::CELL_MODE_RANGE); + clip->set_range_config(1,0,3600,0.01); + clip->set_range(1,p_clips[i+1]); + clip->set_editable(1,true); + clip->set_cell_mode(2,TreeItem::CELL_MODE_RANGE); + clip->set_range_config(2,0,3600,0.01); + clip->set_range(2,p_clips[i+2]); + clip->set_editable(2,true); + clip->set_cell_mode(3,TreeItem::CELL_MODE_CHECK); + clip->set_editable(3,true); + clip->set_checked(3,p_clips[i+3]); + clips.push_back(clip); + + } + + TreeItem *newclip = clips_tree->create_item(clips_base); + newclip->set_text(0,""); + newclip->set_editable(0,true); + newclip->set_editable(1,false); + newclip->set_editable(2,false); + newclip->set_editable(3,false); + clips.push_back(newclip); + +} + + EditorImportAnimationOptions::EditorImportAnimationOptions() { updating=false; + validating=false; + + TabContainer *tab= memnew(TabContainer); + add_margin_child("Animation Options",tab,true); flags = memnew( Tree ); flags->set_hide_root(true); + tab->add_child(flags); + flags->set_name("Flags"); TreeItem *root = flags->create_item(); const char ** fname=anim_flag_names; @@ -263,15 +444,70 @@ EditorImportAnimationOptions::EditorImportAnimationOptions() { items.push_back(ti); fname++; fdescr++; - } + } - add_margin_child("Animation Options",flags,true); + TreeItem *fps_base = flags->create_item(root); + fps_base->set_text(0,"Bake FPS:"); + fps_base->set_editable(0,false); + fps = flags->create_item(fps_base); + fps->set_cell_mode(0,TreeItem::CELL_MODE_RANGE); + fps->set_editable(0,true); + fps->set_range(0,15); + fps->set_range_config(0,1,120,1); + + clips_tree = memnew( Tree ); + clips_tree->set_hide_root(true); + tab->add_child(clips_tree); + clips_tree->set_name("Clips"); + + clips_tree->set_columns(4); + clips_tree->set_column_expand(0,1); + clips_tree->set_column_expand(1,0); + clips_tree->set_column_expand(2,0); + clips_tree->set_column_expand(3,0); + clips_tree->set_column_min_width(1,60); + clips_tree->set_column_min_width(2,60); + clips_tree->set_column_min_width(3,40); + clips_tree->set_column_titles_visible(true); + clips_tree->set_column_title(0,"Name"); + clips_tree->set_column_title(1,"Start(s)"); + clips_tree->set_column_title(2,"End(s)"); + clips_tree->set_column_title(3,"Loop"); + clips_base =clips_tree->create_item(0); + + + setup_clips(Array()); + + + filters = memnew( TextEdit ); + tab->add_child(filters); + filters->set_name("Filters"); } +void EditorImportAnimationOptions::set_fps(int p_fps) { + + fps->set_range(0,p_fps); +} + +int EditorImportAnimationOptions::get_fps() const { + + return fps->get_range(0); +} + +void EditorImportAnimationOptions::set_filter(const String& p_filter) { + + filters->set_text(p_filter); +} + +String EditorImportAnimationOptions::get_filter() const { + + return filters->get_text(); +} + @@ -413,7 +649,12 @@ void EditorSceneImportDialog::_import(bool p_and_open) { rim->set_option("texture_format",texture_options->get_format()); rim->set_option("texture_quality",texture_options->get_quality()); rim->set_option("animation_flags",animation_options->get_flags()); + rim->set_option("animation_bake_fps",animation_options->get_fps()); + rim->set_option("animation_filters",animation_options->get_filter()); + rim->set_option("animation_clips",animation_options->get_clips()); rim->set_option("post_import_script",script_path->get_text()!=String()?EditorImportPlugin::validate_source_path(script_path->get_text()):String()); + rim->set_option("import_this_time",this_import->get_selected()); + rim->set_option("import_next_time",next_import->get_selected()); rim->set_option("reimport",true); List missing; @@ -526,7 +767,7 @@ void EditorSceneImportDialog::_browse_script() { void EditorSceneImportDialog::popup_import(const String &p_from) { - popup_centered(Size2(700,500)); + popup_centered(Size2(750,550)); if (p_from!="") { Ref rimd = ResourceLoader::load_import_metadata(p_from); if (rimd.is_null()) @@ -544,7 +785,17 @@ void EditorSceneImportDialog::popup_import(const String &p_from) { texture_options->set_format(EditorTextureImportPlugin::ImageFormat(int(rimd->get_option("texture_format")))); texture_options->set_quality(rimd->get_option("texture_quality")); animation_options->set_flags(rimd->get_option("animation_flags")); + if (rimd->has_option("animation_clips")) + animation_options->setup_clips(rimd->get_option("animation_clips")); + if (rimd->has_option("animation_filters")) + animation_options->set_filter(rimd->get_option("animation_filters")); + if (rimd->has_option("animation_bake_fps")) + animation_options->set_fps(rimd->get_option("animation_bake_fps")); script_path->set_text(rimd->get_option("post_import_script")); + if (rimd->has_option("import_this_time")) + this_import->select(rimd->get_option("import_this_time")); + if (rimd->has_option("import_next_time")) + next_import->select(rimd->get_option("import_next_time")); save_path->set_text(p_from.get_base_dir()); import_path->set_text(EditorImportPlugin::expand_source_path(rimd->get_source_path(0))); @@ -619,7 +870,7 @@ void EditorSceneImportDialog::_bind_methods() { ObjectTypeDB::bind_method("_choose_file",&EditorSceneImportDialog::_choose_file); ObjectTypeDB::bind_method("_choose_save_file",&EditorSceneImportDialog::_choose_save_file); ObjectTypeDB::bind_method("_choose_script",&EditorSceneImportDialog::_choose_script); - ObjectTypeDB::bind_method("_import",&EditorSceneImportDialog::_import); + ObjectTypeDB::bind_method("_import",&EditorSceneImportDialog::_import,DEFVAL(false)); ObjectTypeDB::bind_method("_browse",&EditorSceneImportDialog::_browse); ObjectTypeDB::bind_method("_browse_target",&EditorSceneImportDialog::_browse_target); ObjectTypeDB::bind_method("_browse_script",&EditorSceneImportDialog::_browse_script); @@ -792,6 +1043,20 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce error_dialog->get_ok()->set_text("Accept"); // error_dialog->get_cancel()->hide(); + this_import = memnew( OptionButton ); + this_import->add_item("Overwrite Existing Scene"); + this_import->add_item("Owerwrite Existing, Keep Materials"); + this_import->add_item("Keep Existing, Merge with New"); + this_import->add_item("Keep Existing, Ignore New"); + vbc->add_margin_child("This Time:",this_import); + + next_import = memnew( OptionButton ); + next_import->add_item("Overwrite Existing Scene"); + next_import->add_item("Owerwrite Existing, Keep Materials"); + next_import->add_item("Keep Existing, Merge with New"); + next_import->add_item("Keep Existing, Ignore New"); + vbc->add_margin_child("Next Time:",next_import); + set_hide_on_ok(false); GLOBAL_DEF("import/shared_textures","res://"); @@ -814,7 +1079,7 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce animation_options = memnew( EditorImportAnimationOptions ); ovb->add_child(animation_options); animation_options->set_v_size_flags(SIZE_EXPAND_FILL); - animation_options->set_flags(EditorSceneAnimationImportPlugin::ANIMATION_DETECT_LOOP|EditorSceneAnimationImportPlugin::ANIMATION_KEEP_VALUE_TRACKS|EditorSceneAnimationImportPlugin::ANIMATION_OPTIMIZE|EditorSceneAnimationImportPlugin::ANIMATION_FORCE_TRACKS_IN_ALL_BONES); + animation_options->set_flags(EditorSceneAnimationImportPlugin::ANIMATION_DETECT_LOOP|EditorSceneAnimationImportPlugin::ANIMATION_KEEP_VALUE_TRACKS|EditorSceneAnimationImportPlugin::ANIMATION_OPTIMIZE|EditorSceneAnimationImportPlugin::ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS); confirm_import = memnew( ConfirmationDialog ); @@ -1815,6 +2080,79 @@ void EditorSceneImportPlugin::_merge_scenes(Node *p_node,Node *p_imported) { } +void EditorSceneImportPlugin::_scan_materials(Node*p_base,Node *p_node,Map > &mesh_materials,Map >& override_materials) { + + if (!p_base && p_node->get_owner()!=p_base) + return; + MeshInstance *mi=p_node->cast_to(); + + if (mi) { + if (mi->get_material_override().is_valid()) { + String path = p_base->get_path_to(p_node); + override_materials[path]=mi->get_material_override(); + } + Ref mesh = mi->get_mesh(); + if (mesh.is_valid()) { + + for(int i=0;iget_surface_count();i++) { + + String name = mesh->get_name()+":"+mesh->surface_get_name(i); + if (!mesh_materials.has(name)) { + mesh_materials[name]=mesh->surface_get_material(i); + } + } + } + } + + for(int i=0;iget_child_count();i++) { + _scan_materials(p_base,p_node->get_child(i),mesh_materials,override_materials); + } +} + + +void EditorSceneImportPlugin::_apply_materials(Node*p_base,Node *p_node,Map > &mesh_materials,Map >& override_materials,Set >& meshes_processed) { + + if (!p_base && p_node->get_owner()!=p_base) + return; + + MeshInstance *mi=p_node->cast_to(); + + if (mi) { + + String path = p_base->get_path_to(p_node); + if (override_materials.has(path)) + mi->set_material_override(override_materials[path]); + + Ref mesh = mi->get_mesh(); + if (mesh.is_valid() && !meshes_processed.has(mesh)) { + meshes_processed.insert(mesh); + for(int i=0;iget_surface_count();i++) { + + String name = mesh->get_name()+":"+mesh->surface_get_name(i); + if (mesh_materials.has(name)) { + + Ref mat = mesh_materials[name]; + mesh->surface_set_material(i,mat); + } + } + } + } + + for(int i=0;iget_child_count();i++) { + _apply_materials(p_base,p_node->get_child(i),mesh_materials,override_materials,meshes_processed); + } +} + +void EditorSceneImportPlugin::_merge_materials(Node *p_node,Node *p_imported) { + + Map > mesh_materials; + Map > override_materials; + + _scan_materials(p_node,p_node,mesh_materials,override_materials); + Set > mp; + _apply_materials(p_imported,p_imported,mesh_materials,override_materials,mp); + +} #if 0 @@ -1882,14 +2220,20 @@ Error EditorSceneImportPlugin::import1(const Ref& p_from int animation_flags=p_from->get_option("animation_flags"); int scene_flags = from->get_option("flags"); + int fps = 24; + if (from->has_option("animation_bake_fps")) + fps=from->get_option("animation_bake_fps"); + Array clips; + if (from->has_option("animation_clips")) + clips=from->get_option("animation_clips"); uint32_t import_flags=0; if (animation_flags&EditorSceneAnimationImportPlugin::ANIMATION_DETECT_LOOP) import_flags|=EditorSceneImporter::IMPORT_ANIMATION_DETECT_LOOP; if (animation_flags&EditorSceneAnimationImportPlugin::ANIMATION_OPTIMIZE) import_flags|=EditorSceneImporter::IMPORT_ANIMATION_OPTIMIZE; - if (animation_flags&EditorSceneAnimationImportPlugin::ANIMATION_FORCE_TRACKS_IN_ALL_BONES) - import_flags|=EditorSceneImporter::IMPORT_ANIMATION_FORCE_TRACKS_IN_ALL_BONES; + if (animation_flags&EditorSceneAnimationImportPlugin::ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS) + import_flags|=EditorSceneImporter::IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS; if (scene_flags&SCENE_FLAG_IMPORT_ANIMATIONS) import_flags|=EditorSceneImporter::IMPORT_ANIMATION; //if (scene_flags&SCENE_FLAG_FAIL_ON_MISSING_IMAGES) @@ -1902,7 +2246,7 @@ Error EditorSceneImportPlugin::import1(const Ref& p_from Error err=OK; - Node *scene = importer->import_scene(src_path,import_flags,r_missing,&err); + Node *scene = importer->import_scene(src_path,import_flags,fps,r_missing,&err); if (!scene || err!=OK) { return err; } @@ -1913,19 +2257,231 @@ Error EditorSceneImportPlugin::import1(const Ref& p_from return OK; } + +void EditorSceneImportPlugin::_create_clips(Node *scene, const Array& p_clips,bool p_bake_all) { + + if (!scene->has_node(String("AnimationPlayer"))) + return; + + Node* n = scene->get_node(String("AnimationPlayer")); + ERR_FAIL_COND(!n); + AnimationPlayer *anim = n->cast_to(); + ERR_FAIL_COND(!anim); + + if (!anim->has_animation("default")) + return; + + + Ref default_anim = anim->get_animation("default"); + + for(int i=0;i=to) + continue; + + Ref new_anim = memnew( Animation ); + + for(int j=0;jget_track_count();j++) { + + + List keys; + int kc = default_anim->track_get_key_count(j); + int dtrack=-1; + for(int k=0;ktrack_get_key_time(j,k); + if (kt>=from && ktadd_track(default_anim->track_get_type(j)); + dtrack = new_anim->get_track_count()-1; + new_anim->track_set_path(dtrack,default_anim->track_get_path(j)); + + if (kt>(from+0.01) && k>0) { + + if (default_anim->track_get_type(j)==Animation::TYPE_TRANSFORM) { + Quat q; + Vector3 p; + Vector3 s; + default_anim->transform_track_interpolate(j,from,&p,&q,&s); + new_anim->transform_track_insert_key(dtrack,0,p,q,s); + } + } + + } + + if (default_anim->track_get_type(j)==Animation::TYPE_TRANSFORM) { + Quat q; + Vector3 p; + Vector3 s; + default_anim->transform_track_get_key(j,k,&p,&q,&s); + new_anim->transform_track_insert_key(dtrack,kt-from,p,q,s); + } + + } + + if (dtrack!=-1 && kt>=to) { + + if (default_anim->track_get_type(j)==Animation::TYPE_TRANSFORM) { + Quat q; + Vector3 p; + Vector3 s; + default_anim->transform_track_interpolate(j,to,&p,&q,&s); + new_anim->transform_track_insert_key(dtrack,to-from,p,q,s); + } + } + + } + + if (dtrack==-1 && p_bake_all) { + new_anim->add_track(default_anim->track_get_type(j)); + dtrack = new_anim->get_track_count()-1; + new_anim->track_set_path(dtrack,default_anim->track_get_path(j)); + if (default_anim->track_get_type(j)==Animation::TYPE_TRANSFORM) { + + + Quat q; + Vector3 p; + Vector3 s; + default_anim->transform_track_interpolate(j,from,&p,&q,&s); + new_anim->transform_track_insert_key(dtrack,0,p,q,s); + default_anim->transform_track_interpolate(j,to,&p,&q,&s); + new_anim->transform_track_insert_key(dtrack,to-from,p,q,s); + } + + } + } + + + new_anim->set_loop(loop); + new_anim->set_length(to-from); + anim->add_animation(name,new_anim); + } + + anim->remove_animation("default"); //remove default (no longer needed) +} + +void EditorSceneImportPlugin::_filter_tracks(Node *scene, const String& p_text) { + + if (!scene->has_node(String("AnimationPlayer"))) + return; + Node* n = scene->get_node(String("AnimationPlayer")); + ERR_FAIL_COND(!n); + AnimationPlayer *anim = n->cast_to(); + ERR_FAIL_COND(!anim); + + Vector strings = p_text.split("\n"); + for(int i=0;i anim_names; + anim->get_animation_list(&anim_names); + Set keep; + for(List::Element *E=anim_names.front();E;E=E->next()) { + + String name = E->get(); + bool valid_for_this=false; + + for(int i=0;i filters=strings[i].substr(1,strings[i].length()).split(","); + for(int j=0;j a = anim->get_animation(name); + if (!a.is_valid()) + continue; + + for(int j=0;jget_track_count();j++) { + + String path = a->track_get_path(j); + + String tname = strings[i]; + if (tname=="") + continue; + int fc = tname[0]; + bool plus; + if (fc=='+') + plus=true; + else if (fc=='-') + plus=false; + else + continue; + + String filter=tname.substr(1,tname.length()).strip_edges(); + + if (!path.matchn(filter)) + continue; + + if (plus) + keep.insert(path); + else if (!keep.has(path)) { + a->remove_track(j); + j--; + } + + } + + } + + } + + } + + +} + Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, const Ref& p_from) { Error err=OK; Ref from=p_from; String src_path=EditorImportPlugin::expand_source_path(from->get_source_path(0)); int animation_flags=p_from->get_option("animation_flags"); + Array animation_clips = p_from->get_option("animation_clips"); + String animation_filter = p_from->get_option("animation_filters"); int scene_flags = from->get_option("flags"); EditorProgress progress("import","Import Scene",104); progress.step("Importing Scene..",2); - bool merge = !bool(from->get_option("reimport")); + bool reimport = bool(from->get_option("reimport")); + int this_time_action = from->get_option("import_this_time"); + int next_time_action = from->get_option("import_next_time"); + + int import_action = reimport?this_time_action:next_time_action; from->set_source_md5(0,FileAccess::get_md5(src_path)); from->set_editor(get_name()); @@ -1940,6 +2496,11 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c Map< Ref,TextureRole > imagemap; scene=_fix_node(scene,scene,collision_map,scene_flags,imagemap); + if (animation_clips.size()) + _create_clips(scene,animation_clips,animation_flags&EditorSceneAnimationImportPlugin::ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS); + + _filter_tracks(scene,animation_filter); + /// BEFORE ANYTHING, RUN SCRIPT @@ -2063,7 +2624,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c /// BEFORE SAVING - MERGE - if (merge) { + if (import_action!=SCENE_UPDATE_REPLACE_WITH_NEW) { progress.step("Merging..",103); @@ -2082,10 +2643,30 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c if (existing) { - _merge_scenes(existing,scene); - memdelete(scene); - scene=existing; + switch(import_action) { + + case SCENE_UPDATE_REPLACE_WITH_NEW: break; + case SCENE_UPDATE_REPLACE_WITH_NEW_KEEP_MATERIALS: { + + _merge_materials(existing,scene); + memdelete(existing); + + } break; + case SCENE_UPDATE_KEEP_OLD_MERGE_CHANGES: { + + _merge_scenes(existing,scene); + memdelete(scene); + scene=existing; + + } break; + case SCENE_UPDATE_KEEP_OLD: { + + memdelete(scene); + scene=existing; + } break; + } + } } diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.h b/tools/editor/io_plugins/editor_scene_import_plugin.h index 72b4089d894f..8aafde93dfef 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.h +++ b/tools/editor/io_plugins/editor_scene_import_plugin.h @@ -58,7 +58,7 @@ public: IMPORT_ANIMATION=2, IMPORT_ANIMATION_DETECT_LOOP=4, IMPORT_ANIMATION_OPTIMIZE=8, - IMPORT_ANIMATION_FORCE_TRACKS_IN_ALL_BONES=16, + IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS=16, IMPORT_GENERATE_TANGENT_ARRAYS=256, IMPORT_FAIL_ON_MISSING_DEPENDENCIES=512 @@ -66,7 +66,7 @@ public: virtual uint32_t get_import_flags() const=0; virtual void get_extensions(List *r_extensions) const=0; - virtual Node* import_scene(const String& p_path,uint32_t p_flags,List *r_missing_deps,Error* r_err=NULL)=0; + virtual Node* import_scene(const String& p_path,uint32_t p_flags,int p_bake_fps,List *r_missing_deps,Error* r_err=NULL)=0; virtual Ref import_animation(const String& p_path,uint32_t p_flags)=0; @@ -108,10 +108,16 @@ class EditorSceneImportPlugin : public EditorImportPlugin { void _find_resources(const Variant& p_var,Map,TextureRole >& image_map,int p_flags); Node* _fix_node(Node *p_node,Node *p_root,Map,Ref > &collision_map,uint32_t p_flags,Map,TextureRole >& image_map); + void _create_clips(Node *scene, const Array& p_clips, bool p_bake_all); + void _filter_tracks(Node *scene, const String& p_text); void _merge_existing_node(Node *p_node,Node *p_imported_scene,Set >& checked_resources,Set &checked_nodes); + void _add_new_nodes(Node *p_node,Node *p_imported,Node *p_imported_scene,Set &checked_nodes); void _merge_scenes(Node *p_node, Node *p_imported); + void _scan_materials(Node*p_base,Node *p_node,Map > &mesh_materials,Map >& override_materials); + void _apply_materials(Node*p_base,Node *p_node,Map > &mesh_materials,Map >& override_materials,Set >& meshes_processed); + void _merge_materials(Node *p_node,Node *p_imported); void _tag_import_paths(Node *p_scene,Node *p_node); @@ -142,6 +148,13 @@ public: SCENE_FLAG_CONVERT_NORMALMAPS_TO_XY=1<<30, }; + enum SceneUpdate { + SCENE_UPDATE_REPLACE_WITH_NEW, + SCENE_UPDATE_REPLACE_WITH_NEW_KEEP_MATERIALS, + SCENE_UPDATE_KEEP_OLD_MERGE_CHANGES, + SCENE_UPDATE_KEEP_OLD, + }; + virtual String get_name() const; virtual String get_visible_name() const; @@ -171,7 +184,7 @@ public: ANIMATION_DETECT_LOOP=1, ANIMATION_KEEP_VALUE_TRACKS=2, ANIMATION_OPTIMIZE=4, - ANIMATION_FORCE_TRACKS_IN_ALL_BONES=8 + ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS=8 }; virtual String get_name() const; @@ -185,5 +198,4 @@ public: }; - #endif // EDITOR_SCENE_IMPORT_PLUGIN_H diff --git a/tools/editor/plugins/baked_light_baker_cmpxchg.cpp b/tools/editor/plugins/baked_light_baker_cmpxchg.cpp index d08c9f648465..42d3fc5276e4 100644 --- a/tools/editor/plugins/baked_light_baker_cmpxchg.cpp +++ b/tools/editor/plugins/baked_light_baker_cmpxchg.cpp @@ -2,7 +2,34 @@ #include "typedefs.h" -#ifdef WINDOWS_ENABLED +#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 + +void baked_light_baker_add_64f(double *dst,double value) { + + + union { + int64_t i; + double f; + } swapy; + + + while(true) { + swapy.f=*dst; + int64_t from = swapy.i; + swapy.f+=value; + int64_t to=swapy.i; + if (__sync_bool_compare_and_swap((int64_t*)dst,from,to)) + break; + } +} + +void baked_light_baker_add_64i(int64_t *dst,int64_t value) { + + while(!__sync_bool_compare_and_swap(dst,*dst,(*dst)+value)) {} + +} + +#elif defined(WINDOWS_ENABLED) #include "windows.h" @@ -37,32 +64,6 @@ void baked_light_baker_add_64i(int64_t *dst,int64_t value) { } } -#elif (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 - -void baked_light_baker_add_64f(double *dst,double value) { - - - union { - int64_t i; - double f; - } swapy; - - - while(true) { - swapy.f=*dst; - int64_t from = swapy.i; - swapy.f+=value; - int64_t to=swapy.i; - if (__sync_bool_compare_and_swap((int64_t*)dst,from,to)) - break; - } -} - -void baked_light_baker_add_64i(int64_t *dst,int64_t value) { - - while(!__sync_bool_compare_and_swap(dst,*dst,(*dst)+value)) {} - -} #else diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp index 080ed7d11cbb..96c7e4540ca0 100644 --- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp @@ -13,7 +13,7 @@ void CollisionPolygon2DEditor::_notification(int p_what) { button_create->set_icon( get_icon("Edit","EditorIcons")); button_edit->set_icon( get_icon("MovePoint","EditorIcons")); button_edit->set_pressed(true); - + get_scene()->connect("node_removed",this,"_node_removed"); } break; case NOTIFICATION_FIXED_PROCESS: { @@ -28,6 +28,7 @@ void CollisionPolygon2DEditor::_node_removed(Node *p_node) { if(p_node==node) { node=NULL; hide(); + canvas_item_editor->get_viewport_control()->update(); } } @@ -83,6 +84,9 @@ void CollisionPolygon2DEditor::_wip_close() { bool CollisionPolygon2DEditor::forward_input_event(const InputEvent& p_event) { + if (!node) + return false; + switch(p_event.type) { case InputEvent::MOUSE_BUTTON: { @@ -379,6 +383,7 @@ void CollisionPolygon2DEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("_menu_option"),&CollisionPolygon2DEditor::_menu_option); ObjectTypeDB::bind_method(_MD("_canvas_draw"),&CollisionPolygon2DEditor::_canvas_draw); + ObjectTypeDB::bind_method(_MD("_node_removed"),&CollisionPolygon2DEditor::_node_removed); } diff --git a/tools/editor/plugins/mesh_editor_plugin.cpp b/tools/editor/plugins/mesh_editor_plugin.cpp index b8a5bd3bbe41..10e4c0b6815a 100644 --- a/tools/editor/plugins/mesh_editor_plugin.cpp +++ b/tools/editor/plugins/mesh_editor_plugin.cpp @@ -158,13 +158,54 @@ void MeshInstanceEditor::_menu_option(int p_option) { ur->add_undo_method(node,"remove_child",nmi); ur->commit_action(); } break; + case MENU_OPTION_CREATE_OUTLINE_MESH: { + + outline_dialog->popup_centered(Size2(200,80)); + } break; } } +void MeshInstanceEditor::_create_outline_mesh() { + + Ref mesh = node->get_mesh(); + if (mesh.is_null()) { + err_dialog->set_text("MeshInstance lacks a Mesh!"); + err_dialog->popup_centered(Size2(100,50)); + return; + } + + Ref mesho = mesh->create_outline(outline_size->get_val()); + + if (mesho.is_null()) { + err_dialog->set_text("Could not create outline!"); + err_dialog->popup_centered(Size2(100,50)); + return; + } + + MeshInstance *mi = memnew( MeshInstance ); + mi->set_mesh(mesho); + Node *owner=node->get_owner(); + if (get_scene()->get_edited_scene_root()==node) { + owner=node; + } + + UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); + + ur->create_action("Create Outline"); + + ur->add_do_method(node,"add_child",mi); + ur->add_do_method(mi,"set_owner",owner); + + ur->add_do_reference(mi); + ur->add_undo_method(node,"remove_child",mi); + ur->commit_action(); +} + void MeshInstanceEditor::_bind_methods() { ObjectTypeDB::bind_method("_menu_option",&MeshInstanceEditor::_menu_option); + ObjectTypeDB::bind_method("_create_outline_mesh",&MeshInstanceEditor::_create_outline_mesh); } MeshInstanceEditor::MeshInstanceEditor() { @@ -182,9 +223,23 @@ MeshInstanceEditor::MeshInstanceEditor() { options->get_popup()->add_item("Create Convex Collision Sibling",MENU_OPTION_CREATE_CONVEX_COLLISION_SHAPE); options->get_popup()->add_separator(); options->get_popup()->add_item("Create Navigation Mesh",MENU_OPTION_CREATE_NAVMESH); + options->get_popup()->add_separator(); + options->get_popup()->add_item("Create Outline Mesh..",MENU_OPTION_CREATE_OUTLINE_MESH); options->get_popup()->connect("item_pressed", this,"_menu_option"); + outline_dialog = memnew( ConfirmationDialog ); + outline_dialog->set_title("Outline Size: "); + outline_size = memnew( SpinBox ); + outline_size->set_min(0.001); + outline_size->set_max(1024); + outline_size->set_step(0.001); + outline_size->set_val(0.05); + outline_dialog->add_child(outline_size); + outline_dialog->set_child_rect(outline_size); + add_child(outline_dialog); + outline_dialog->connect("confirmed",this,"_create_outline_mesh"); + } diff --git a/tools/editor/plugins/mesh_editor_plugin.h b/tools/editor/plugins/mesh_editor_plugin.h index 557eb9014862..e502b5dc2b98 100644 --- a/tools/editor/plugins/mesh_editor_plugin.h +++ b/tools/editor/plugins/mesh_editor_plugin.h @@ -20,8 +20,12 @@ class MeshInstanceEditor : public Node { MENU_OPTION_CREATE_TRIMESH_COLLISION_SHAPE, MENU_OPTION_CREATE_CONVEX_COLLISION_SHAPE, MENU_OPTION_CREATE_NAVMESH, + MENU_OPTION_CREATE_OUTLINE_MESH, }; + ConfirmationDialog *outline_dialog; + SpinBox *outline_size; + AcceptDialog *err_dialog; @@ -33,6 +37,8 @@ class MeshInstanceEditor : public Node { void _menu_option(int p_option); + void _create_outline_mesh(); + friend class MeshInstanceEditorPlugin; MenuButton * options; diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 04d588886193..d48a4ce813b0 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -1779,7 +1779,7 @@ void CollisionShapeSpatialGizmo::set_handle(int p_idx,Camera *p_camera, const Po Ref cs = s; Vector3 ra,rb; Geometry::get_closest_points_between_segments(Vector3(),axis*4096,sg[0],sg[1],ra,rb); - float d = ra[p_idx]; + float d = axis.dot(ra); if (p_idx==1) d-=cs->get_radius(); if (d<0.001)