Merge pull request #44214 from akien-mga/3.2-cherrypicks
Cherry-picks for the 3.2 branch (future 3.2.4) - 12th batch
This commit is contained in:
commit
96e009c772
34 changed files with 449 additions and 1169 deletions
555
COPYRIGHT.txt
555
COPYRIGHT.txt
|
@ -53,7 +53,7 @@ Files: ./icon.png
|
|||
./logo.svg
|
||||
Comment: Godot Engine logo
|
||||
Copyright: 2017, Andrea Calabró
|
||||
License: CC-BY-3.0
|
||||
License: CC-BY-4.0
|
||||
|
||||
Files: ./modules/fbx/fbx_parser/
|
||||
Comment: Open Asset Import Library (assimp)
|
||||
|
@ -499,340 +499,317 @@ License: BSL-1.0
|
|||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
License: CC-BY-3.0
|
||||
Creative Commons Attribution 3.0 Unported
|
||||
License: CC-BY-4.0
|
||||
Creative Commons Attribution 4.0 International Public License
|
||||
.
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION
|
||||
ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE
|
||||
INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
ITS USE.
|
||||
By exercising the Licensed Rights (defined below), You accept and agree
|
||||
to be bound by the terms and conditions of this Creative Commons
|
||||
Attribution 4.0 International Public License ("Public
|
||||
License"). To the extent this Public License may be interpreted as a
|
||||
contract, You are granted the Licensed Rights in consideration of Your
|
||||
acceptance of these terms and conditions, and the Licensor grants You
|
||||
such rights in consideration of benefits the Licensor receives from
|
||||
making the Licensed Material available under these terms and
|
||||
conditions.
|
||||
.
|
||||
License
|
||||
Section 1 -- Definitions.
|
||||
.
|
||||
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
|
||||
COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
|
||||
COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
|
||||
AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
|
||||
a. Adapted Material means material subject to Copyright and Similar
|
||||
Rights that is derived from or based upon the Licensed Material
|
||||
and in which the Licensed Material is translated, altered,
|
||||
arranged, transformed, or otherwise modified in a manner requiring
|
||||
permission under the Copyright and Similar Rights held by the
|
||||
Licensor. For purposes of this Public License, where the Licensed
|
||||
Material is a musical work, performance, or sound recording,
|
||||
Adapted Material is always produced where the Licensed Material is
|
||||
synched in timed relation with a moving image.
|
||||
.
|
||||
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE
|
||||
TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY
|
||||
BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS
|
||||
CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
|
||||
CONDITIONS.
|
||||
b. Adapter's License means the license You apply to Your Copyright
|
||||
and Similar Rights in Your contributions to Adapted Material in
|
||||
accordance with the terms and conditions of this Public License.
|
||||
.
|
||||
1. Definitions
|
||||
c. Copyright and Similar Rights means copyright and/or similar rights
|
||||
closely related to copyright including, without limitation,
|
||||
performance, broadcast, sound recording, and Sui Generis Database
|
||||
Rights, without regard to how the rights are labeled or
|
||||
categorized. For purposes of this Public License, the rights
|
||||
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
||||
Rights.
|
||||
.
|
||||
a. "Adaptation" means a work based upon the Work, or upon the Work and
|
||||
other pre-existing works, such as a translation, adaptation, derivative
|
||||
work, arrangement of music or other alterations of a literary or
|
||||
artistic work, or phonogram or performance and includes cinematographic
|
||||
adaptations or any other form in which the Work may be recast,
|
||||
transformed, or adapted including in any form recognizably derived from
|
||||
the original, except that a work that constitutes a Collection will not
|
||||
be considered an Adaptation for the purpose of this License. For the
|
||||
avoidance of doubt, where the Work is a musical work, performance or
|
||||
phonogram, the synchronization of the Work in timed-relation with a
|
||||
moving image ("synching") will be considered an Adaptation for the
|
||||
purpose of this License.
|
||||
d. Effective Technological Measures means those measures that, in the
|
||||
absence of proper authority, may not be circumvented under laws
|
||||
fulfilling obligations under Article 11 of the WIPO Copyright
|
||||
Treaty adopted on December 20, 1996, and/or similar international
|
||||
agreements.
|
||||
.
|
||||
b. "Collection" means a collection of literary or artistic works, such
|
||||
as encyclopedias and anthologies, or performances, phonograms or
|
||||
broadcasts, or other works or subject matter other than works listed in
|
||||
Section 1(f) below, which, by reason of the selection and arrangement of
|
||||
their contents, constitute intellectual creations, in which the Work is
|
||||
included in its entirety in unmodified form along with one or more other
|
||||
contributions, each constituting separate and independent works in
|
||||
themselves, which together are assembled into a collective whole. A work
|
||||
that constitutes a Collection will not be considered an Adaptation (as
|
||||
defined above) for the purposes of this License.
|
||||
e. Exceptions and Limitations means fair use, fair dealing, and/or
|
||||
any other exception or limitation to Copyright and Similar Rights
|
||||
that applies to Your use of the Licensed Material.
|
||||
.
|
||||
c. "Distribute" means to make available to the public the original and
|
||||
copies of the Work or Adaptation, as appropriate, through sale or other
|
||||
transfer of ownership.
|
||||
f. Licensed Material means the artistic or literary work, database,
|
||||
or other material to which the Licensor applied this Public
|
||||
License.
|
||||
.
|
||||
d. "Licensor" means the individual, individuals, entity or entities that
|
||||
offer(s) the Work under the terms of this License.
|
||||
g. Licensed Rights means the rights granted to You subject to the
|
||||
terms and conditions of this Public License, which are limited to
|
||||
all Copyright and Similar Rights that apply to Your use of the
|
||||
Licensed Material and that the Licensor has authority to license.
|
||||
.
|
||||
e. "Original Author" means, in the case of a literary or artistic work,
|
||||
the individual, individuals, entity or entities who created the Work or
|
||||
if no individual or entity can be identified, the publisher; and in
|
||||
addition (i) in the case of a performance the actors, singers,
|
||||
musicians, dancers, and other persons who act, sing, deliver, declaim,
|
||||
play in, interpret or otherwise perform literary or artistic works or
|
||||
expressions of folklore; (ii) in the case of a phonogram the producer
|
||||
being the person or legal entity who first fixes the sounds of a
|
||||
performance or other sounds; and, (iii) in the case of broadcasts, the
|
||||
organization that transmits the broadcast.
|
||||
h. Licensor means the individual(s) or entity(ies) granting rights
|
||||
under this Public License.
|
||||
.
|
||||
f. "Work" means the literary and/or artistic work offered under the
|
||||
terms of this License including without limitation any production in the
|
||||
literary, scientific and artistic domain, whatever may be the mode or
|
||||
form of its expression including digital form, such as a book, pamphlet
|
||||
and other writing; a lecture, address, sermon or other work of the same
|
||||
nature; a dramatic or dramatico-musical work; a choreographic work or
|
||||
entertainment in dumb show; a musical composition with or without words;
|
||||
a cinematographic work to which are assimilated works expressed by a
|
||||
process analogous to cinematography; a work of drawing, painting,
|
||||
architecture, sculpture, engraving or lithography; a photographic work
|
||||
to which are assimilated works expressed by a process analogous to
|
||||
photography; a work of applied art; an illustration, map, plan, sketch
|
||||
or three-dimensional work relative to geography, topography,
|
||||
architecture or science; a performance; a broadcast; a phonogram; a
|
||||
compilation of data to the extent it is protected as a copyrightable
|
||||
work; or a work performed by a variety or circus performer to the extent
|
||||
it is not otherwise considered a literary or artistic work.
|
||||
i. Share means to provide material to the public by any means or
|
||||
process that requires permission under the Licensed Rights, such
|
||||
as reproduction, public display, public performance, distribution,
|
||||
dissemination, communication, or importation, and to make material
|
||||
available to the public including in ways that members of the
|
||||
public may access the material from a place and at a time
|
||||
individually chosen by them.
|
||||
.
|
||||
g. "You" means an individual or entity exercising rights under this
|
||||
License who has not previously violated the terms of this License with
|
||||
respect to the Work, or who has received express permission from the
|
||||
Licensor to exercise rights under this License despite a previous
|
||||
violation.
|
||||
j. Sui Generis Database Rights means rights other than copyright
|
||||
resulting from Directive 96/9/EC of the European Parliament and of
|
||||
the Council of 11 March 1996 on the legal protection of databases,
|
||||
as amended and/or succeeded, as well as other essentially
|
||||
equivalent rights anywhere in the world.
|
||||
.
|
||||
h. "Publicly Perform" means to perform public recitations of the Work
|
||||
and to communicate to the public those public recitations, by any means
|
||||
or process, including by wire or wireless means or public digital
|
||||
performances; to make available to the public Works in such a way that
|
||||
members of the public may access these Works from a place and at a place
|
||||
individually chosen by them; to perform the Work to the public by any
|
||||
means or process and the communication to the public of the performances
|
||||
of the Work, including by public digital performance; to broadcast and
|
||||
rebroadcast the Work by any means including signs, sounds or images.
|
||||
k. You means the individual or entity exercising the Licensed Rights
|
||||
under this Public License. Your has a corresponding meaning.
|
||||
.
|
||||
i. "Reproduce" means to make copies of the Work by any means including
|
||||
without limitation by sound or visual recordings and the right of
|
||||
fixation and reproducing fixations of the Work, including storage of a
|
||||
protected performance or phonogram in digital form or other electronic
|
||||
medium.
|
||||
Section 2 -- Scope.
|
||||
.
|
||||
2. Fair Dealing Rights. Nothing in this License is intended to reduce,
|
||||
limit, or restrict any uses free from copyright or rights arising from
|
||||
limitations or exceptions that are provided for in connection with the
|
||||
copyright protection under copyright law or other applicable laws.
|
||||
a. License grant.
|
||||
.
|
||||
3. License Grant. Subject to the terms and conditions of this License,
|
||||
Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
|
||||
perpetual (for the duration of the applicable copyright) license to
|
||||
exercise the rights in the Work as stated below:
|
||||
1. Subject to the terms and conditions of this Public License,
|
||||
the Licensor hereby grants You a worldwide, royalty-free,
|
||||
non-sublicensable, non-exclusive, irrevocable license to
|
||||
exercise the Licensed Rights in the Licensed Material to:
|
||||
.
|
||||
a. to Reproduce the Work, to incorporate the Work into one or more
|
||||
Collections, and to Reproduce the Work as incorporated in the
|
||||
Collections;
|
||||
a. reproduce and Share the Licensed Material, in whole or
|
||||
in part; and
|
||||
.
|
||||
b. to create and Reproduce Adaptations provided that any such
|
||||
Adaptation, including any translation in any medium, takes reasonable
|
||||
steps to clearly label, demarcate or otherwise identify that changes
|
||||
were made to the original Work. For example, a translation could be
|
||||
marked "The original work was translated from English to Spanish," or a
|
||||
modification could indicate "The original work has been modified.";
|
||||
b. produce, reproduce, and Share Adapted Material.
|
||||
.
|
||||
c. to Distribute and Publicly Perform the Work including as incorporated
|
||||
in Collections; and,
|
||||
2. Exceptions and Limitations. For the avoidance of doubt, where
|
||||
Exceptions and Limitations apply to Your use, this Public
|
||||
License does not apply, and You do not need to comply with
|
||||
its terms and conditions.
|
||||
.
|
||||
d. to Distribute and Publicly Perform Adaptations.
|
||||
3. Term. The term of this Public License is specified in Section
|
||||
6(a).
|
||||
.
|
||||
e. For the avoidance of doubt:
|
||||
4. Media and formats; technical modifications allowed. The
|
||||
Licensor authorizes You to exercise the Licensed Rights in
|
||||
all media and formats whether now known or hereafter created,
|
||||
and to make technical modifications necessary to do so. The
|
||||
Licensor waives and/or agrees not to assert any right or
|
||||
authority to forbid You from making technical modifications
|
||||
necessary to exercise the Licensed Rights, including
|
||||
technical modifications necessary to circumvent Effective
|
||||
Technological Measures. For purposes of this Public License,
|
||||
simply making modifications authorized by this Section 2(a)
|
||||
(4) never produces Adapted Material.
|
||||
.
|
||||
i. Non-waivable Compulsory License Schemes. In those jurisdictions in
|
||||
which the right to collect royalties through any statutory or compulsory
|
||||
licensing scheme cannot be waived, the Licensor reserves the exclusive
|
||||
right to collect such royalties for any exercise by You of the rights
|
||||
granted under this License;
|
||||
5. Downstream recipients.
|
||||
.
|
||||
ii. Waivable Compulsory License Schemes. In those jurisdictions in which
|
||||
the right to collect royalties through any statutory or compulsory
|
||||
licensing scheme can be waived, the Licensor waives the exclusive right
|
||||
to collect such royalties for any exercise by You of the rights granted
|
||||
under this License; and,
|
||||
a. Offer from the Licensor -- Licensed Material. Every
|
||||
recipient of the Licensed Material automatically
|
||||
receives an offer from the Licensor to exercise the
|
||||
Licensed Rights under the terms and conditions of this
|
||||
Public License.
|
||||
.
|
||||
iii. Voluntary License Schemes. The Licensor waives the right to collect
|
||||
royalties, whether individually or, in the event that the Licensor is a
|
||||
member of a collecting society that administers voluntary licensing
|
||||
schemes, via that society, from any exercise by You of the rights
|
||||
granted under this License.
|
||||
b. No downstream restrictions. You may not offer or impose
|
||||
any additional or different terms or conditions on, or
|
||||
apply any Effective Technological Measures to, the
|
||||
Licensed Material if doing so restricts exercise of the
|
||||
Licensed Rights by any recipient of the Licensed
|
||||
Material.
|
||||
.
|
||||
The above rights may be exercised in all media and formats whether now
|
||||
known or hereafter devised. The above rights include the right to make
|
||||
such modifications as are technically necessary to exercise the rights
|
||||
in other media and formats. Subject to Section 8(f), all rights not
|
||||
expressly granted by Licensor are hereby reserved.
|
||||
6. No endorsement. Nothing in this Public License constitutes or
|
||||
may be construed as permission to assert or imply that You
|
||||
are, or that Your use of the Licensed Material is, connected
|
||||
with, or sponsored, endorsed, or granted official status by,
|
||||
the Licensor or others designated to receive attribution as
|
||||
provided in Section 3(a)(1)(A)(i).
|
||||
.
|
||||
4. Restrictions. The license granted in Section 3 above is expressly
|
||||
made subject to and limited by the following restrictions:
|
||||
b. Other rights.
|
||||
.
|
||||
a. You may Distribute or Publicly Perform the Work only under the terms
|
||||
of this License. You must include a copy of, or the Uniform Resource
|
||||
Identifier (URI) for, this License with every copy of the Work You
|
||||
Distribute or Publicly Perform. You may not offer or impose any terms on
|
||||
the Work that restrict the terms of this License or the ability of the
|
||||
recipient of the Work to exercise the rights granted to that recipient
|
||||
under the terms of the License. You may not sublicense the Work. You
|
||||
must keep intact all notices that refer to this License and to the
|
||||
disclaimer of warranties with every copy of the Work You Distribute or
|
||||
Publicly Perform. When You Distribute or Publicly Perform the Work, You
|
||||
may not impose any effective technological measures on the Work that
|
||||
restrict the ability of a recipient of the Work from You to exercise the
|
||||
rights granted to that recipient under the terms of the License. This
|
||||
Section 4(a) applies to the Work as incorporated in a Collection, but
|
||||
this does not require the Collection apart from the Work itself to be
|
||||
made subject to the terms of this License. If You create a Collection,
|
||||
upon notice from any Licensor You must, to the extent practicable,
|
||||
remove from the Collection any credit as required by Section 4(b), as
|
||||
requested. If You create an Adaptation, upon notice from any Licensor
|
||||
You must, to the extent practicable, remove from the Adaptation any
|
||||
credit as required by Section 4(b), as requested.
|
||||
1. Moral rights, such as the right of integrity, are not
|
||||
licensed under this Public License, nor are publicity,
|
||||
privacy, and/or other similar personality rights; however, to
|
||||
the extent possible, the Licensor waives and/or agrees not to
|
||||
assert any such rights held by the Licensor to the limited
|
||||
extent necessary to allow You to exercise the Licensed
|
||||
Rights, but not otherwise.
|
||||
.
|
||||
b. If You Distribute, or Publicly Perform the Work or any Adaptations or
|
||||
Collections, You must, unless a request has been made pursuant to
|
||||
Section 4(a), keep intact all copyright notices for the Work and
|
||||
provide, reasonable to the medium or means You are utilizing: (i) the
|
||||
name of the Original Author (or pseudonym, if applicable) if supplied,
|
||||
and/or if the Original Author and/or Licensor designate another party or
|
||||
parties (e.g., a sponsor institute, publishing entity, journal) for
|
||||
attribution ("Attribution Parties") in Licensor's copyright notice,
|
||||
terms of service or by other reasonable means, the name of such party or
|
||||
parties; (ii) the title of the Work if supplied; (iii) to the extent
|
||||
reasonably practicable, the URI, if any, that Licensor specifies to be
|
||||
associated with the Work, unless such URI does not refer to the
|
||||
copyright notice or licensing information for the Work; and (iv) ,
|
||||
consistent with Section 3(b), in the case of an Adaptation, a credit
|
||||
identifying the use of the Work in the Adaptation (e.g., "French
|
||||
translation of the Work by Original Author," or "Screenplay based on
|
||||
original Work by Original Author"). The credit required by this Section
|
||||
4 (b) may be implemented in any reasonable manner; provided, however,
|
||||
that in the case of a Adaptation or Collection, at a minimum such credit
|
||||
will appear, if a credit for all contributing authors of the Adaptation
|
||||
or Collection appears, then as part of these credits and in a manner at
|
||||
least as prominent as the credits for the other contributing authors.
|
||||
For the avoidance of doubt, You may only use the credit required by this
|
||||
Section for the purpose of attribution in the manner set out above and,
|
||||
by exercising Your rights under this License, You may not implicitly or
|
||||
explicitly assert or imply any connection with, sponsorship or
|
||||
endorsement by the Original Author, Licensor and/or Attribution Parties,
|
||||
as appropriate, of You or Your use of the Work, without the separate,
|
||||
express prior written permission of the Original Author, Licensor and/or
|
||||
Attribution Parties.
|
||||
2. Patent and trademark rights are not licensed under this
|
||||
Public License.
|
||||
.
|
||||
c. Except as otherwise agreed in writing by the Licensor or as may be
|
||||
otherwise permitted by applicable law, if You Reproduce, Distribute or
|
||||
Publicly Perform the Work either by itself or as part of any Adaptations
|
||||
or Collections, You must not distort, mutilate, modify or take other
|
||||
derogatory action in relation to the Work which would be prejudicial to
|
||||
the Original Author's honor or reputation. Licensor agrees that in those
|
||||
jurisdictions (e.g. Japan), in which any exercise of the right granted
|
||||
in Section 3(b) of this License (the right to make Adaptations) would be
|
||||
deemed to be a distortion, mutilation, modification or other derogatory
|
||||
action prejudicial to the Original Author's honor and reputation, the
|
||||
Licensor will waive or not assert, as appropriate, this Section, to the
|
||||
fullest extent permitted by the applicable national law, to enable You
|
||||
to reasonably exercise Your right under Section 3(b) of this License
|
||||
(right to make Adaptations) but not otherwise.
|
||||
3. To the extent possible, the Licensor waives any right to
|
||||
collect royalties from You for the exercise of the Licensed
|
||||
Rights, whether directly or through a collecting society
|
||||
under any voluntary or waivable statutory or compulsory
|
||||
licensing scheme. In all other cases the Licensor expressly
|
||||
reserves any right to collect such royalties.
|
||||
.
|
||||
5. Representations, Warranties and Disclaimer
|
||||
Section 3 -- License Conditions.
|
||||
.
|
||||
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
|
||||
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
|
||||
KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
|
||||
INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
|
||||
LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS,
|
||||
WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE
|
||||
EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
|
||||
Your exercise of the Licensed Rights is expressly made subject to the
|
||||
following conditions.
|
||||
.
|
||||
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
|
||||
LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
|
||||
ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
|
||||
ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS
|
||||
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
a. Attribution.
|
||||
.
|
||||
7. Termination
|
||||
1. If You Share the Licensed Material (including in modified
|
||||
form), You must:
|
||||
.
|
||||
a. This License and the rights granted hereunder will terminate
|
||||
automatically upon any breach by You of the terms of this License.
|
||||
Individuals or entities who have received Adaptations or Collections
|
||||
from You under this License, however, will not have their licenses
|
||||
terminated provided such individuals or entities remain in full
|
||||
compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will
|
||||
survive any termination of this License.
|
||||
a. retain the following if it is supplied by the Licensor
|
||||
with the Licensed Material:
|
||||
.
|
||||
b. Subject to the above terms and conditions, the license granted here
|
||||
is perpetual (for the duration of the applicable copyright in the Work).
|
||||
Notwithstanding the above, Licensor reserves the right to release the
|
||||
Work under different license terms or to stop distributing the Work at
|
||||
any time; provided, however that any such election will not serve to
|
||||
withdraw this License (or any other license that has been, or is
|
||||
required to be, granted under the terms of this License), and this
|
||||
License will continue in full force and effect unless terminated as
|
||||
stated above.
|
||||
i. identification of the creator(s) of the Licensed
|
||||
Material and any others designated to receive
|
||||
attribution, in any reasonable manner requested by
|
||||
the Licensor (including by pseudonym if
|
||||
designated);
|
||||
.
|
||||
8. Miscellaneous
|
||||
ii. a copyright notice;
|
||||
.
|
||||
a. Each time You Distribute or Publicly Perform the Work or a
|
||||
Collection, the Licensor offers to the recipient a license to the Work
|
||||
on the same terms and conditions as the license granted to You under
|
||||
this License.
|
||||
iii. a notice that refers to this Public License;
|
||||
.
|
||||
b. Each time You Distribute or Publicly Perform an Adaptation, Licensor
|
||||
offers to the recipient a license to the original Work on the same terms
|
||||
and conditions as the license granted to You under this License.
|
||||
iv. a notice that refers to the disclaimer of
|
||||
warranties;
|
||||
.
|
||||
c. If any provision of this License is invalid or unenforceable under
|
||||
applicable law, it shall not affect the validity or enforceability of
|
||||
the remainder of the terms of this License, and without further action
|
||||
by the parties to this agreement, such provision shall be reformed to
|
||||
the minimum extent necessary to make such provision valid and
|
||||
enforceable.
|
||||
v. a URI or hyperlink to the Licensed Material to the
|
||||
extent reasonably practicable;
|
||||
.
|
||||
d. No term or provision of this License shall be deemed waived and no
|
||||
breach consented to unless such waiver or consent shall be in writing
|
||||
and signed by the party to be charged with such waiver or consent. This
|
||||
License constitutes the entire agreement between the parties with
|
||||
respect to the Work licensed here. There are no understandings,
|
||||
agreements or representations with respect to the Work not specified
|
||||
here. Licensor shall not be bound by any additional provisions that may
|
||||
appear in any communication from You.
|
||||
b. indicate if You modified the Licensed Material and
|
||||
retain an indication of any previous modifications; and
|
||||
.
|
||||
e. This License may not be modified without the mutual written agreement
|
||||
of the Licensor and You.
|
||||
c. indicate the Licensed Material is licensed under this
|
||||
Public License, and include the text of, or the URI or
|
||||
hyperlink to, this Public License.
|
||||
.
|
||||
f. The rights granted under, and the subject matter referenced, in this
|
||||
License were drafted utilizing the terminology of the Berne Convention
|
||||
for the Protection of Literary and Artistic Works (as amended on
|
||||
September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
|
||||
Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and
|
||||
the Universal Copyright Convention (as revised on July 24, 1971). These
|
||||
rights and subject matter take effect in the relevant jurisdiction in
|
||||
which the License terms are sought to be enforced according to the
|
||||
corresponding provisions of the implementation of those treaty
|
||||
provisions in the applicable national law. If the standard suite of
|
||||
rights granted under applicable copyright law includes additional rights
|
||||
not granted under this License, such additional rights are deemed to be
|
||||
included in the License; this License is not intended to restrict the
|
||||
license of any rights under applicable law.
|
||||
2. You may satisfy the conditions in Section 3(a)(1) in any
|
||||
reasonable manner based on the medium, means, and context in
|
||||
which You Share the Licensed Material. For example, it may be
|
||||
reasonable to satisfy the conditions by providing a URI or
|
||||
hyperlink to a resource that includes the required
|
||||
information.
|
||||
.
|
||||
Creative Commons Notice
|
||||
3. If requested by the Licensor, You must remove any of the
|
||||
information required by Section 3(a)(1)(A) to the extent
|
||||
reasonably practicable.
|
||||
.
|
||||
Creative Commons is not a party to this License, and makes no warranty
|
||||
whatsoever in connection with the Work. Creative Commons will not be
|
||||
liable to You or any party on any legal theory for any damages
|
||||
whatsoever, including without limitation any general, special,
|
||||
incidental or consequential damages arising in connection to this
|
||||
license. Notwithstanding the foregoing two (2) sentences, if Creative
|
||||
Commons has expressly identified itself as the Licensor hereunder, it
|
||||
shall have all rights and obligations of Licensor.
|
||||
4. If You Share Adapted Material You produce, the Adapter's
|
||||
License You apply must not prevent recipients of the Adapted
|
||||
Material from complying with this Public License.
|
||||
.
|
||||
Except for the limited purpose of indicating to the public that the Work
|
||||
is licensed under the CCPL, Creative Commons does not authorize the use
|
||||
by either party of the trademark "Creative Commons" or any related
|
||||
trademark or logo of Creative Commons without the prior written consent
|
||||
of Creative Commons. Any permitted use will be in compliance with
|
||||
Creative Commons' then-current trademark usage guidelines, as may be
|
||||
published on its website or otherwise made available upon request from
|
||||
time to time. For the avoidance of doubt, this trademark restriction
|
||||
does not form part of this License.
|
||||
Section 4 -- Sui Generis Database Rights.
|
||||
.
|
||||
Creative Commons may be contacted at http://creativecommons.org/.
|
||||
Where the Licensed Rights include Sui Generis Database Rights that
|
||||
apply to Your use of the Licensed Material:
|
||||
.
|
||||
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
||||
to extract, reuse, reproduce, and Share all or a substantial
|
||||
portion of the contents of the database;
|
||||
.
|
||||
b. if You include all or a substantial portion of the database
|
||||
contents in a database in which You have Sui Generis Database
|
||||
Rights, then the database in which You have Sui Generis Database
|
||||
Rights (but not its individual contents) is Adapted Material; and
|
||||
.
|
||||
c. You must comply with the conditions in Section 3(a) if You Share
|
||||
all or a substantial portion of the contents of the database.
|
||||
.
|
||||
For the avoidance of doubt, this Section 4 supplements and does not
|
||||
replace Your obligations under this Public License where the Licensed
|
||||
Rights include other Copyright and Similar Rights.
|
||||
.
|
||||
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
||||
.
|
||||
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
||||
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
||||
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
||||
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
||||
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
||||
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
||||
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
||||
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
||||
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
||||
.
|
||||
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
||||
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
||||
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
||||
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
||||
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
||||
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
||||
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
||||
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
||||
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
||||
.
|
||||
c. The disclaimer of warranties and limitation of liability provided
|
||||
above shall be interpreted in a manner that, to the extent
|
||||
possible, most closely approximates an absolute disclaimer and
|
||||
waiver of all liability.
|
||||
.
|
||||
Section 6 -- Term and Termination.
|
||||
.
|
||||
a. This Public License applies for the term of the Copyright and
|
||||
Similar Rights licensed here. However, if You fail to comply with
|
||||
this Public License, then Your rights under this Public License
|
||||
terminate automatically.
|
||||
.
|
||||
b. Where Your right to use the Licensed Material has terminated under
|
||||
Section 6(a), it reinstates:
|
||||
.
|
||||
1. automatically as of the date the violation is cured, provided
|
||||
it is cured within 30 days of Your discovery of the
|
||||
violation; or
|
||||
.
|
||||
2. upon express reinstatement by the Licensor.
|
||||
.
|
||||
For the avoidance of doubt, this Section 6(b) does not affect any
|
||||
right the Licensor may have to seek remedies for Your violations
|
||||
of this Public License.
|
||||
.
|
||||
c. For the avoidance of doubt, the Licensor may also offer the
|
||||
Licensed Material under separate terms or conditions or stop
|
||||
distributing the Licensed Material at any time; however, doing so
|
||||
will not terminate this Public License.
|
||||
.
|
||||
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
||||
License.
|
||||
.
|
||||
Section 7 -- Other Terms and Conditions.
|
||||
.
|
||||
a. The Licensor shall not be bound by any additional or different
|
||||
terms or conditions communicated by You unless expressly agreed.
|
||||
.
|
||||
b. Any arrangements, understandings, or agreements regarding the
|
||||
Licensed Material not stated herein are separate from and
|
||||
independent of the terms and conditions of this Public License.
|
||||
.
|
||||
Section 8 -- Interpretation.
|
||||
.
|
||||
a. For the avoidance of doubt, this Public License does not, and
|
||||
shall not be interpreted to, reduce, limit, restrict, or impose
|
||||
conditions on any use of the Licensed Material that could lawfully
|
||||
be made without permission under this Public License.
|
||||
.
|
||||
b. To the extent possible, if any provision of this Public License is
|
||||
deemed unenforceable, it shall be automatically reformed to the
|
||||
minimum extent necessary to make it enforceable. If the provision
|
||||
cannot be reformed, it shall be severed from this Public License
|
||||
without affecting the enforceability of the remaining terms and
|
||||
conditions.
|
||||
.
|
||||
c. No term or condition of this Public License will be waived and no
|
||||
failure to comply consented to unless expressly agreed to by the
|
||||
Licensor.
|
||||
.
|
||||
d. Nothing in this Public License constitutes or may be interpreted
|
||||
as a limitation upon, or waiver of, any privileges and immunities
|
||||
that apply to the Licensor or You, including from the legal
|
||||
processes of any jurisdiction or authority.
|
||||
|
||||
License: Expat
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
Godot Logo (C) Andrea Calabró
|
||||
Distributed under the terms of the Creative Commons Attribution License
|
||||
version 3.0 (CC-BY 3.0) <https://creativecommons.org/licenses/by/3.0/legalcode>.
|
||||
Godot Engine Logo
|
||||
Copyright (c) 2017 Andrea Calabró
|
||||
|
||||
This work is licensed under a Creative Commons Attribution 4.0 International
|
||||
License (CC-BY-4.0 International) <https://creativecommons.org/licenses/by/4.0/>.
|
||||
|
|
|
@ -1,176 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* file_access_buffered.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "file_access_buffered.h"
|
||||
|
||||
#include "core/error_macros.h"
|
||||
|
||||
Error FileAccessBuffered::set_error(Error p_error) const {
|
||||
|
||||
return (last_error = p_error);
|
||||
}
|
||||
|
||||
void FileAccessBuffered::set_cache_size(int p_size) {
|
||||
|
||||
cache_size = p_size;
|
||||
}
|
||||
|
||||
int FileAccessBuffered::get_cache_size() {
|
||||
|
||||
return cache_size;
|
||||
}
|
||||
|
||||
int FileAccessBuffered::cache_data_left() const {
|
||||
|
||||
if (file.offset >= file.size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cache.offset == -1 || file.offset < cache.offset || file.offset >= cache.offset + cache.buffer.size()) {
|
||||
|
||||
return read_data_block(file.offset, cache_size);
|
||||
}
|
||||
|
||||
return cache.buffer.size() - (file.offset - cache.offset);
|
||||
}
|
||||
|
||||
void FileAccessBuffered::seek(size_t p_position) {
|
||||
|
||||
file.offset = p_position;
|
||||
}
|
||||
|
||||
void FileAccessBuffered::seek_end(int64_t p_position) {
|
||||
|
||||
file.offset = file.size + p_position;
|
||||
}
|
||||
|
||||
size_t FileAccessBuffered::get_position() const {
|
||||
|
||||
return file.offset;
|
||||
}
|
||||
|
||||
size_t FileAccessBuffered::get_len() const {
|
||||
|
||||
return file.size;
|
||||
}
|
||||
|
||||
bool FileAccessBuffered::eof_reached() const {
|
||||
|
||||
return file.offset > file.size;
|
||||
}
|
||||
|
||||
uint8_t FileAccessBuffered::get_8() const {
|
||||
|
||||
ERR_FAIL_COND_V_MSG(!file.open, 0, "Can't get data, when file is not opened.");
|
||||
|
||||
uint8_t byte = 0;
|
||||
if (cache_data_left() >= 1) {
|
||||
|
||||
byte = cache.buffer[file.offset - cache.offset];
|
||||
}
|
||||
|
||||
++file.offset;
|
||||
|
||||
return byte;
|
||||
}
|
||||
|
||||
int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_length) const {
|
||||
|
||||
ERR_FAIL_COND_V_MSG(!file.open, -1, "Can't get buffer, when file is not opened.");
|
||||
|
||||
if (p_length > cache_size) {
|
||||
|
||||
int total_read = 0;
|
||||
|
||||
if (!(cache.offset == -1 || file.offset < cache.offset || file.offset >= cache.offset + cache.buffer.size())) {
|
||||
|
||||
int size = (cache.buffer.size() - (file.offset - cache.offset));
|
||||
size = size - (size % 4);
|
||||
//PoolVector<uint8_t>::Read read = cache.buffer.read();
|
||||
//memcpy(p_dest, read.ptr() + (file.offset - cache.offset), size);
|
||||
memcpy(p_dest, cache.buffer.ptr() + (file.offset - cache.offset), size);
|
||||
p_dest += size;
|
||||
p_length -= size;
|
||||
file.offset += size;
|
||||
total_read += size;
|
||||
}
|
||||
|
||||
int err = read_data_block(file.offset, p_length, p_dest);
|
||||
if (err >= 0) {
|
||||
total_read += err;
|
||||
file.offset += err;
|
||||
}
|
||||
|
||||
return total_read;
|
||||
}
|
||||
|
||||
int to_read = p_length;
|
||||
int total_read = 0;
|
||||
while (to_read > 0) {
|
||||
|
||||
int left = cache_data_left();
|
||||
if (left == 0) {
|
||||
file.offset += to_read;
|
||||
return total_read;
|
||||
}
|
||||
if (left < 0) {
|
||||
return left;
|
||||
}
|
||||
|
||||
int r = MIN(left, to_read);
|
||||
//PoolVector<uint8_t>::Read read = cache.buffer.read();
|
||||
//memcpy(p_dest+total_read, &read.ptr()[file.offset - cache.offset], r);
|
||||
memcpy(p_dest + total_read, cache.buffer.ptr() + (file.offset - cache.offset), r);
|
||||
|
||||
file.offset += r;
|
||||
total_read += r;
|
||||
to_read -= r;
|
||||
}
|
||||
|
||||
return p_length;
|
||||
}
|
||||
|
||||
bool FileAccessBuffered::is_open() const {
|
||||
|
||||
return file.open;
|
||||
}
|
||||
|
||||
Error FileAccessBuffered::get_error() const {
|
||||
|
||||
return last_error;
|
||||
}
|
||||
|
||||
FileAccessBuffered::FileAccessBuffered() {
|
||||
|
||||
cache_size = DEFAULT_CACHE_SIZE;
|
||||
}
|
||||
|
||||
FileAccessBuffered::~FileAccessBuffered() {
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* file_access_buffered.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef FILE_ACCESS_BUFFERED_H
|
||||
#define FILE_ACCESS_BUFFERED_H
|
||||
|
||||
#include "core/os/file_access.h"
|
||||
#include "core/pool_vector.h"
|
||||
#include "core/ustring.h"
|
||||
|
||||
class FileAccessBuffered : public FileAccess {
|
||||
|
||||
public:
|
||||
enum {
|
||||
DEFAULT_CACHE_SIZE = 128 * 1024,
|
||||
};
|
||||
|
||||
private:
|
||||
int cache_size;
|
||||
|
||||
int cache_data_left() const;
|
||||
mutable Error last_error;
|
||||
|
||||
protected:
|
||||
Error set_error(Error p_error) const;
|
||||
|
||||
mutable struct File {
|
||||
bool open = false;
|
||||
int size = 0;
|
||||
int offset = 0;
|
||||
String name;
|
||||
int access_flags = 0;
|
||||
} file;
|
||||
|
||||
mutable struct Cache {
|
||||
Vector<uint8_t> buffer;
|
||||
int offset = 0;
|
||||
} cache;
|
||||
|
||||
virtual int read_data_block(int p_offset, int p_size, uint8_t *p_dest = 0) const = 0;
|
||||
|
||||
void set_cache_size(int p_size);
|
||||
int get_cache_size();
|
||||
|
||||
public:
|
||||
virtual size_t get_position() const; ///< get position in the file
|
||||
virtual size_t get_len() const; ///< get size of the file
|
||||
|
||||
virtual void seek(size_t p_position); ///< seek to a given position
|
||||
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
|
||||
|
||||
virtual bool eof_reached() const;
|
||||
|
||||
virtual uint8_t get_8() const;
|
||||
virtual int get_buffer(uint8_t *p_dest, int p_length) const; ///< get an array of bytes
|
||||
|
||||
virtual bool is_open() const;
|
||||
|
||||
virtual Error get_error() const;
|
||||
|
||||
FileAccessBuffered();
|
||||
virtual ~FileAccessBuffered();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,159 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* file_access_buffered_fa.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef FILE_ACCESS_BUFFERED_FA_H
|
||||
#define FILE_ACCESS_BUFFERED_FA_H
|
||||
|
||||
#include "core/io/file_access_buffered.h"
|
||||
|
||||
template <class T>
|
||||
class FileAccessBufferedFA : public FileAccessBuffered {
|
||||
|
||||
T f;
|
||||
|
||||
int read_data_block(int p_offset, int p_size, uint8_t *p_dest = 0) const {
|
||||
|
||||
ERR_FAIL_COND_V_MSG(!f.is_open(), -1, "Can't read data block when file is not opened.");
|
||||
|
||||
((T *)&f)->seek(p_offset);
|
||||
|
||||
if (p_dest) {
|
||||
|
||||
f.get_buffer(p_dest, p_size);
|
||||
return p_size;
|
||||
|
||||
} else {
|
||||
|
||||
cache.offset = p_offset;
|
||||
cache.buffer.resize(p_size);
|
||||
|
||||
// on PoolVector
|
||||
//PoolVector<uint8_t>::Write write = cache.buffer.write();
|
||||
//f.get_buffer(write.ptrw(), p_size);
|
||||
|
||||
// on vector
|
||||
f.get_buffer(cache.buffer.ptrw(), p_size);
|
||||
|
||||
return p_size;
|
||||
};
|
||||
};
|
||||
|
||||
static FileAccess *create() {
|
||||
|
||||
return memnew(FileAccessBufferedFA<T>());
|
||||
};
|
||||
|
||||
protected:
|
||||
virtual void _set_access_type(AccessType p_access) {
|
||||
f._set_access_type(p_access);
|
||||
FileAccessBuffered::_set_access_type(p_access);
|
||||
};
|
||||
|
||||
public:
|
||||
void flush() {
|
||||
|
||||
f.flush();
|
||||
};
|
||||
|
||||
void store_8(uint8_t p_dest) {
|
||||
|
||||
f.store_8(p_dest);
|
||||
};
|
||||
|
||||
void store_buffer(const uint8_t *p_src, int p_length) {
|
||||
|
||||
f.store_buffer(p_src, p_length);
|
||||
};
|
||||
|
||||
bool file_exists(const String &p_name) {
|
||||
|
||||
return f.file_exists(p_name);
|
||||
};
|
||||
|
||||
Error _open(const String &p_path, int p_mode_flags) {
|
||||
|
||||
close();
|
||||
|
||||
Error ret = f._open(p_path, p_mode_flags);
|
||||
if (ret != OK)
|
||||
return ret;
|
||||
//ERR_FAIL_COND_V( ret != OK, ret );
|
||||
|
||||
file.size = f.get_len();
|
||||
file.offset = 0;
|
||||
file.open = true;
|
||||
file.name = p_path;
|
||||
file.access_flags = p_mode_flags;
|
||||
|
||||
cache.buffer.resize(0);
|
||||
cache.offset = 0;
|
||||
|
||||
return set_error(OK);
|
||||
};
|
||||
|
||||
void close() {
|
||||
|
||||
f.close();
|
||||
|
||||
file.offset = 0;
|
||||
file.size = 0;
|
||||
file.open = false;
|
||||
file.name = "";
|
||||
|
||||
cache.buffer.resize(0);
|
||||
cache.offset = 0;
|
||||
set_error(OK);
|
||||
};
|
||||
|
||||
/*
|
||||
static void make_default() {
|
||||
FileAccess::create_func = FileAccessBufferedFA<T>::create;
|
||||
};
|
||||
*/
|
||||
|
||||
virtual uint64_t _get_modified_time(const String &p_file) {
|
||||
|
||||
return f._get_modified_time(p_file);
|
||||
}
|
||||
|
||||
virtual uint32_t _get_unix_permissions(const String &p_file) {
|
||||
return f._get_unix_permissions(p_file);
|
||||
}
|
||||
|
||||
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions) {
|
||||
return f._set_unix_permissions(p_file, p_permissions);
|
||||
}
|
||||
|
||||
FileAccessBufferedFA(){
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
#endif // FILE_ACCESS_BUFFERED_FA_H
|
|
@ -154,7 +154,7 @@ void RotatedFileLogger::rotate_file() {
|
|||
char timestamp[21];
|
||||
OS::Date date = OS::get_singleton()->get_date();
|
||||
OS::Time time = OS::get_singleton()->get_time();
|
||||
sprintf(timestamp, "_%04d-%02d-%02d_%02d-%02d-%02d", date.year, date.month, date.day, time.hour, time.min, time.sec);
|
||||
sprintf(timestamp, "_%04d-%02d-%02d_%02d.%02d.%02d", date.year, date.month, date.day, time.hour, time.min, time.sec);
|
||||
|
||||
String backup_name = base_path.get_basename() + timestamp;
|
||||
if (base_path.get_extension() != String()) {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<argument index="0" name="from" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Cast a float value to an integer value, this method simply removes the number fractions, so for example [code]int(2.7)[/code] will be equals to 2, [code]int(.1)[/code] will be equals to 0 and [code]int(-2.7)[/code] will be equals to -2.
|
||||
Cast a float value to an integer value, this method simply removes the number fractions (i.e. rounds [code]from[/code] towards zero), so for example [code]int(2.7)[/code] will be equals to 2, [code]int(0.1)[/code] will be equals to 0 and [code]int(-2.7)[/code] will be equals to -2. This operation is also called truncation.
|
||||
</description>
|
||||
</method>
|
||||
<method name="int">
|
||||
|
|
|
@ -136,7 +136,6 @@ void OS_Unix::initialize_core() {
|
|||
FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_RESOURCES);
|
||||
FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_USERDATA);
|
||||
FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_FILESYSTEM);
|
||||
//FileAccessBufferedFA<FileAccessUnix>::make_default();
|
||||
DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_RESOURCES);
|
||||
DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_USERDATA);
|
||||
DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_FILESYSTEM);
|
||||
|
|
|
@ -2243,16 +2243,16 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
|
|||
}
|
||||
|
||||
if (p_paths.size() == 1) {
|
||||
p_popup->add_icon_item(get_icon("ActionCopy", "EditorIcons"), TTR("Copy Path"), FILE_COPY_PATH);
|
||||
p_popup->add_icon_shortcut(get_icon("ActionCopy", "EditorIcons"), ED_GET_SHORTCUT("filesystem_dock/copy_path"), FILE_COPY_PATH);
|
||||
if (p_paths[0] != "res://") {
|
||||
p_popup->add_icon_item(get_icon("Rename", "EditorIcons"), TTR("Rename..."), FILE_RENAME);
|
||||
p_popup->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate..."), FILE_DUPLICATE);
|
||||
p_popup->add_icon_shortcut(get_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("filesystem_dock/rename"), FILE_RENAME);
|
||||
p_popup->add_icon_shortcut(get_icon("Duplicate", "EditorIcons"), ED_GET_SHORTCUT("filesystem_dock/duplicate"), FILE_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
||||
if (p_paths.size() > 1 || p_paths[0] != "res://") {
|
||||
p_popup->add_icon_item(get_icon("MoveUp", "EditorIcons"), TTR("Move To..."), FILE_MOVE);
|
||||
p_popup->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Move to Trash"), FILE_REMOVE);
|
||||
p_popup->add_icon_shortcut(get_icon("Remove", "EditorIcons"), ED_GET_SHORTCUT("filesystem_dock/delete"), FILE_REMOVE);
|
||||
}
|
||||
|
||||
if (p_paths.size() == 1) {
|
||||
|
@ -2387,7 +2387,11 @@ void FileSystemDock::_tree_gui_input(Ref<InputEvent> p_event) {
|
|||
_tree_rmb_option(FILE_REMOVE);
|
||||
} else if (ED_IS_SHORTCUT("filesystem_dock/rename", p_event)) {
|
||||
_tree_rmb_option(FILE_RENAME);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
accept_event();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2405,7 +2409,11 @@ void FileSystemDock::_file_list_gui_input(Ref<InputEvent> p_event) {
|
|||
_file_list_rmb_option(FILE_REMOVE);
|
||||
} else if (ED_IS_SHORTCUT("filesystem_dock/rename", p_event)) {
|
||||
_file_list_rmb_option(FILE_RENAME);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
accept_event();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2550,8 +2558,8 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
|
|||
// `KEY_MASK_CMD | KEY_C` conflicts with other editor shortcuts.
|
||||
ED_SHORTCUT("filesystem_dock/copy_path", TTR("Copy Path"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_C);
|
||||
ED_SHORTCUT("filesystem_dock/duplicate", TTR("Duplicate..."), KEY_MASK_CMD | KEY_D);
|
||||
ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), KEY_DELETE);
|
||||
ED_SHORTCUT("filesystem_dock/rename", TTR("Rename"));
|
||||
ED_SHORTCUT("filesystem_dock/delete", TTR("Move to Trash"), KEY_DELETE);
|
||||
ED_SHORTCUT("filesystem_dock/rename", TTR("Rename..."), KEY_F2);
|
||||
|
||||
VBoxContainer *top_vbc = memnew(VBoxContainer);
|
||||
add_child(top_vbc);
|
||||
|
|
|
@ -2344,8 +2344,8 @@ void TileSetEditor::_set_edited_collision_shape(const Ref<Shape2D> &p_shape) {
|
|||
}
|
||||
|
||||
void TileSetEditor::_set_snap_step(Vector2 p_val) {
|
||||
snap_step.x = CLAMP(p_val.x, 0, 256);
|
||||
snap_step.y = CLAMP(p_val.y, 0, 256);
|
||||
snap_step.x = CLAMP(p_val.x, 1, 256);
|
||||
snap_step.y = CLAMP(p_val.y, 1, 256);
|
||||
workspace->update();
|
||||
}
|
||||
|
||||
|
|
|
@ -55,8 +55,7 @@
|
|||
<description>
|
||||
Returns the absolute value of parameter [code]s[/code] (i.e. positive value).
|
||||
[codeblock]
|
||||
# a is 1
|
||||
a = abs(-1)
|
||||
a = abs(-1) # a is 1
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
@ -166,10 +165,10 @@
|
|||
<description>
|
||||
Rounds [code]s[/code] upward (towards positive infinity), returning the smallest whole number that is not less than [code]s[/code].
|
||||
[codeblock]
|
||||
i = ceil(1.45) # i is 2
|
||||
i = ceil(1.001) # i is 2
|
||||
a = ceil(1.45) # a is 2.0
|
||||
a = ceil(1.001) # a is 2.0
|
||||
[/codeblock]
|
||||
See also [method floor], [method round], and [method stepify].
|
||||
See also [method floor], [method round], [method stepify], and [int].
|
||||
</description>
|
||||
</method>
|
||||
<method name="char">
|
||||
|
@ -199,13 +198,9 @@
|
|||
<description>
|
||||
Clamps [code]value[/code] and returns a value not less than [code]min[/code] and not more than [code]max[/code].
|
||||
[codeblock]
|
||||
speed = 1000
|
||||
# a is 20
|
||||
a = clamp(speed, 1, 20)
|
||||
|
||||
speed = -10
|
||||
# a is 1
|
||||
a = clamp(speed, 1, 20)
|
||||
a = clamp(1000, 1, 20) # a is 20
|
||||
a = clamp(-10, 1, 20) # a is 1
|
||||
a = clamp(15, 1, 20) # a is 15
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
@ -236,9 +231,8 @@
|
|||
<description>
|
||||
Returns the cosine of angle [code]s[/code] in radians.
|
||||
[codeblock]
|
||||
# Prints 1 then -1
|
||||
print(cos(PI * 2))
|
||||
print(cos(PI))
|
||||
a = cos(TAU) # a is 1.0
|
||||
a = cos(PI) # a is -1.0
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
@ -250,8 +244,7 @@
|
|||
<description>
|
||||
Returns the hyperbolic cosine of [code]s[/code] in radians.
|
||||
[codeblock]
|
||||
# Prints 1.543081
|
||||
print(cosh(1))
|
||||
print(cosh(1)) # Prints 1.543081
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
@ -285,8 +278,7 @@
|
|||
<description>
|
||||
Returns the result of [code]value[/code] decreased by [code]step[/code] * [code]amount[/code].
|
||||
[codeblock]
|
||||
# a = 59
|
||||
a = dectime(60, 10, 0.1))
|
||||
a = dectime(60, 10, 0.1)) # a is 59.0
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
@ -298,8 +290,7 @@
|
|||
<description>
|
||||
Converts an angle expressed in degrees to radians.
|
||||
[codeblock]
|
||||
# r is 3.141593
|
||||
r = deg2rad(180)
|
||||
r = deg2rad(180) # r is 3.141593
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
@ -309,7 +300,7 @@
|
|||
<argument index="0" name="dict" type="Dictionary">
|
||||
</argument>
|
||||
<description>
|
||||
Converts a previously converted instance to a dictionary, back into an instance. Useful for deserializing.
|
||||
Converts a dictionary (previously created with [method inst2dict]) back to an instance. Useful for deserializing.
|
||||
</description>
|
||||
</method>
|
||||
<method name="ease">
|
||||
|
@ -345,13 +336,12 @@
|
|||
<description>
|
||||
Rounds [code]s[/code] downward (towards negative infinity), returning the largest whole number that is not more than [code]s[/code].
|
||||
[codeblock]
|
||||
# a is 2.0
|
||||
a = floor(2.99)
|
||||
# a is -3.0
|
||||
a = floor(-2.99)
|
||||
a = floor(2.45) # a is 2.0
|
||||
a = floor(2.99) # a is 2.0
|
||||
a = floor(-2.99) # a is -3.0
|
||||
[/codeblock]
|
||||
See also [method ceil], [method round], and [method stepify].
|
||||
[b]Note:[/b] This method returns a float. If you need an integer, you can use [code]int(s)[/code] directly.
|
||||
See also [method ceil], [method round], [method stepify], and [int].
|
||||
[b]Note:[/b] This method returns a float. If you need an integer and [code]s[/code] is a non-negative number, you can use [code]int(s)[/code] directly.
|
||||
</description>
|
||||
</method>
|
||||
<method name="fmod">
|
||||
|
@ -364,8 +354,7 @@
|
|||
<description>
|
||||
Returns the floating-point remainder of [code]a/b[/code], keeping the sign of [code]a[/code].
|
||||
[codeblock]
|
||||
# Remainder is 1.5
|
||||
var remainder = fmod(7, 5.5)
|
||||
r = fmod(7, 5.5) # r is 1.5
|
||||
[/codeblock]
|
||||
For the integer remainder operation, use the % operator.
|
||||
</description>
|
||||
|
@ -793,7 +782,7 @@
|
|||
<description>
|
||||
Returns the result of [code]x[/code] raised to the power of [code]y[/code].
|
||||
[codeblock]
|
||||
pow(2, 5) # Returns 32
|
||||
pow(2, 5) # Returns 32.0
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
@ -818,7 +807,7 @@
|
|||
Converts one or more arguments to strings in the best way possible and prints them to the console.
|
||||
[codeblock]
|
||||
a = [1, 2, 3]
|
||||
print("a", "b", a) # Prints ab[1, 2, 3]
|
||||
print("a", "=", a) # Prints a=[1, 2, 3]
|
||||
[/codeblock]
|
||||
[b]Note:[/b] Consider using [method push_error] and [method push_warning] to print error and warning messages instead of [method print]. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed.
|
||||
</description>
|
||||
|
@ -917,7 +906,7 @@
|
|||
<description>
|
||||
Converts an angle expressed in radians to degrees.
|
||||
[codeblock]
|
||||
rad2deg(0.523599) # Returns 30
|
||||
rad2deg(0.523599) # Returns 30.0
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
@ -1024,9 +1013,11 @@
|
|||
<description>
|
||||
Rounds [code]s[/code] to the nearest whole number, with halfway cases rounded away from zero.
|
||||
[codeblock]
|
||||
round(2.6) # Returns 3
|
||||
a = round(2.49) # a is 2.0
|
||||
a = round(2.5) # a is 3.0
|
||||
a = round(2.51) # a is 3.0
|
||||
[/codeblock]
|
||||
See also [method floor], [method ceil], and [method stepify].
|
||||
See also [method floor], [method ceil], [method stepify], and [int].
|
||||
</description>
|
||||
</method>
|
||||
<method name="seed">
|
||||
|
@ -1093,9 +1084,10 @@
|
|||
<description>
|
||||
Returns a number smoothly interpolated between the [code]from[/code] and [code]to[/code], based on the [code]weight[/code]. Similar to [method lerp], but interpolates faster at the beginning and slower at the end.
|
||||
[codeblock]
|
||||
smoothstep(0, 2, 0.5) # Returns 0.15
|
||||
smoothstep(0, 2, 1.0) # Returns 0.5
|
||||
smoothstep(0, 2, 2.0) # Returns 1.0
|
||||
smoothstep(0, 2, -5.0) # Returns 0.0
|
||||
smoothstep(0, 2, 0.5) # Returns 0.15625
|
||||
smoothstep(0, 2, 1.0) # Returns 0.5
|
||||
smoothstep(0, 2, 2.0) # Returns 1.0
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
@ -1120,12 +1112,9 @@
|
|||
<description>
|
||||
Returns the position of the first non-zero digit, after the decimal point. Note that the maximum return value is 10, which is a design decision in the implementation.
|
||||
[codeblock]
|
||||
# n is 0
|
||||
n = step_decimals(5)
|
||||
# n is 4
|
||||
n = step_decimals(1.0005)
|
||||
# n is 9
|
||||
n = step_decimals(0.000000005)
|
||||
n = step_decimals(5) # n is 0
|
||||
n = step_decimals(1.0005) # n is 4
|
||||
n = step_decimals(0.000000005) # n is 9
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
@ -1139,10 +1128,10 @@
|
|||
<description>
|
||||
Snaps float value [code]s[/code] to a given [code]step[/code]. This can also be used to round a floating point number to an arbitrary number of decimals.
|
||||
[codeblock]
|
||||
stepify(100, 32) # Returns 96
|
||||
stepify(100, 32) # Returns 96.0
|
||||
stepify(3.14159, 0.01) # Returns 3.14
|
||||
[/codeblock]
|
||||
See also [method ceil], [method floor], and [method round].
|
||||
See also [method ceil], [method floor], [method round], and [int].
|
||||
</description>
|
||||
</method>
|
||||
<method name="str" qualifiers="vararg">
|
||||
|
@ -1192,8 +1181,8 @@
|
|||
<description>
|
||||
Returns the hyperbolic tangent of [code]s[/code].
|
||||
[codeblock]
|
||||
a = log(2.0) # Returns 0.693147
|
||||
tanh(a) # Returns 0.6
|
||||
a = log(2.0) # a is 0.693147
|
||||
b = tanh(a) # b is 0.6
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
|
|
|
@ -130,7 +130,8 @@ GDScriptDataType GDScriptCompiler::_gdtype_from_datatype(const GDScriptParser::D
|
|||
} break;
|
||||
case GDScriptParser::DataType::SCRIPT: {
|
||||
result.kind = GDScriptDataType::SCRIPT;
|
||||
result.script_type = Ref<Script>(p_datatype.script_type).ptr();
|
||||
result.script_type_ref = Ref<Script>(p_datatype.script_type);
|
||||
result.script_type = result.script_type_ref.ptr();
|
||||
result.native_type = result.script_type->get_instance_base_type();
|
||||
} break;
|
||||
case GDScriptParser::DataType::GDSCRIPT: {
|
||||
|
@ -159,7 +160,8 @@ GDScriptDataType GDScriptCompiler::_gdtype_from_datatype(const GDScriptParser::D
|
|||
}
|
||||
|
||||
result.kind = GDScriptDataType::GDSCRIPT;
|
||||
result.script_type = Ref<Script>(script).ptr();
|
||||
result.script_type_ref = Ref<Script>(script);
|
||||
result.script_type = result.script_type_ref.ptr();
|
||||
result.native_type = script->get_instance_base_type();
|
||||
} break;
|
||||
default: {
|
||||
|
@ -170,8 +172,8 @@ GDScriptDataType GDScriptCompiler::_gdtype_from_datatype(const GDScriptParser::D
|
|||
|
||||
// Only hold strong reference to the script if it's not the owner of the
|
||||
// element qualified with this type, to avoid cyclic references (leaks).
|
||||
if (result.script_type && result.script_type != p_owner) {
|
||||
result.script_type_ref = Ref<Script>(result.script_type);
|
||||
if (result.script_type && result.script_type == p_owner) {
|
||||
result.script_type_ref = Ref<Script>();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -93,6 +93,7 @@ def configure(env, env_mono):
|
|||
copy_mono_root = env["copy_mono_root"]
|
||||
|
||||
mono_prefix = env["mono_prefix"]
|
||||
mono_bcl = env["mono_bcl"]
|
||||
|
||||
mono_lib_names = ["mono-2.0-sgen", "monosgen-2.0"]
|
||||
|
||||
|
@ -393,7 +394,7 @@ def configure(env, env_mono):
|
|||
|
||||
if tools_enabled:
|
||||
# Only supported for editor builds.
|
||||
copy_mono_root_files(env, mono_root)
|
||||
copy_mono_root_files(env, mono_root, mono_bcl)
|
||||
|
||||
|
||||
def make_template_dir(env, mono_root):
|
||||
|
@ -426,7 +427,7 @@ def make_template_dir(env, mono_root):
|
|||
copy_mono_shared_libs(env, mono_root, template_mono_root_dir)
|
||||
|
||||
|
||||
def copy_mono_root_files(env, mono_root):
|
||||
def copy_mono_root_files(env, mono_root, mono_bcl):
|
||||
from glob import glob
|
||||
from shutil import copy
|
||||
from shutil import rmtree
|
||||
|
@ -451,7 +452,7 @@ def copy_mono_root_files(env, mono_root):
|
|||
|
||||
# Copy framework assemblies
|
||||
|
||||
mono_framework_dir = os.path.join(mono_root, "lib", "mono", "4.5")
|
||||
mono_framework_dir = mono_bcl or os.path.join(mono_root, "lib", "mono", "4.5")
|
||||
mono_framework_facades_dir = os.path.join(mono_framework_dir, "Facades")
|
||||
|
||||
editor_mono_framework_dir = os.path.join(editor_mono_root_dir, "lib", "mono", "4.5")
|
||||
|
|
|
@ -28,6 +28,14 @@ def configure(env):
|
|||
PathVariable.PathAccept,
|
||||
)
|
||||
)
|
||||
envvars.Add(
|
||||
PathVariable(
|
||||
"mono_bcl",
|
||||
"Path to a custom Mono BCL (Base Class Library) directory for the target platform",
|
||||
"",
|
||||
PathVariable.PathAccept,
|
||||
)
|
||||
)
|
||||
envvars.Add(BoolVariable("mono_static", "Statically link Mono", default_mono_static))
|
||||
envvars.Add(BoolVariable("mono_glue", "Build with the Mono glue sources", True))
|
||||
envvars.Add(BoolVariable("build_cil", "Build C# solutions", True))
|
||||
|
|
|
@ -2,6 +2,7 @@ using Godot;
|
|||
using System;
|
||||
using Godot.Collections;
|
||||
using GodotTools.Internals;
|
||||
using JetBrains.Annotations;
|
||||
using File = GodotTools.Utils.File;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
|
@ -26,8 +27,10 @@ namespace GodotTools.Build
|
|||
private TextEdit buildLog;
|
||||
private PopupMenu issuesListContextMenu;
|
||||
|
||||
[Signal]
|
||||
public delegate void BuildStateChanged();
|
||||
private readonly object pendingBuildLogTextLock = new object();
|
||||
[NotNull] private string pendingBuildLogText = string.Empty;
|
||||
|
||||
[Signal] public event Action BuildStateChanged;
|
||||
|
||||
public bool HasBuildExited { get; private set; } = false;
|
||||
|
||||
|
@ -241,16 +244,34 @@ namespace GodotTools.Build
|
|||
EmitSignal(nameof(BuildStateChanged));
|
||||
}
|
||||
|
||||
private void UpdateBuildLogText()
|
||||
{
|
||||
lock (pendingBuildLogTextLock)
|
||||
{
|
||||
buildLog.Text += pendingBuildLogText;
|
||||
pendingBuildLogText = string.Empty;
|
||||
ScrollToLastNonEmptyLogLine();
|
||||
}
|
||||
}
|
||||
|
||||
private void StdOutputReceived(string text)
|
||||
{
|
||||
buildLog.Text += text + "\n";
|
||||
ScrollToLastNonEmptyLogLine();
|
||||
lock (pendingBuildLogTextLock)
|
||||
{
|
||||
if (pendingBuildLogText.Length == 0)
|
||||
CallDeferred(nameof(UpdateBuildLogText));
|
||||
pendingBuildLogText += text + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
private void StdErrorReceived(string text)
|
||||
{
|
||||
buildLog.Text += text + "\n";
|
||||
ScrollToLastNonEmptyLogLine();
|
||||
lock (pendingBuildLogTextLock)
|
||||
{
|
||||
if (pendingBuildLogText.Length == 0)
|
||||
CallDeferred(nameof(UpdateBuildLogText));
|
||||
pendingBuildLogText += text + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
private void ScrollToLastNonEmptyLogLine()
|
||||
|
@ -378,12 +399,14 @@ namespace GodotTools.Build
|
|||
BuildManager.BuildStarted += BuildStarted;
|
||||
BuildManager.BuildFinished += BuildFinished;
|
||||
// StdOutput/Error can be received from different threads, so we need to use CallDeferred
|
||||
BuildManager.StdOutputReceived += line => CallDeferred(nameof(StdOutputReceived), line);
|
||||
BuildManager.StdErrorReceived += line => CallDeferred(nameof(StdErrorReceived), line);
|
||||
BuildManager.StdOutputReceived += StdOutputReceived;
|
||||
BuildManager.StdErrorReceived += StdErrorReceived;
|
||||
}
|
||||
|
||||
public void OnBeforeSerialize()
|
||||
{
|
||||
// In case it didn't update yet. We don't want to have to serialize any pending output.
|
||||
UpdateBuildLogText();
|
||||
}
|
||||
|
||||
public void OnAfterDeserialize()
|
||||
|
|
|
@ -162,13 +162,13 @@ void GDMonoLog::initialize() {
|
|||
OS::Date date_now = OS::get_singleton()->get_date();
|
||||
OS::Time time_now = OS::get_singleton()->get_time();
|
||||
|
||||
String log_file_name = str_format("%d_%02d_%02d %02d.%02d.%02d",
|
||||
String log_file_name = str_format("%04d-%02d-%02d_%02d.%02d.%02d",
|
||||
date_now.year, date_now.month, date_now.day,
|
||||
time_now.hour, time_now.min, time_now.sec);
|
||||
|
||||
log_file_name += str_format(" (%d)", OS::get_singleton()->get_process_id());
|
||||
log_file_name += str_format("_%d", OS::get_singleton()->get_process_id());
|
||||
|
||||
log_file_name += ".txt";
|
||||
log_file_name += ".log";
|
||||
|
||||
log_file_path = logs_dir.plus_file(log_file_name);
|
||||
|
||||
|
|
|
@ -442,6 +442,7 @@ void set_pending_exception(MonoException *p_exc) {
|
|||
#else
|
||||
if (get_runtime_invoke_count() == 0) {
|
||||
debug_unhandled_exception(p_exc);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mono_runtime_set_pending_exception(p_exc, false)) {
|
||||
|
|
|
@ -64,7 +64,7 @@ void OpenSimplexNoise::set_seed(int p_seed) {
|
|||
emit_changed();
|
||||
}
|
||||
|
||||
int OpenSimplexNoise::get_seed() {
|
||||
int OpenSimplexNoise::get_seed() const {
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ void OpenSimplexNoise::set_lacunarity(float p_lacunarity) {
|
|||
emit_changed();
|
||||
}
|
||||
|
||||
Ref<Image> OpenSimplexNoise::get_image(int p_width, int p_height) {
|
||||
Ref<Image> OpenSimplexNoise::get_image(int p_width, int p_height) const {
|
||||
|
||||
PoolVector<uint8_t> data;
|
||||
data.resize(p_width * p_height * 4);
|
||||
|
@ -119,7 +119,7 @@ Ref<Image> OpenSimplexNoise::get_image(int p_width, int p_height) {
|
|||
return image;
|
||||
}
|
||||
|
||||
Ref<Image> OpenSimplexNoise::get_seamless_image(int p_size) {
|
||||
Ref<Image> OpenSimplexNoise::get_seamless_image(int p_size) const {
|
||||
|
||||
PoolVector<uint8_t> data;
|
||||
data.resize(p_size * p_size * 4);
|
||||
|
@ -191,12 +191,12 @@ void OpenSimplexNoise::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "lacunarity", PROPERTY_HINT_RANGE, "0.1,4.0,0.01"), "set_lacunarity", "get_lacunarity");
|
||||
}
|
||||
|
||||
float OpenSimplexNoise::get_noise_1d(float x) {
|
||||
float OpenSimplexNoise::get_noise_1d(float x) const {
|
||||
|
||||
return get_noise_2d(x, 1.0);
|
||||
}
|
||||
|
||||
float OpenSimplexNoise::get_noise_2d(float x, float y) {
|
||||
float OpenSimplexNoise::get_noise_2d(float x, float y) const {
|
||||
|
||||
x /= period;
|
||||
y /= period;
|
||||
|
@ -217,7 +217,7 @@ float OpenSimplexNoise::get_noise_2d(float x, float y) {
|
|||
return sum / max;
|
||||
}
|
||||
|
||||
float OpenSimplexNoise::get_noise_3d(float x, float y, float z) {
|
||||
float OpenSimplexNoise::get_noise_3d(float x, float y, float z) const {
|
||||
|
||||
x /= period;
|
||||
y /= period;
|
||||
|
@ -240,7 +240,7 @@ float OpenSimplexNoise::get_noise_3d(float x, float y, float z) {
|
|||
return sum / max;
|
||||
}
|
||||
|
||||
float OpenSimplexNoise::get_noise_4d(float x, float y, float z, float w) {
|
||||
float OpenSimplexNoise::get_noise_4d(float x, float y, float z, float w) const {
|
||||
|
||||
x /= period;
|
||||
y /= period;
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
void _init_seeds();
|
||||
|
||||
void set_seed(int seed);
|
||||
int get_seed();
|
||||
int get_seed() const;
|
||||
|
||||
void set_octaves(int p_octaves);
|
||||
int get_octaves() const { return octaves; }
|
||||
|
@ -75,22 +75,22 @@ public:
|
|||
void set_lacunarity(float p_lacunarity);
|
||||
float get_lacunarity() const { return lacunarity; }
|
||||
|
||||
Ref<Image> get_image(int p_width, int p_height);
|
||||
Ref<Image> get_seamless_image(int p_size);
|
||||
Ref<Image> get_image(int p_width, int p_height) const;
|
||||
Ref<Image> get_seamless_image(int p_size) const;
|
||||
|
||||
float get_noise_1d(float x);
|
||||
float get_noise_2d(float x, float y);
|
||||
float get_noise_3d(float x, float y, float z);
|
||||
float get_noise_4d(float x, float y, float z, float w);
|
||||
float get_noise_1d(float x) const;
|
||||
float get_noise_2d(float x, float y) const;
|
||||
float get_noise_3d(float x, float y, float z) const;
|
||||
float get_noise_4d(float x, float y, float z, float w) const;
|
||||
|
||||
_FORCE_INLINE_ float _get_octave_noise_2d(int octave, float x, float y) { return open_simplex_noise2(&(contexts[octave]), x, y); }
|
||||
_FORCE_INLINE_ float _get_octave_noise_3d(int octave, float x, float y, float z) { return open_simplex_noise3(&(contexts[octave]), x, y, z); }
|
||||
_FORCE_INLINE_ float _get_octave_noise_4d(int octave, float x, float y, float z, float w) { return open_simplex_noise4(&(contexts[octave]), x, y, z, w); }
|
||||
_FORCE_INLINE_ float _get_octave_noise_2d(int octave, float x, float y) const { return open_simplex_noise2(&(contexts[octave]), x, y); }
|
||||
_FORCE_INLINE_ float _get_octave_noise_3d(int octave, float x, float y, float z) const { return open_simplex_noise3(&(contexts[octave]), x, y, z); }
|
||||
_FORCE_INLINE_ float _get_octave_noise_4d(int octave, float x, float y, float z, float w) const { return open_simplex_noise4(&(contexts[octave]), x, y, z, w); }
|
||||
|
||||
// Convenience
|
||||
|
||||
_FORCE_INLINE_ float get_noise_2dv(Vector2 v) { return get_noise_2d(v.x, v.y); }
|
||||
_FORCE_INLINE_ float get_noise_3dv(Vector3 v) { return get_noise_3d(v.x, v.y, v.z); }
|
||||
_FORCE_INLINE_ float get_noise_2dv(const Vector2 &v) const { return get_noise_2d(v.x, v.y); }
|
||||
_FORCE_INLINE_ float get_noise_3dv(const Vector3 &v) const { return get_noise_3d(v.x, v.y, v.z); }
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
|
|
@ -6,7 +6,6 @@ android_files = [
|
|||
"os_android.cpp",
|
||||
"file_access_android.cpp",
|
||||
"audio_driver_opensl.cpp",
|
||||
"file_access_jandroid.cpp",
|
||||
"dir_access_jandroid.cpp",
|
||||
"thread_jandroid.cpp",
|
||||
"net_socket_android.cpp",
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "dir_access_jandroid.h"
|
||||
#include "core/print_string.h"
|
||||
#include "file_access_jandroid.h"
|
||||
#include "file_access_android.h"
|
||||
#include "string_android.h"
|
||||
#include "thread_jandroid.h"
|
||||
|
||||
|
@ -157,7 +157,7 @@ bool DirAccessJAndroid::file_exists(String p_file) {
|
|||
else
|
||||
sd = current_dir.plus_file(p_file);
|
||||
|
||||
FileAccessJAndroid *f = memnew(FileAccessJAndroid);
|
||||
FileAccessAndroid *f = memnew(FileAccessAndroid);
|
||||
bool exists = f->file_exists(sd);
|
||||
memdelete(f);
|
||||
|
||||
|
|
|
@ -1,212 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* file_access_jandroid.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "file_access_jandroid.h"
|
||||
#include "core/os/os.h"
|
||||
#include "thread_jandroid.h"
|
||||
#include <unistd.h>
|
||||
|
||||
jobject FileAccessJAndroid::io = NULL;
|
||||
jclass FileAccessJAndroid::cls;
|
||||
jmethodID FileAccessJAndroid::_file_open = 0;
|
||||
jmethodID FileAccessJAndroid::_file_get_size = 0;
|
||||
jmethodID FileAccessJAndroid::_file_seek = 0;
|
||||
jmethodID FileAccessJAndroid::_file_read = 0;
|
||||
jmethodID FileAccessJAndroid::_file_tell = 0;
|
||||
jmethodID FileAccessJAndroid::_file_eof = 0;
|
||||
jmethodID FileAccessJAndroid::_file_close = 0;
|
||||
|
||||
FileAccess *FileAccessJAndroid::create_jandroid() {
|
||||
|
||||
return memnew(FileAccessJAndroid);
|
||||
}
|
||||
|
||||
Error FileAccessJAndroid::_open(const String &p_path, int p_mode_flags) {
|
||||
|
||||
if (is_open())
|
||||
close();
|
||||
|
||||
String path = fix_path(p_path).simplify_path();
|
||||
if (path.begins_with("/"))
|
||||
path = path.substr(1, path.length());
|
||||
else if (path.begins_with("res://"))
|
||||
path = path.substr(6, path.length());
|
||||
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
|
||||
jstring js = env->NewStringUTF(path.utf8().get_data());
|
||||
int res = env->CallIntMethod(io, _file_open, js, (p_mode_flags & WRITE) ? true : false);
|
||||
env->DeleteLocalRef(js);
|
||||
|
||||
OS::get_singleton()->print("fopen: '%s' ret %i\n", path.utf8().get_data(), res);
|
||||
|
||||
if (res <= 0)
|
||||
return ERR_FILE_CANT_OPEN;
|
||||
id = res;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void FileAccessJAndroid::close() {
|
||||
|
||||
if (!is_open())
|
||||
return;
|
||||
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
|
||||
env->CallVoidMethod(io, _file_close, id);
|
||||
id = 0;
|
||||
}
|
||||
|
||||
bool FileAccessJAndroid::is_open() const {
|
||||
|
||||
return id != 0;
|
||||
}
|
||||
|
||||
void FileAccessJAndroid::seek(size_t p_position) {
|
||||
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
|
||||
ERR_FAIL_COND_MSG(!is_open(), "File must be opened before use.");
|
||||
env->CallVoidMethod(io, _file_seek, id, p_position);
|
||||
}
|
||||
|
||||
void FileAccessJAndroid::seek_end(int64_t p_position) {
|
||||
|
||||
ERR_FAIL_COND_MSG(!is_open(), "File must be opened before use.");
|
||||
|
||||
seek(get_len());
|
||||
}
|
||||
|
||||
size_t FileAccessJAndroid::get_position() const {
|
||||
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use.");
|
||||
return env->CallIntMethod(io, _file_tell, id);
|
||||
}
|
||||
|
||||
size_t FileAccessJAndroid::get_len() const {
|
||||
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use.");
|
||||
return env->CallIntMethod(io, _file_get_size, id);
|
||||
}
|
||||
|
||||
bool FileAccessJAndroid::eof_reached() const {
|
||||
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use.");
|
||||
return env->CallIntMethod(io, _file_eof, id);
|
||||
}
|
||||
|
||||
uint8_t FileAccessJAndroid::get_8() const {
|
||||
|
||||
ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use.");
|
||||
uint8_t byte;
|
||||
get_buffer(&byte, 1);
|
||||
return byte;
|
||||
}
|
||||
int FileAccessJAndroid::get_buffer(uint8_t *p_dst, int p_length) const {
|
||||
|
||||
ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use.");
|
||||
if (p_length == 0)
|
||||
return 0;
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
|
||||
jbyteArray jca = (jbyteArray)env->CallObjectMethod(io, _file_read, id, p_length);
|
||||
|
||||
int len = env->GetArrayLength(jca);
|
||||
env->GetByteArrayRegion(jca, 0, len, (jbyte *)p_dst);
|
||||
env->DeleteLocalRef((jobject)jca);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
Error FileAccessJAndroid::get_error() const {
|
||||
|
||||
if (eof_reached())
|
||||
return ERR_FILE_EOF;
|
||||
return OK;
|
||||
}
|
||||
|
||||
void FileAccessJAndroid::flush() {
|
||||
}
|
||||
|
||||
void FileAccessJAndroid::store_8(uint8_t p_dest) {
|
||||
}
|
||||
|
||||
bool FileAccessJAndroid::file_exists(const String &p_path) {
|
||||
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
|
||||
String path = fix_path(p_path).simplify_path();
|
||||
if (path.begins_with("/"))
|
||||
path = path.substr(1, path.length());
|
||||
else if (path.begins_with("res://"))
|
||||
path = path.substr(6, path.length());
|
||||
|
||||
jstring js = env->NewStringUTF(path.utf8().get_data());
|
||||
int res = env->CallIntMethod(io, _file_open, js, false);
|
||||
if (res <= 0) {
|
||||
env->DeleteLocalRef(js);
|
||||
return false;
|
||||
}
|
||||
env->CallVoidMethod(io, _file_close, res);
|
||||
env->DeleteLocalRef(js);
|
||||
return true;
|
||||
}
|
||||
|
||||
void FileAccessJAndroid::setup(jobject p_io) {
|
||||
|
||||
io = p_io;
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
|
||||
jclass c = env->GetObjectClass(io);
|
||||
cls = (jclass)env->NewGlobalRef(c);
|
||||
|
||||
_file_open = env->GetMethodID(cls, "file_open", "(Ljava/lang/String;Z)I");
|
||||
_file_get_size = env->GetMethodID(cls, "file_get_size", "(I)I");
|
||||
_file_tell = env->GetMethodID(cls, "file_tell", "(I)I");
|
||||
_file_eof = env->GetMethodID(cls, "file_eof", "(I)Z");
|
||||
_file_seek = env->GetMethodID(cls, "file_seek", "(II)V");
|
||||
_file_read = env->GetMethodID(cls, "file_read", "(II)[B");
|
||||
_file_close = env->GetMethodID(cls, "file_close", "(I)V");
|
||||
}
|
||||
|
||||
FileAccessJAndroid::FileAccessJAndroid() {
|
||||
|
||||
id = 0;
|
||||
}
|
||||
|
||||
FileAccessJAndroid::~FileAccessJAndroid() {
|
||||
|
||||
if (is_open())
|
||||
close();
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* file_access_jandroid.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef FILE_ACCESS_JANDROID_H
|
||||
#define FILE_ACCESS_JANDROID_H
|
||||
|
||||
#include "core/os/file_access.h"
|
||||
#include "java_godot_lib_jni.h"
|
||||
class FileAccessJAndroid : public FileAccess {
|
||||
|
||||
static jobject io;
|
||||
static jclass cls;
|
||||
|
||||
static jmethodID _file_open;
|
||||
static jmethodID _file_get_size;
|
||||
static jmethodID _file_seek;
|
||||
static jmethodID _file_tell;
|
||||
static jmethodID _file_eof;
|
||||
static jmethodID _file_read;
|
||||
static jmethodID _file_close;
|
||||
|
||||
int id;
|
||||
static FileAccess *create_jandroid();
|
||||
|
||||
public:
|
||||
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
||||
virtual void close(); ///< close a file
|
||||
virtual bool is_open() const; ///< true when file is open
|
||||
|
||||
virtual void seek(size_t p_position); ///< seek to a given position
|
||||
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
|
||||
virtual size_t get_position() const; ///< get position in the file
|
||||
virtual size_t get_len() const; ///< get size of the file
|
||||
|
||||
virtual bool eof_reached() const; ///< reading passed EOF
|
||||
|
||||
virtual uint8_t get_8() const; ///< get a byte
|
||||
virtual int get_buffer(uint8_t *p_dst, int p_length) const;
|
||||
|
||||
virtual Error get_error() const; ///< get last error
|
||||
|
||||
virtual void flush();
|
||||
virtual void store_8(uint8_t p_dest); ///< store a byte
|
||||
|
||||
virtual bool file_exists(const String &p_path); ///< return true if a file exists
|
||||
|
||||
static void setup(jobject p_io);
|
||||
|
||||
virtual uint64_t _get_modified_time(const String &p_file) { return 0; }
|
||||
virtual uint32_t _get_unix_permissions(const String &p_file) { return 0; }
|
||||
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions) { return FAILED; }
|
||||
|
||||
FileAccessJAndroid();
|
||||
~FileAccessJAndroid();
|
||||
};
|
||||
|
||||
#endif // FILE_ACCESS_JANDROID_H
|
|
@ -41,7 +41,6 @@
|
|||
#include "core/project_settings.h"
|
||||
#include "dir_access_jandroid.h"
|
||||
#include "file_access_android.h"
|
||||
#include "file_access_jandroid.h"
|
||||
#include "jni_utils.h"
|
||||
#include "main/input_default.h"
|
||||
#include "main/main.h"
|
||||
|
@ -134,14 +133,10 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
|
|||
godot_io_java = new GodotIOJavaWrapper(env, godot_java->get_member_object("io", "Lorg/godotengine/godot/GodotIO;", env));
|
||||
|
||||
ThreadAndroid::make_default(jvm);
|
||||
#ifdef USE_JAVA_FILE_ACCESS
|
||||
FileAccessJAndroid::setup(godot_io_java->get_instance());
|
||||
#else
|
||||
|
||||
jobject amgr = env->NewGlobalRef(p_asset_manager);
|
||||
|
||||
FileAccessAndroid::asset_manager = AAssetManager_fromJava(env, amgr);
|
||||
#endif
|
||||
|
||||
DirAccessJAndroid::setup(godot_io_java->get_instance());
|
||||
AudioDriverAndroid::setup(godot_io_java->get_instance());
|
||||
|
|
|
@ -30,19 +30,17 @@
|
|||
|
||||
#include "os_android.h"
|
||||
|
||||
#include "core/io/file_access_buffered_fa.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "drivers/gles2/rasterizer_gles2.h"
|
||||
#include "drivers/gles3/rasterizer_gles3.h"
|
||||
#include "drivers/unix/dir_access_unix.h"
|
||||
#include "drivers/unix/file_access_unix.h"
|
||||
#include "file_access_android.h"
|
||||
#include "main/main.h"
|
||||
#include "servers/visual/visual_server_raster.h"
|
||||
#include "servers/visual/visual_server_wrap_mt.h"
|
||||
|
||||
#include "dir_access_jandroid.h"
|
||||
#include "file_access_jandroid.h"
|
||||
#include "file_access_android.h"
|
||||
#include "net_socket_android.h"
|
||||
|
||||
#include <android/input.h>
|
||||
|
@ -94,16 +92,10 @@ void OS_Android::initialize_core() {
|
|||
if (use_apk_expansion)
|
||||
FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_RESOURCES);
|
||||
else {
|
||||
#ifdef USE_JAVA_FILE_ACCESS
|
||||
FileAccess::make_default<FileAccessBufferedFA<FileAccessJAndroid> >(FileAccess::ACCESS_RESOURCES);
|
||||
#else
|
||||
//FileAccess::make_default<FileAccessBufferedFA<FileAccessAndroid> >(FileAccess::ACCESS_RESOURCES);
|
||||
FileAccess::make_default<FileAccessAndroid>(FileAccess::ACCESS_RESOURCES);
|
||||
#endif
|
||||
}
|
||||
FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_USERDATA);
|
||||
FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_FILESYSTEM);
|
||||
//FileAccessBufferedFA<FileAccessUnix>::make_default();
|
||||
if (use_apk_expansion)
|
||||
DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_RESOURCES);
|
||||
else
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "os_javascript.h"
|
||||
|
||||
#include "core/io/file_access_buffered_fa.h"
|
||||
#include "core/io/json.h"
|
||||
#include "drivers/gles2/rasterizer_gles2.h"
|
||||
#include "drivers/gles3/rasterizer_gles3.h"
|
||||
|
@ -818,7 +817,6 @@ int OS_JavaScript::get_current_video_driver() const {
|
|||
void OS_JavaScript::initialize_core() {
|
||||
|
||||
OS_Unix::initialize_core();
|
||||
FileAccess::make_default<FileAccessBufferedFA<FileAccessUnix> >(FileAccess::ACCESS_RESOURCES);
|
||||
}
|
||||
|
||||
Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "platform/osx/logo.gen.h"
|
||||
#include "string.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
class EditorExportPlatformOSX : public EditorExportPlatform {
|
||||
|
@ -504,36 +504,36 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
|
|||
else
|
||||
pkg_name = "Unnamed";
|
||||
|
||||
String pkg_name_safe = OS::get_singleton()->get_safe_dir_name(pkg_name);
|
||||
pkg_name = OS::get_singleton()->get_safe_dir_name(pkg_name);
|
||||
|
||||
Error err = OK;
|
||||
String tmp_app_path_name = "";
|
||||
|
||||
DirAccess *tmp_app_path = NULL;
|
||||
String export_format = use_dmg() && p_path.ends_with("dmg") ? "dmg" : "zip";
|
||||
|
||||
// Create our application bundle.
|
||||
tmp_app_path_name = EditorSettings::get_singleton()->get_cache_dir().plus_file(pkg_name + ".app");
|
||||
String tmp_app_dir_name = pkg_name + ".app";
|
||||
String tmp_app_path_name = EditorSettings::get_singleton()->get_cache_dir().plus_file(tmp_app_dir_name);
|
||||
print_line("Exporting to " + tmp_app_path_name);
|
||||
tmp_app_path = DirAccess::create_for_path(tmp_app_path_name);
|
||||
if (!tmp_app_path) {
|
||||
|
||||
Error err = OK;
|
||||
|
||||
DirAccessRef tmp_app_dir = DirAccess::create_for_path(tmp_app_path_name);
|
||||
if (!tmp_app_dir) {
|
||||
err = ERR_CANT_CREATE;
|
||||
}
|
||||
|
||||
// Create our folder structure.
|
||||
if (err == OK) {
|
||||
print_line("Creating " + tmp_app_path_name + "/Contents/MacOS");
|
||||
err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/MacOS");
|
||||
err = tmp_app_dir->make_dir_recursive(tmp_app_path_name + "/Contents/MacOS");
|
||||
}
|
||||
|
||||
if (err == OK) {
|
||||
print_line("Creating " + tmp_app_path_name + "/Contents/Frameworks");
|
||||
err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/Frameworks");
|
||||
err = tmp_app_dir->make_dir_recursive(tmp_app_path_name + "/Contents/Frameworks");
|
||||
}
|
||||
|
||||
if (err == OK) {
|
||||
print_line("Creating " + tmp_app_path_name + "/Contents/Resources");
|
||||
err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/Resources");
|
||||
err = tmp_app_dir->make_dir_recursive(tmp_app_path_name + "/Contents/Resources");
|
||||
}
|
||||
|
||||
// Now process our template.
|
||||
|
@ -610,14 +610,14 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
|
|||
ret = unzGoToNextFile(src_pkg_zip);
|
||||
continue; // skip
|
||||
}
|
||||
file = file.replace("/data.mono.osx.64.release_debug/", "/data_" + pkg_name_safe + "/");
|
||||
file = file.replace("/data.mono.osx.64.release_debug/", "/data_" + pkg_name + "/");
|
||||
}
|
||||
if (file.find("/data.mono.osx.64.release/") != -1) {
|
||||
if (p_debug) {
|
||||
ret = unzGoToNextFile(src_pkg_zip);
|
||||
continue; // skip
|
||||
}
|
||||
file = file.replace("/data.mono.osx.64.release/", "/data_" + pkg_name_safe + "/");
|
||||
file = file.replace("/data.mono.osx.64.release/", "/data_" + pkg_name + "/");
|
||||
}
|
||||
|
||||
print_line("ADDING: " + file + " size: " + itos(data.size()));
|
||||
|
@ -626,7 +626,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
|
|||
// Write it into our application bundle.
|
||||
file = tmp_app_path_name.plus_file(file);
|
||||
if (err == OK) {
|
||||
err = tmp_app_path->make_dir_recursive(file.get_base_dir());
|
||||
err = tmp_app_dir->make_dir_recursive(file.get_base_dir());
|
||||
}
|
||||
if (err == OK) {
|
||||
FileAccess *f = FileAccess::open(file, FileAccess::WRITE);
|
||||
|
@ -721,7 +721,10 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
|
|||
}
|
||||
|
||||
// Clean up temporary .app dir.
|
||||
OS::get_singleton()->move_to_trash(tmp_app_path_name);
|
||||
tmp_app_dir->change_dir(tmp_app_path_name);
|
||||
tmp_app_dir->erase_contents_recursive();
|
||||
tmp_app_dir->change_dir("..");
|
||||
tmp_app_dir->remove(tmp_app_dir_name);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
|
|
@ -70,6 +70,7 @@ def get_opts():
|
|||
BoolVariable("use_mingw", "Use the Mingw compiler, even if MSVC is installed. Only used on Windows.", False),
|
||||
BoolVariable("use_llvm", "Use the LLVM compiler", False),
|
||||
BoolVariable("use_thinlto", "Use ThinLTO", False),
|
||||
BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True),
|
||||
]
|
||||
|
||||
|
||||
|
@ -208,7 +209,11 @@ def configure_msvc(env, manual_msvc_config):
|
|||
|
||||
## Compile/link flags
|
||||
|
||||
env.AppendUnique(CCFLAGS=["/MT", "/Gd", "/GR", "/nologo"])
|
||||
if env["use_static_cpp"]:
|
||||
env.AppendUnique(CCFLAGS=["/MT"])
|
||||
else:
|
||||
env.AppendUnique(CCFLAGS=["/MD"])
|
||||
env.AppendUnique(CCFLAGS=["/Gd", "/GR", "/nologo"])
|
||||
# Force to use Unicode encoding
|
||||
env.AppendUnique(CCFLAGS=["/utf-8"])
|
||||
env.AppendUnique(CXXFLAGS=["/TP"]) # assume all sources are C++
|
||||
|
@ -344,12 +349,14 @@ def configure_mingw(env):
|
|||
mingw_prefix = ""
|
||||
|
||||
if env["bits"] == "32":
|
||||
env.Append(LINKFLAGS=["-static"])
|
||||
env.Append(LINKFLAGS=["-static-libgcc"])
|
||||
env.Append(LINKFLAGS=["-static-libstdc++"])
|
||||
if env["use_static_cpp"]:
|
||||
env.Append(LINKFLAGS=["-static"])
|
||||
env.Append(LINKFLAGS=["-static-libgcc"])
|
||||
env.Append(LINKFLAGS=["-static-libstdc++"])
|
||||
mingw_prefix = env["mingw_prefix_32"]
|
||||
else:
|
||||
env.Append(LINKFLAGS=["-static"])
|
||||
if env["use_static_cpp"]:
|
||||
env.Append(LINKFLAGS=["-static"])
|
||||
mingw_prefix = env["mingw_prefix_64"]
|
||||
|
||||
if env["use_llvm"]:
|
||||
|
|
|
@ -158,7 +158,7 @@ bool JoypadWindows::setup_dinput_joypad(const DIDEVICEINSTANCE *instance) {
|
|||
|
||||
const DWORD devtype = (instance->dwDevType & 0xFF);
|
||||
|
||||
if ((devtype != DI8DEVTYPE_JOYSTICK) && (devtype != DI8DEVTYPE_GAMEPAD) && (devtype != DI8DEVTYPE_1STPERSON)) {
|
||||
if ((devtype != DI8DEVTYPE_JOYSTICK) && (devtype != DI8DEVTYPE_GAMEPAD) && (devtype != DI8DEVTYPE_1STPERSON) && (devtype != DI8DEVTYPE_DRIVING)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -235,7 +235,6 @@ void OS_Windows::initialize_core() {
|
|||
FileAccess::make_default<FileAccessWindows>(FileAccess::ACCESS_RESOURCES);
|
||||
FileAccess::make_default<FileAccessWindows>(FileAccess::ACCESS_USERDATA);
|
||||
FileAccess::make_default<FileAccessWindows>(FileAccess::ACCESS_FILESYSTEM);
|
||||
//FileAccessBufferedFA<FileAccessWindows>::make_default();
|
||||
DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_RESOURCES);
|
||||
DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_USERDATA);
|
||||
DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_FILESYSTEM);
|
||||
|
|
|
@ -423,7 +423,7 @@ void ScrollContainer::update_scrollbars() {
|
|||
|
||||
v_scroll->set_max(min.height);
|
||||
if (hide_scroll_v) {
|
||||
|
||||
v_scroll->set_page(size.height);
|
||||
v_scroll->hide();
|
||||
scroll.y = 0;
|
||||
} else {
|
||||
|
@ -440,7 +440,7 @@ void ScrollContainer::update_scrollbars() {
|
|||
|
||||
h_scroll->set_max(min.width);
|
||||
if (hide_scroll_h) {
|
||||
|
||||
h_scroll->set_page(size.width);
|
||||
h_scroll->hide();
|
||||
scroll.x = 0;
|
||||
} else {
|
||||
|
|
2
thirdparty/README.md
vendored
2
thirdparty/README.md
vendored
|
@ -314,7 +314,7 @@ Collection of single-file libraries used in Godot components.
|
|||
* License: Apache 2.0
|
||||
- `open-simplex-noise.{c,h}`
|
||||
* Upstream: https://github.com/smcameron/open-simplex-noise-in-c
|
||||
* Version: git (0fef0dbedd76f767da7e3c894822729d0f07e54d, 2020) + custom changes
|
||||
* Version: git (826f1dd1724e6fb3ff45f58e48c0fbae864c3403, 2020) + custom changes
|
||||
* License: Unlicense
|
||||
- `pcg.{cpp,h}`
|
||||
* Upstream: http://www.pcg-random.org
|
||||
|
|
20
thirdparty/misc/open-simplex-noise.c
vendored
20
thirdparty/misc/open-simplex-noise.c
vendored
|
@ -100,27 +100,27 @@ static const signed char gradients4D[] = {
|
|||
-3, -1, -1, -1, -1, -3, -1, -1, -1, -1, -3, -1, -1, -1, -1, -3,
|
||||
};
|
||||
|
||||
static double extrapolate2(struct osn_context *ctx, int xsb, int ysb, double dx, double dy)
|
||||
static double extrapolate2(const struct osn_context *ctx, int xsb, int ysb, double dx, double dy)
|
||||
{
|
||||
int16_t *perm = ctx->perm;
|
||||
const int16_t *perm = ctx->perm;
|
||||
int index = perm[(perm[xsb & 0xFF] + ysb) & 0xFF] & 0x0E;
|
||||
return gradients2D[index] * dx
|
||||
+ gradients2D[index + 1] * dy;
|
||||
}
|
||||
|
||||
static double extrapolate3(struct osn_context *ctx, int xsb, int ysb, int zsb, double dx, double dy, double dz)
|
||||
static double extrapolate3(const struct osn_context *ctx, int xsb, int ysb, int zsb, double dx, double dy, double dz)
|
||||
{
|
||||
int16_t *perm = ctx->perm;
|
||||
int16_t *permGradIndex3D = ctx->permGradIndex3D;
|
||||
const int16_t *perm = ctx->perm;
|
||||
const int16_t *permGradIndex3D = ctx->permGradIndex3D;
|
||||
int index = permGradIndex3D[(perm[(perm[xsb & 0xFF] + ysb) & 0xFF] + zsb) & 0xFF];
|
||||
return gradients3D[index] * dx
|
||||
+ gradients3D[index + 1] * dy
|
||||
+ gradients3D[index + 2] * dz;
|
||||
}
|
||||
|
||||
static double extrapolate4(struct osn_context *ctx, int xsb, int ysb, int zsb, int wsb, double dx, double dy, double dz, double dw)
|
||||
static double extrapolate4(const struct osn_context *ctx, int xsb, int ysb, int zsb, int wsb, double dx, double dy, double dz, double dw)
|
||||
{
|
||||
int16_t *perm = ctx->perm;
|
||||
const int16_t *perm = ctx->perm;
|
||||
int index = perm[(perm[(perm[(perm[xsb & 0xFF] + ysb) & 0xFF] + zsb) & 0xFF] + wsb) & 0xFF] & 0xFC;
|
||||
return gradients4D[index] * dx
|
||||
+ gradients4D[index + 1] * dy
|
||||
|
@ -227,7 +227,7 @@ void open_simplex_noise_free(struct osn_context *ctx)
|
|||
// -- GODOT end --
|
||||
|
||||
/* 2D OpenSimplex (Simplectic) Noise. */
|
||||
double open_simplex_noise2(struct osn_context *ctx, double x, double y)
|
||||
double open_simplex_noise2(const struct osn_context *ctx, double x, double y)
|
||||
{
|
||||
|
||||
/* Place input coordinates onto grid. */
|
||||
|
@ -355,7 +355,7 @@ double open_simplex_noise2(struct osn_context *ctx, double x, double y)
|
|||
/*
|
||||
* 3D OpenSimplex (Simplectic) Noise
|
||||
*/
|
||||
double open_simplex_noise3(struct osn_context *ctx, double x, double y, double z)
|
||||
double open_simplex_noise3(const struct osn_context *ctx, double x, double y, double z)
|
||||
{
|
||||
|
||||
/* Place input coordinates on simplectic honeycomb. */
|
||||
|
@ -928,7 +928,7 @@ double open_simplex_noise3(struct osn_context *ctx, double x, double y, double z
|
|||
/*
|
||||
* 4D OpenSimplex (Simplectic) Noise.
|
||||
*/
|
||||
double open_simplex_noise4(struct osn_context *ctx, double x, double y, double z, double w)
|
||||
double open_simplex_noise4(const struct osn_context *ctx, double x, double y, double z, double w)
|
||||
{
|
||||
double uins;
|
||||
double dx1, dy1, dz1, dw1;
|
||||
|
|
6
thirdparty/misc/open-simplex-noise.h
vendored
6
thirdparty/misc/open-simplex-noise.h
vendored
|
@ -47,9 +47,9 @@ int open_simplex_noise(int64_t seed, struct osn_context *ctx);
|
|||
//int open_simplex_noise_init_perm(struct osn_context *ctx, int16_t p[], int nelements);
|
||||
// -- GODOT end --
|
||||
void open_simplex_noise_free(struct osn_context *ctx);
|
||||
double open_simplex_noise2(struct osn_context *ctx, double x, double y);
|
||||
double open_simplex_noise3(struct osn_context *ctx, double x, double y, double z);
|
||||
double open_simplex_noise4(struct osn_context *ctx, double x, double y, double z, double w);
|
||||
double open_simplex_noise2(const struct osn_context *ctx, double x, double y);
|
||||
double open_simplex_noise3(const struct osn_context *ctx, double x, double y, double z);
|
||||
double open_simplex_noise4(const struct osn_context *ctx, double x, double y, double z, double w);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue