diff --git a/3D_Model_Input/.gitignore b/3D_Model_Input/.gitignore deleted file mode 100644 index 3d37a1f..0000000 --- a/3D_Model_Input/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# This directory is intentionarly ignored - this file only applies to the git repo -* -*/ -!.gitignore \ No newline at end of file diff --git a/3D_Model_Output/.gitignore b/3D_Model_Output/.gitignore deleted file mode 100644 index 3d37a1f..0000000 --- a/3D_Model_Output/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# This directory is intentionarly ignored - this file only applies to the git repo -* -*/ -!.gitignore \ No newline at end of file diff --git a/Batch_Json_files/.gitignore b/Batch_Json_files/.gitignore deleted file mode 100644 index 3d37a1f..0000000 --- a/Batch_Json_files/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# This directory is intentionarly ignored - this file only applies to the git repo -* -*/ -!.gitignore \ No newline at end of file diff --git a/Cozy_Robot_Example.blend b/Cozy_Robot_Example.blend deleted file mode 100644 index 00dd074..0000000 Binary files a/Cozy_Robot_Example.blend and /dev/null differ diff --git a/LICENSE b/LICENSE deleted file mode 100644 index f288702..0000000 --- a/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/NFT_Output/.gitignore b/NFT_Output/.gitignore deleted file mode 100644 index 3d37a1f..0000000 --- a/NFT_Output/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# This directory is intentionarly ignored - this file only applies to the git repo -* -*/ -!.gitignore \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index e029b25..0000000 --- a/README.md +++ /dev/null @@ -1,525 +0,0 @@ - -

- -

- -# Blend_My_NFTs - -## Description -Blend_My_NFTs is an open source, free to use Blender add on that enables you to automatically generate thousands of 3D Models, Animations, and Images. This add on's primary purpose is to aid in the creation of large generative 3D NFT collections. - -For support, help, and questions, please join our Discord where our wonderful community can help you: https://discord.gg/UpZt5Un57t - -This add on was origninal developed to create the NFT project This Cozy Place which is now availabe to mint on our website: https://thiscozystudio.com/ - - - -https://user-images.githubusercontent.com/82110564/147833465-965be08b-ca5f-47ba-a159-b92ff775ee14.mov - -The video above illustrates the first 10 Cozy Place NFTs generated with Blend_My_NFts. - - -## Features -- Generate thousands of NFT 3D Models, Animations, and Images in Blender using 3D art. -- Support for Windows, Linux, and Mac OS. -- Weight and Raritize your NFT collection by setting weighted values. -- Creates Meta Data templates for each NFT making uploading to IPFS and Blockchains easy. - - -## Official Links: - -Website: https://thiscozystudio.com/ - -Discord: https://discord.gg/UpZt5Un57t - -Youtube: https://www.youtube.com/channel/UCARiKfuoSghM6DeieqWylYQ - -Twitter: https://twitter.com/CozyPlaceNFT - -Instagram: https://www.instagram.com/this_cozy_place/ - -Reddit: https://www.reddit.com/r/ThisCozyPlace/ - - -## Case Studies -This document has a list of projects that use Blend_My_NFTs to help facilitate them in the creation of their collection: -https://docs.google.com/document/d/e/2PACX-1vSHZS4GRu8xXDYpVPEaxyBeTzms9yrJEC9IoAcP38_U8x0C1kVrbtNZgh0zUmkzBoZQVwNvBf3ldRij/pub - - -## Other languages - -Spanish 🇪🇸 - https://docs.google.com/document/d/e/2PACX-1vTOjtAuI9coQHC7ubf05f6NOlr921dQFmTVO0P9JZ7b6HxdMFVL4bvYPnY3pl1gPLLTZ15oYv6bMWkL/pub - - -# Blend_My_NFTs Tutorial Guide - -Blend_My_NFTs, this readme tutorial material, the youtube tutorials, the live stream Q/As, and tutorials are all provided for free by me for anyone to access/use any way they like. I only ask in return that you credit this software if you use Blend_My_NFTs to launch an NFT collection and kindly share what I have built here. A direct link to the Blend_My_NFTs Github page on your collection website (or equivelant) would sefice. I ask you of this only to share this tool and what it can do as I feel there are many out there that would benefit from it, my only goal is to help those that need it. It brings warmth to my heart that so many people use what I have built. Thank you. - -The software in its current state is not farily user friendly but with a really basic understanding of programing you can opporate it with ease. You can learn the programing skills needed in ten minutes! :) - -Blend_My_NFTs works with Blender 3.0.0 on Windows 10 or macOS Big Sur 11.6. - -## Youtube Tutorial Series - -Link to the newest Blend_My_NFTs tutorial video: https://www.youtube.com/watch?v=0T_PWVUIH5M - -Note - Though this video series may be helpful, it might not be up to date with the current Blend_My_NFTs release. This document has more detailes and may have newer information. If you have no experience with the Blender API I recomend watch this tutorial on running python scripts in Blender: https://www.youtube.com/watch?v=cyt0O7saU4Q - - -## Important Terminology - -Before we can continue there are terms that are used to describe the process of this software to make it a bit easier to understand. Refer to this section if you come accross an unfamiliar term. - -For the following terms, lets say you are creating an NFT collection where the image is of a person wearing a hat: - -``Attribute`` A part of an NFT that can be changed. The hat on a man is an Attribute, there are many types of hats, but the hat itself I will refer to it as an attribute. - -``Variants`` These are the types of hats; red hat, blue hat, green hat, cat hat, etc. These can be swapped into the hat Attribute with one another to create different NFTs. - -``DNA`` DNA is a sequence of numbers that determins what Variant from every Attribute in an NFT collection to include in a single NFT image. This program generates a uniqe DNA sequence for every possible combination of Variants in Attributes. - -``Batch`` A Batch is a randomly selected subset of NFT DNA. It is a smaller portion of the total number of NFTs you want to generate. This makes the work load of rendering thousands of images easier to manage. It also gives you the option to render on multiple computers and ensures each computer renders seperate images with no overlap. - -# Installation and Getting Started - -This youtube tutorial goes over the basic setup discussed in this section: https://www.youtube.com/watch?v=dUajXAZzSPc (This video is out of date but goes over how to run scripts in Blender which is important to running Blend_My_NFTs) - -Follow these steps to setup Blend_My_NFTs: - -1. At the top of this page click the green "Code" button -2. Click "Download Zip" - This will download the Blend_My_NFTs folder to your Downloads folder in zip format -3. In your download folder, move Blend_My_NFTs-main.zip to your desktop or another easily accessable location -4. Unzip the file: -- How to unzip a file on Mac: https://support.apple.com/en-ca/guide/mac-help/mchlp2528/mac -- How to unzip a file on Windows: https://support.microsoft.com/en-us/windows/zip-and-unzip-files-f6dde0a7-0fec-8294-e1d3-703ed85e7ebc -5. Move the Blend_My_NFTs-main folder is located on your Desktop for easy access (recomended) - -## How to set up your .Blend file - -The following section covers how to set up your .Blend file and config.py file - -In order for Blend_My_NFTs to read your .blend file, you need to structure your scene in a specific way. Please follow all naming and collection conventions exactly, otherwise the scripts will not run properly. - -**Important Note** - -Your .blend file must be moved to the Blend_My_NFTs folder. When you run the script, the .blend file must be in the directory of the Blend_My_NFTs folder. The Blender text editor has some weird quirks that make finding the right directory a bit tricky. If you are interested, I suggest reading about it in the Blender API above. This is the only work around I could find for now. - -Rules for .blend structure: - -- All Objects, collections, light sources, cameras, or anything else you want to stay constant for each NFT insert it into a collection named "Script_Ignore" exactly. This collection should be located directly beneath the 'Scene Collection' in your .blend file. Every thing in this Script_Ignore collection will be ignored by the collection (Attribute) fetcher. The state of the render and viewport camera of any objects/collections in Script_Ignore will remain unchanged during the scripts operation. The script will not turn the cameras of anything located in Script_Ignore on or off, so however you set them, will be how it renders. - -- Every Attribute of your NFT must be represented by a collection directly beneath the 'Scene Collection' in your .blend file. DO NOT USE NUMBERS OR UNDERSCORES IN THE NAME OF THESE COLLECTIONS, this will mess with the scripts. Only use capital letters and lowercase letters, no numbers(0-9) or the underscore symbol( _ ). - -- For each Variant of each Attribute create a collection containing everything that makes up that Variant. This Variant collection must be placed within the Attribute collection and named with the following format: VariantName_(variant number begining at 1)_0 (e.g. Cube_1_0, Cube_2_0, etc.). The VariantName CANNOT CONTAIN NUMBERS OR UNDERSCORES. Like above, this will mess with the scripts. - -Here is an example of proper scene and collection formating with the above conventions: - -Screen Shot 2021-11-22 at 7 24 00 PM - -In this example ``Camera`` ``and Const Collection 1`` is in ``Script_Ignore`` and will be displayed in every NFT generated. The collection ``Cube`` represents an attribute, and the collections ``Cube_1_33``, ``Cube_2_33``, ``Cube_3_33``, and ``Cube_4_1`` are the variants of that attribute. Notice that each variant of Cube has an incrementing number representing the order of the variants. The numbers ``33``, ``33``, ``33``, and ``1`` represent the percentage chance that variant will get chosen if ``enableRarity`` is set to ``True``. - -## Customizing the config.py file - -After installation, open the Blend_My_NFTs folder. You will need to change variables in the config.py file with a text editor or IDE; I recomend Visual Studio Code, but Blender has a bilt in Text Editor for ease of use. config.py is where you can customize aspects of your NFT collection and how it is generated. - -Description of customisable variables to generate images: - -``nftName`` - A string representing name of the file exported by Blend_My_NFTs (REQUIRED) - - -``imageFileFormat`` - A string representing the image file format that Blend_My_NFTs will export generated images as: (REQUIRED) - - Type the exact name provided below in the '' for the imageFileFormat: - - 'JPEG' - Exports the .jpeg format - - 'PNG' - Exports the .png format - - Visit https://docs.blender.org/api/current/bpy.types.Image.html#bpy.types.Image.file_format for a complete list of file formats supported by Blender. Enter the file extension exactly as specified in the Blender API documentation. - -``animationFileFormat`` - A string representing the animations file format that Blend_My_NFTs will export generated animations as: (REQUIRED) - - Type the exact name provided below in the '' above: - - AVI_JPEG - Exports the .avi jpeg format - - AVI_RAW - Exports the .avi raw format - - FFMPEG - Exports the .ffmpeg format - - Visit https://docs.blender.org/api/current/bpy.types.Image.html#bpy.types.Image.file_format for a complete list of file formats supported by Blender. (These are the Blender only supported animation formats). - -``modelFileFormat`` - A string representing the 3D Models file format that Blend_My_NFTs will export generated 3D Modles as: (REQUIRED) - - Type the exact name provided below in the '' above: - - fbx - The .FBX file format - - glb - The .glb file format - - obj - The .obj file format *Exports both a .obj and a .mtl files for the same generated object - - x3d - The .x3d file format - - Visit https://docs.blender.org/api/current/bpy.ops.export_scene.html?highlight=export_scene#module-bpy.ops.export_scene - for a complete list of object formats supported by Blender. - - -``save_path_mac`` - A string representing the save path for Blend_My_NFTs if you are using MacOS: (REQUIRED - if using MacOS) - - Example Mac: /Users/Path/to/Blend_My_NFTs - - -``save_path_windows`` - A string representing the save path for Blend_My_NFTs if you are using Windows: (REQUIRED - if using Windows) - - Example Windows: C:\Users\Path\to\Blend_My_NFTs - - -``save_path_linux`` - A string representing the save path for Blend_My_NFTs if you are using Linux OS (REQUIRED - if using Linux) - Example Linux: /home/Path/to/Blend_My_NFTs - - -``maxNFTs`` - A positive integer representeing the number of NFTs to generate. (REQUIRED) - - -``nftsPerBatch`` - A positive integer representing the number of NFTs per batch. (REQUIRED) - - -``renderBatch`` - A positive integer representing the batch number to render if ``renderImage`` is set to True. (REQUIRED) - - -``enableRarity`` - A boolean value, when set to True, rarity percentage will be taken into account when generating NFT DNA and exporting to NFTRecord.json - - -``enableExporter`` - A Boolean value, when set to True, will export Images and or 3D models when main.py is run in Blender. (Turned on after NFTRecord.json and appropriate batches are generated with main.py) - - -``enableImages`` - A boolean value, when set to True with ``enableExporter = True`` will export images. - - -``enableAnimations`` - A boolean value, when set to True with ``enableExporter = True`` will export animations. - - -``enableModelsBlender`` - A boolean value, when set to True with ``enableExporter = True`` will export 3D models. - - -- Note that ``enableImages``, ``enableModelsBlender``, and ``enableAnimations`` can run at the same time. Both 3D Models, Animations, and Images will be exported. (One of the above is REQUIRED to generate NFT files) - - -``refactorBatchOrder`` - A boolean value, when set to True will combine NFT Batch# folders into a folder called ``Complete_Collection`` when main.py is run in Blender. Running main.py with this variable set to True will aslo generate meta data formats if the desired formats below are also set to True. - - -``cardanoMetaData`` - A boolean value, when set to True will generate a folder containing Cardano meta data json files for each NFT file. Generates when main.py is run with ``refactorBatchOrder`` is set to True. - - -``solanaMetaData`` - A boolean value, when set to True will generate a folder containing Solana meta data json files for each NFT file. Generates when main.py is run with ``refactorBatchOrder`` is set to True. - - -``erc721MetaData`` - A boolean value, when set to True will generate a folder containing ERC721 (Ethereum) meta data json files for each NFT file. Generates when main.py is run with ``refactorBatchOrder`` is set to True. - - -``turnNumsOff`` - A boolean value, when set to True will remove numbers and underscores in the names of Variants when NFT meta data is generated. Works after ``refactorBatchOrder`` is ran in main.py. - - -``metaDataDescription`` - A string value, sets the Description variable in the BMNFTs meta data file format. Can be used in a modifed version of metaData.py to fill in Description varaibles in other meta data formats. - - -``enableGeneration`` - A boolean value, when set to True, applies and takes into account colour or material variants in the NFT DNA. (Optional) - - -``generationType`` - A string value, takes ``color`` or ``material`` as input. Determines if extra variatns are generated with colours or material textures. (Optional) - - -``rgbaColorList#`` - A list containing tuples representing the RGBA colour values assigned to a given object in ``colorList``. (Optional) - - -``materialList#`` - A list containing strings representing the names of materials in blender: (Optional) - - These materials must be in your Current Files' Materials. Make sure that you've set your materials as "fake user". The collections below are Current Files' Materials. You can put as many or as little materials values in these lists as you would like. You can create any number of materialLists and assign them to any number of collections that you would like. Each set of materialLists assigned to an object by collection name in the materialList will act like an attribute and create a unique variant of that item. - - -``colorList`` - A dictionary which the keys are the names of variants, and the items are the ``rgbaColorList#`` or ``materialList#``: (Optional) - - The rgbaColorList# deterimnes the colours that the variants will change to. This creates new variants with those RGBA colour values. - - -``enableResetViewport`` - A boolean value, when set to True, resets the veiwport of all cameras not in Script_Ignore. (Optional) - -``enable3DModels`` - A boolean value, when set to True, will generate all possible combinations of 3D models when working with an external repository of 3D models in ``3D_Model_Input``. - -``runPreview`` - A boolean value, when set to True, will run a shell of all main modules to generate NFT files. Will print useful numbers and values in the console to help you create your NFT collection. - - -``maxNFTsTest`` - A positive integer representing the number of NFTs to create during the test. This number aids in the estimation of complete collection creation; the higher this number, the more accurate the estimation. - - -``checkDups`` - A boolean value, when set to True, will print the number of duplicate NFTs found in the NFTRecord.json file. This file is provided for transparency, it is impossible for duplicates to be made with the current code in the DNA_Generator.py - - -``checkRarity`` - A boolean value, when set to True, will print the true rarity data in the Blender System Console, this data will be saved to a RarityData.json file in the Blend_My_NFTs folder. This file is provided for transparency. The accuracy of the rarity values you set in your .blend file as outlined in the below are dependent on the maxNFTs, and the maximum number of combinations of your NFT collection. - - -## Running main.py - Generating NFTRecord and Batches - -Before you can render iamges you need to generate a list of NFT DNA then split it up into batches to render more easily. These will take the form of the NFTRecord.json file, and a list of Batch#.json files. - -``NFTRecord.json`` - This file contains a list of all NFT DNA, this list is limited by ``nftMax`` in config.py. - -``Batch#.json`` - These files contain peices of NFTRecord.json selected at random and sent to a batch containing ``nftsPerBatch`` number of DNA. - -Before running main.py, ensure these variables are set properly or else the script will not work: - -- ``nftName`` -- ``save_path_mac`` or ``save_path_windows`` -- ``maxNFTs`` -- ``nftsPerBatch`` -- ``enableExporter = False`` - -Steps to generate NFTRecord and Batches: - -1. In your .blend file open the ``Scripting Tab`` in the menu of Blender: - -Screen Shot 2021-10-24 at 9 51 25 PM - -2. Click the "Open" button in the Blender Text Editor: - -Screen Shot 2021-10-29 at 11 31 38 PM - -3. With the Blender File View open, navigate to the Blend_My_NFTs folder, navigate to the ``src`` folder, then open main.py. - -Screen Shot 2021-11-23 at 8 09 23 PM - -5. To run main.py click the run button shown circled below: - -Screen Shot 2021-11-23 at 8 12 10 PM - -If you correctly formated your .blend file, you will now have two file types; an NFTRecord.json, and a number of Batch#.json files located in the ``Batch_Json_files`` folder. - -## Running main.py - Generating Image Batches - -**For this section, ensure you have generated NFTRecord.json and Batch#.json files before taking the following steps** - -Steps to Generate Images: - -1. Ensure all manditory variables have been filed in (all found in config.py): -- ``nftName`` -- ``save_path_mac`` or ``save_path_windows`` -- ``maxNFTs`` -- ``nftsPerBatch`` -- ``renderBatch`` - -2. Run main.py in Blender with ``enableExporter`` set to ``False`` in config.py. This will generate the NFTRecord.json and Batch#.json files. - -3. Set ``renderBatch`` to the batch number you wish to render in config.py. - -4. Set ``enableExporter`` to ``True`` in config.py. - -5. Set ``enableImages`` to ``True`` in config.py. - -6. Run main.py in the Blender Scripting Tab. This will now generate Images. - -Screen Shot 2021-11-23 at 8 12 10 PM - -Reapeat the steps above for each Batch to generate the complete NFT collection. - -## Summery: The order to run main.py to Generate Image Batches - -Run the scripts in the following order: -1. main.py - With ``renderImage`` set to ``False`` in the config.py: Generates the data for your NFT collection. -2. main.py - With ``renderImage`` set to ``True`` in the config.py: Renders images in a batch specified by ``renderBatch``. - -## Running main.py - Generating Animation Batches - -Steps to Generate Animations: - -1. Ensure all manditory variables have been filed in (all found in config.py): -- ``nftName`` -- ``save_path_mac`` or ``save_path_windows`` -- ``maxNFTs`` -- ``nftsPerBatch`` -- ``renderBatch`` - -2. Run main.py in Blender with ``enableExporter`` set to ``False``. This will generate the NFTRecord.json and Batch#.json files. - -3. Set ``animationFileFormat`` to the animation file format you wish to export in config.py. - -4. Set ``enableAnimations`` to ``True`` in config.py. - -5. Set ``enableExporter`` to ``True`` in config.py. - -6. Run main.py in the Blender Scripting Tab. This will now generate Animations. - -Screen Shot 2021-11-23 at 8 12 10 PM - -Reapeat the steps above for each Batch to generate the complete NFT collection. - -## Summery: The order to run main.py to Generate Animation Batches - -Run the scripts in the following order: -1. main.py - With ``enableExporter`` set to ``False`` in config.py: Generates the data for your NFT collection. -2. main.py - With ``enableExporter`` and ``enableAnimations`` set to ``True`` in config.py: Renders and compiles animations. - -## Running main.py - Generating 3D Model Batches from a .blend file - -Youtube tutorial for generating 3D models: https://www.youtube.com/watch?v=rRs0lN5huDk&t=1s - -Steps to Generate 3D models: - -1. Ensure all manditory variables have been filed in (all found in config.py): -- ``nftName`` -- ``save_path_mac`` or ``save_path_windows`` -- ``maxNFTs`` -- ``nftsPerBatch`` -- ``renderBatch`` - -2. Run main.py in Blender with ``enableExporter`` set to ``False``. This will generate the NFTRecord.json and Batch#.json files. - -3. Set ``modelFileFormat`` to the 3D Model file format you wish to export in config.py. - -4. Set ``enableModelsBlender`` to ``True`` in config.py. - -5. Set ``enableExporter`` to ``True`` in config.py. - -6. Run main.py in the Blender Scripting Tab. This will now generate 3D Models. - -Screen Shot 2021-11-23 at 8 12 10 PM - -## Summary: The order to run main.py to Generate 3D Model Batches: - -run the scripts in the following order: -1. main.py - With ``enableExporter`` set to ``False`` in config.py: Generates the data for your NFT collection. -2. main.py - With ``enableExporter`` and ``enableModelsBlender`` set to ``True`` in config.py: Exports 3D models. - -# Generating 3D Models with external 3D Models - -This youtube tutorial goes over the basic setup discussed in this section: https://www.youtube.com/watch?v=NonORFpVhLw (This video is out of date but may be of use) - -The following section covers generating and exporting 3D models with Blend_My_NFTs with a repository of external 3D models in a folder structure. The 3D model generator combines 3D models together and exports all possible combinations of those 3D models to a folder. - -## How to set up your 3D model folders - -Similarly to the Image Generator, there is a specific way to format 3d model repositors external to Blender. - -1. In the following photo we have a folder structure. In this example, ``Sphere`` and ``Cube`` are our attributes. Any object file in the ``Script_Ignore_Folder`` will be added to all NFT 3D models generated, and such is an appropriate place to put constant scene elements you wish to appear in every NFT you generate. - -Screen Shot 2021-11-09 at 8 55 34 PM - -2. After you have formated the repository of 3D models to the above convention, copy and past it into the 3D_Model_Input folder located in Blend_My_NFTs: - -Screen Shot 2021-11-09 at 8 59 06 PM - -3. Next open config.py and change the variable ``use3DModels = False`` to ``use3DModels = True`` - -Screen Shot 2021-11-09 at 9 02 05 PM - -4. In Blender open a new blend file and delete everything from the scene. - -5. Save the .blend file to the Blend_My_NFTs folder and reload the .blend file from the new directory. - -7. Run main.py in the Blender Scripting Tab - -The generated 3D models will appear in the folder 3D_Model_Output - -## How to use Rarity - -Rarity is a percentage value and accepts fractions like 0.001%, but they must be specified with decimals in the naming (fraction like 1/2 or 3/5 are not permitted in the naming structure). For ease of use the percentages should add up to 100%: - -``` -33% + 33% + 33% + 1% = 100% - -Variant 1 = 33% chance -Variant 2 = 33% chance -Variant 3 = 33% chance -Variant 4 = 1% chance -``` - -If you have 20 variants with 50 set as the rarity percentage for each, Blend_My_NFTs will add up the percentages then treat the sum as 100%: - -``` -50% + 50% + 50% + 50% + 50%.... -= 1,000% - -Out of 100%: - -(50/1,000)*100 = 5% chance of 1 variant -``` - -Rarity is dependent on both the number of NFTs you generate, as well as the maximum number of possible combinations of the attributes in your .blend file. - -This means the following two scenarios, say, at a fixed number of 10,000 NFTs to generate; - -1. Your .blend file has 1,000,000,000 possible combinations (trust me that's a small number, our collection for This Cozy Place has over 11 Trillion possible combinations). Generating 10,000 will be more representative of the rarity numbers you set as the script will simply have more combinations to choose from. - -2. Your .blend file has 10,000 possible combinations. This means that all possible combinations of your NFT will be generated, meaning that no rarity can be taken into account since the only way to reach your required 10,000 NFTs to generate is by including NFTs that - -This is the result for following reasons: - -1. The rarity is determined sudo randomly by, but is weighted based on each variants rarity percentage. - -2. The script prioritises the number of NFTs to generate (that you set in config.py with the maxNFTs variable) over rarity percentage - -This behaviour is a fundamental mathematical result, not an issue with the code. I've researched various ways at creating and enforcing rarity, this is the only way I have found that works. If you have found a better method, feel free to make a pull request and I'd be happy to review and merge it to the main Github repo for BMNFTs. - -.blend file examples: - -1. With Rarity percentage (50% 50% split) -``` - Hat <-- Attribute - |-Green Hat_1_50 - |-Red Hat_2_50 -``` - -2. Since it's 50/50 it can also be expressed like this: -``` - Hat <-- Attribute - |-Green Hat_1_0 - |-Red Hat_2_0 -``` - -Leaving the rarity number as 0 will randomly select 1 of the variants you set in your .blend file. Note that this only works if every variant's rarity is set to 0. For an attribute its rarity or random, not both. You can have different attributes, where some are using rarity and others are randomly selected, but you cannot mix these with variants. - -Example of more complex rarity structures: - -``` - Hat <-- Attribute - |-Green Hat_1_24.75 - |-Red Hat_2_24.75 - |-Blue Hat_2_24.75 - |-Orange Hat_2_24.57 - |-Purple Hat_2_0.5 - |-Yellow Hat_2_0.5 -``` - -In the example above, Green, Red, Blue, and Orange hats all have an equal chance of getting selected. However Purple and Yellow hats will only appear on average 0.5% of the time. We recommend rounding to about 5 decimal places for simplicity, as numbers of more accuracy aren't really needed for NFT collections 10,000 or smaller. - -The code for that determines rarity can be found in ``src/Main_Generators/Rarity_Sorter.py``. The most important line in that file is ``70``, that is what generates the randomly weighted DNA. After that it is checked by line - -## Helpful Links - -This Blender add on heaviliy relies on the Blender API and its documentation which you can find here: https://docs.blender.org/api/current/index.html - -If you have no experience with the Blender API I recomend watch this tutorial on running python scripts in Blender: https://www.youtube.com/watch?v=cyt0O7saU4Q - -There is also helpful documentation in the Blender API about running scripts here: https://docs.blender.org/api/current/info_quickstart.html#running-scripts - -Note - You might want to install the Icon Viewer add-on for Blender: https://docs.blender.org/manual/en/latest/addons/development/icon_viewer.html - -## Disclaimers - -Blend_My_NFTs works with Windows 10 or macOS BigSure 11.6 on Blender 3.0.0. These are the operating systems I have tested the scripts on, I do not garuntee they will work on other operating systems. I do not garuntee this software will work with your setup. There are many variables and factors that go into running the software provided, it differs from system to system, and from blend file to blend file. - -I encourage you to do some trouble shooting, read the Blender API documentation, read this tutorial, review the scripts, and do your own research before reaching out for help on our discord. If you are really stuck and are out of options I am available on our disord channel above for consulting. However! I am not a toutor. Although I enjoy teaching people, I simply do not have the time to work, build this project, teach people Blender/Python, and live my life. So please respect my time, I'd love to help! - -To be honest I have no idea how to use Blender. I know some basic things, but I know the API and Python a lot better. This is my first Blender/Python project, so you may be wondering "how is he making a NFT collection with Blender??" Well I'm not, I write the code for the Blend_My_NFTs, and my team has three other members; Devlin and Caelin, who create the scenes and models in Blender, and the third is Quinn who is the lead web developer for our site. - -If building an NFT collection in blender is something you really want to do and you have experience with Blender, I suggest you get familiar with some basic Python functionality and then how to run scripts in the Belnder Text Editor (an indepth knowledge is not required). However, if you don't use Blender but have a coding background, I would suggest watching some basic tutorials just to get a feel for the software (an indepth knowledge is not required). - -This tutorial page is not finished! This page will be updated as I commit/merge new changes to the main branch. (Last updated Nov 10th, 2021) - -I garuntee this will eventually be an add on to Blender and not just a script you run through the script editor. (I mostly just put this in here for personal motivation, please don't pester me about the date lol) - -Nothing in this repository or its documentation is financial advice. If you create an NFT project or collection with Blend_My_NFTs, you do so at your own personal and financial risk. We are only providing a means of acomplishing a goal, not investment or financial information about that goal. Do your own research and come to your own conclusions before spending money on NFTs or any asset for that matter. We are not liable for any finacial losses you may encure while using this software. Any discussion about finances and cryptocurrencies in this repository or its documentation are done with the intent to educate and provide examples to help our users understand concepts relating to Blend_My_NFTs and This Cozy Place. - -The creators of This Cozy Studio will never, under any cricumstance, ask for your crypto wallet(s) secret phrase or private keys. If you come across anyone who is impersonating the founding members of This Cozy Place, please report it immediately to the admins on our discord channel and we will take appropriate action and warn our community of the behaviour. If this takes place outside of our community boundries then report the user to the appropriate authorities. - -This software is provided for free and is open source. We are not liable for any felones you may commit using this software, and we staunchly appose the malicious use of this software that in any way breaks any applicable law in your loction of residence. diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..f9ac261 --- /dev/null +++ b/__init__.py @@ -0,0 +1,275 @@ +bl_info = { + "name": "Blend_My_NFTs", + "author": "Torrin Leonard, This Cozy Studio Inc", + "version": (1, 0, 0), + "blender": (3, 0, 0), + "location": "View3D", + "description": "Blend_My_NFTs UI Edition", + "category": "Development", +} + +# Import handling: + +import bpy +import os +import importlib + +from .main import DNA_Generator, Batch_Sorter, Exporter, Batch_Refactorer + +importlib.reload(DNA_Generator) +importlib.reload(Batch_Sorter) +importlib.reload(Exporter) +importlib.reload(Batch_Refactorer) + + +# User input Property Group: + +class BMNFTS_PGT_MyProperties(bpy.types.PropertyGroup): + # Main BMNFTS Panel properties: + + nftName: bpy.props.StringProperty(name="NFT Name") + + collectionSize: bpy.props.IntProperty(name="NFT Collection Size") # config.py = maxNFTs + nftsPerBatch: bpy.props.IntProperty(name="NFTs Per Batch") # config.py = nftsPerBatch + batchToGenerate: bpy.props.IntProperty(name="Batch To Generate", default=1) # config.py = renderBatch + + save_path: bpy.props.StringProperty(name="Save Path", + description="Save path for NFT files", + default="", + maxlen=1024, + subtype="DIR_PATH") + + enableRarity: bpy.props.BoolProperty(name="Enable Rarity") + + imageBool: bpy.props.BoolProperty(name="Image") + imageEnum: bpy.props.EnumProperty( + name="Image File Format", + description="Select Image file format", + items=[ + ('PNG', ".PNG", "Export NFT as PNG"), + ('JPEG', ".JPEG", "Export NFT as JPEG") + ] + ) + + animationBool: bpy.props.BoolProperty(name="Animation") + animationEnum: bpy.props.EnumProperty( + name="Animation File Format", + description="Select Animation file format", + items=[ + ('AVI_JPEG', "AVI_JPEG", "Export NFT as AVI_JPEG"), + ('AVI_RAW', "AVI_RAW", "Export NFT as AVI_RAW"), + ('FFMPEG', "FFMPEG", "Export NFT as FFMPEG") + ] + ) + + modelBool: bpy.props.BoolProperty(name="3D Model") + modelEnum: bpy.props.EnumProperty( + name="3D Model File Format", + description="Select 3D Model file format", + items=[ + ('GLB', '.glb', 'Export NFT as .glb'), + ('GLTF_SEPARATE', '.gltf + .bin + textures', 'Export NFT as .gltf with separated textures in .bin + textures.'), + ('GLTF_EMBEDDED', '.gltf', 'Export NFT as embedded .gltf file that contains textures.'), + ('FBX', '.fbx', 'Export NFT as .fbx'), + ('OBJ', '.obj', 'Export NFT as .obj'), + ('X3D', '.x3d', 'Export NFT as .x3d'), + ('VOX', '.vox', 'Export NFT as .vox, requires the voxwriter add on: https://github.com/Spyduck/voxwriter') + ] + ) + + number: bpy.props.FloatProperty(name="float") + + cardanoMetaDataBool: bpy.props.BoolProperty(name="Cardano Cip") + solanaMetaDataBool: bpy.props.BoolProperty(name="Solana Metaplex") + erc721MetaData: bpy.props.BoolProperty(name="ERC721") + + # API Panel properties: + apiKey: bpy.props.StringProperty(name="API Key", subtype='PASSWORD') + + +def make_directories(save_path): + Blend_My_NFTs_Output = os.path.join(save_path, "Blend_My_NFTs Output", "NFT_Data") + batch_json_save_path = os.path.join(Blend_My_NFTs_Output, "Batch_Data") + + nftBatch_save_path = os.path.join(save_path, "Blend_My_NFTs Output", "Generated NFT Batches") + + if not os.path.exists(Blend_My_NFTs_Output): + os.makedirs(Blend_My_NFTs_Output) + if not os.path.exists(batch_json_save_path): + os.makedirs(batch_json_save_path) + if not os.path.exists(nftBatch_save_path): + os.makedirs(nftBatch_save_path) + return Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path + +class createData(bpy.types.Operator): + bl_idname = 'create.data' + bl_label = 'Create Data' + bl_description = 'Creates NFT Data. Run after any changes were made to scene.' + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + + nftName = bpy.context.scene.my_tool.nftName + maxNFTs = bpy.context.scene.my_tool.collectionSize + nftsPerBatch = bpy.context.scene.my_tool.nftsPerBatch + save_path = bpy.context.scene.my_tool.save_path + enableRarity = bpy.context.scene.my_tool.enableRarity + + Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path = make_directories(save_path) + + DNA_Generator.send_To_Record_JSON(nftName, maxNFTs, nftsPerBatch, save_path, enableRarity, Blend_My_NFTs_Output) + Batch_Sorter.makeBatches(nftName, maxNFTs, nftsPerBatch, save_path, batch_json_save_path) + return {"FINISHED"} + +class exportNFTs(bpy.types.Operator): + bl_idname = 'exporter.nfts' + bl_label = 'Export NFTs' + bl_description = 'Generate and export a given batch of NFTs.' + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + nftName = bpy.context.scene.my_tool.nftName + save_path = bpy.context.scene.my_tool.save_path + batchToGenerate = bpy.context.scene.my_tool.batchToGenerate + maxNFTs = bpy.context.scene.my_tool.collectionSize + + Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path = make_directories(save_path) + + enableImages = bpy.context.scene.my_tool.imageBool + print(enableImages) + imageFileFormat = bpy.context.scene.my_tool.imageEnum + print(imageFileFormat) + + enableAnimations = bpy.context.scene.my_tool.animationBool + animationFileFormat = bpy.context.scene.my_tool.animationEnum + + enableModelsBlender = bpy.context.scene.my_tool.modelBool + modelFileFormat = bpy.context.scene.my_tool.modelEnum + + + Exporter.render_and_save_NFTs(nftName, maxNFTs, batchToGenerate, batch_json_save_path, nftBatch_save_path, enableImages, + imageFileFormat, enableAnimations, animationFileFormat, enableModelsBlender, + modelFileFormat + ) + return {"FINISHED"} + +class refactor_Batches(bpy.types.Operator): + bl_idname = 'refactor.batches' + bl_label = 'Refactor Batches' + bl_description = 'Generate and export a given batch of NFTs.' + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + save_path = bpy.context.scene.my_tool.save_path + + cardanoMetaDataBool = bpy.context.scene.my_tool.cardanoMetaDataBool + solanaMetaDataBool = bpy.context.scene.my_tool.solanaMetaDataBool + erc721MetaData = bpy.context.scene.my_tool.erc721MetaData + + Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path = make_directories(save_path) + + Batch_Refactorer.reformatNFTCollection(save_path, Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path, + cardanoMetaDataBool, solanaMetaDataBool, erc721MetaData) + + + +# Main Panel: +class BMNFTS_PT_MainPanel(bpy.types.Panel): + bl_label = "Blend_My_NFTs" + bl_idname = "BMNFTS_PT_MainPanel" + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_category = 'Blend_My_NFTs' + + def draw(self, context): + layout = self.layout + scene = context.scene + mytool = scene.my_tool + + row = layout.row() + row.prop(mytool, "nftName") + + row = layout.row() + row.prop(mytool, "collectionSize") + + row = layout.row() + row.prop(mytool, "nftsPerBatch") + + row = layout.row() + row.prop(mytool, "batchToGenerate") + + row = layout.row() + layout.label(text="Export NFT as:") + + row = layout.row() + row.prop(mytool, "imageBool") + if bpy.context.scene.my_tool.imageBool == True: + row.prop(mytool, "imageEnum") + + row = layout.row() + row.prop(mytool, "animationBool") + if bpy.context.scene.my_tool.animationBool == True: + row.prop(mytool, "animationEnum") + + row = layout.row() + row.prop(mytool, "modelBool") + if bpy.context.scene.my_tool.modelBool == True: + row.prop(mytool, "modelEnum") + + row = layout.row() + row.prop(mytool, "save_path") + + row = layout.row() + row.prop(mytool, "enableRarity") + + row = layout.row() + self.layout.operator("create.data", icon='MESH_CUBE', text="Create Data") + + row = layout.row() + self.layout.operator("exporter.nfts", icon='MESH_CUBE', text="Generate NFTs") + + row = layout.row() + layout.label(text="Meta Data format:") + + row = layout.row() + row.prop(mytool, "cardanoMetaDataBool") + row.prop(mytool, "solanaMetaDataBool") + row.prop(mytool, "erc721MetaData") + self.layout.operator("refactor.batches", icon='MESH_CUBE', text="Refactor Batches & create MetaData") + + +# API Panel: +class BMNFTS_PT_API_Panel(bpy.types.Panel): + bl_label = "API" + bl_idname = "BMNFTS_PT_API_Panel" + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_category = 'Blend_My_NFTs' + + def draw(self, context): + layout = self.layout + scene = context.scene + mytool = scene.my_tool + + row = layout.row() + row.prop(mytool, "apiKey") + + +# Register and Unregister classes from Blender: +classes = (BMNFTS_PGT_MyProperties, BMNFTS_PT_MainPanel, BMNFTS_PT_API_Panel, createData, exportNFTs, refactor_Batches) + +def register(): + for cls in classes: + bpy.utils.register_class(cls) + + bpy.types.Scene.my_tool = bpy.props.PointerProperty(type=BMNFTS_PGT_MyProperties) + +def unregister(): + for cls in classes: + bpy.utils.unregister_class(cls) + + del bpy.types.Scene.my_tool + + +if __name__ == '__main__': + register() diff --git a/src/Utility_Scripts/BatchRefactorer.py b/main/Batch_Refactorer.py similarity index 76% rename from src/Utility_Scripts/BatchRefactorer.py rename to main/Batch_Refactorer.py index a03e2dd..ded7fe4 100644 --- a/src/Utility_Scripts/BatchRefactorer.py +++ b/main/Batch_Refactorer.py @@ -3,32 +3,25 @@ import bpy import os -import sys import copy import json import importlib -dir = os.path.dirname(bpy.data.filepath) -sys.path.append(dir) -sys.modules.values() +from . import metaData -from src import config -from src.Main_Generators import metaData - -importlib.reload(config) importlib.reload(metaData) removeList = [".gitignore", ".DS_Store"] -def getNFType(): +def getNFType(nftBatch_save_path): images = False animations = False models = False metaData = False - batch1 = [x for x in os.listdir(config.nft_save_path) if (x not in removeList)][0] # Gets first Batch and ignores removeList files - batchContent = os.listdir(os.path.join(config.nft_save_path, batch1)) + batch1 = [x for x in os.listdir(nftBatch_save_path) if (x not in removeList)][0] # Gets first Batch and ignores removeList files + batchContent = os.listdir(os.path.join(nftBatch_save_path, batch1)) batchContent = [x for x in batchContent if (x not in removeList)] if "Images" in batchContent: @@ -51,69 +44,69 @@ def getMetaDataDirty(completeMetaDataPath, i): metaDataDirty = json.load(open(file_name)) name = metaDataDirty["name"] - description = metaDataDirty["description"] NFT_DNA = metaDataDirty["NFT_DNA"] NFT_Variants = metaDataDirty["NFT_Variants"] - if config.turnNumsOff: - for i in NFT_Variants: - x = NFT_Variants[i] - NFT_Variants[i] = x.split("_")[0] + for i in NFT_Variants: + x = NFT_Variants[i] + NFT_Variants[i] = x.split("_")[0] - return name, description, NFT_DNA, NFT_Variants + return name, NFT_DNA, NFT_Variants def sendMetaDataToJson(metaDataDict, metaDataPath, jsonName): jsonMetaData = json.dumps(metaDataDict, indent=1, ensure_ascii=True) with open(os.path.join(metaDataPath, jsonName), 'w') as outfile: outfile.write(jsonMetaData + '\n') -def renameMetaData(completeCollPath, completeMetaDataPath): +def renameMetaData(completeCollPath, completeMetaDataPath, cardanoMetaDataBool, solanaMetaDataBool, erc721MetaData): metaDataListOld = os.listdir(completeMetaDataPath) cardanoMetaDataPath = os.path.join(completeCollPath, "Cardano_metaData") solanaMetaDataPath = os.path.join(completeCollPath, "Solana_metaData") erc721MetaDataPath = os.path.join(completeCollPath, "Erc721_metaData") for i in metaDataListOld: - name, description, NFT_DNA, NFT_Variants = getMetaDataDirty(completeMetaDataPath, i) + name, NFT_DNA, NFT_Variants = getMetaDataDirty(completeMetaDataPath, i) file_name = os.path.splitext(i)[0] file_num = file_name.split("_")[1] - if config.cardanoMetaData: + if cardanoMetaDataBool: if not os.path.exists(cardanoMetaDataPath): os.mkdir(cardanoMetaDataPath) cardanoJsonNew = "Cardano_" + i cardanoNewName = name.split("_")[0] + "_" + str(file_num) - metaDataDictCardano = metaData.returnCardanoMetaData(cardanoNewName, description, NFT_DNA, NFT_Variants) + metaDataDictCardano = metaData.returnCardanoMetaData(cardanoNewName, NFT_DNA, NFT_Variants) sendMetaDataToJson(metaDataDictCardano, cardanoMetaDataPath, cardanoJsonNew) - if config.solanaMetaData: + if solanaMetaDataBool: if not os.path.exists(solanaMetaDataPath): os.mkdir(solanaMetaDataPath) solanaJsonNew = "Solana_" + i solanaNewName = name.split("_")[0] + "_" + str(file_num) - metaDataDictSolana = metaData.returnSolanaMetaData(solanaNewName, description, NFT_DNA, NFT_Variants) + metaDataDictSolana = metaData.returnSolanaMetaData(solanaNewName, NFT_DNA, NFT_Variants) sendMetaDataToJson(metaDataDictSolana, solanaMetaDataPath, solanaJsonNew) - if config.erc721MetaData: + if erc721MetaData: if not os.path.exists(erc721MetaDataPath): os.mkdir(erc721MetaDataPath) erc721JsonNew = "Erc721_" + i erc721NewName = name.split("_")[0] + "_" + str(file_num) - metaDataDictErc721 = metaData.returnErc721MetaData(erc721NewName, description, NFT_DNA, NFT_Variants) + metaDataDictErc721 = metaData.returnErc721MetaData(erc721NewName, NFT_DNA, NFT_Variants) sendMetaDataToJson(metaDataDictErc721, erc721MetaDataPath, erc721JsonNew) return -def reformatNFTCollection(): - images, animations, models, metaData = getNFType() +def reformatNFTCollection(save_path, Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path, cardanoMetaDataBool, + solanaMetaDataBool, erc721MetaData): - completeCollPath = os.path.join(config.save_path, "Complete_Collection") + images, animations, models, metaData = getNFType(nftBatch_save_path) + + completeCollPath = os.path.join(save_path, "Complete_Collection") completeImagePath = os.path.join(completeCollPath, "Images") completeAnimationsPath = os.path.join(completeCollPath, "Animations") completeModelsPath = os.path.join(completeCollPath, "Models") @@ -130,7 +123,7 @@ def reformatNFTCollection(): if metaData and not os.path.exists(completeMetaDataPath): os.mkdir(completeMetaDataPath) - batchListDirty = os.listdir(config.nft_save_path) + batchListDirty = os.listdir(nftBatch_save_path) batchList = [x for x in batchListDirty if (x not in removeList)] imageCount = 1 @@ -139,11 +132,11 @@ def reformatNFTCollection(): dataCount = 1 for i in batchList: if images: - imagesDir = os.path.join(config.nft_save_path, i, "Images") + imagesDir = os.path.join(nftBatch_save_path, i, "Images") imagesList = sorted(os.listdir(imagesDir)) for j in imagesList: - imageOldPath = os.path.join(config.nft_save_path, i, "Images", j) + imageOldPath = os.path.join(nftBatch_save_path, i, "Images", j) nameOldDirty = copy.deepcopy(os.path.splitext(j)[0]) extension = copy.deepcopy(os.path.splitext(j)[1]) nameOldClean = nameOldDirty.split("_")[0] @@ -156,11 +149,11 @@ def reformatNFTCollection(): imageCount += 1 if animations: - animationsDir = os.path.join(config.nft_save_path, i, "Animations") + animationsDir = os.path.join(nftBatch_save_path, i, "Animations") animationsList = sorted(os.listdir(animationsDir)) for j in animationsList: - animationOldPath = os.path.join(config.nft_save_path, i, "Animations", j) + animationOldPath = os.path.join(nftBatch_save_path, i, "Animations", j) nameOldDirty = copy.deepcopy(os.path.splitext(j)[0]) extension = copy.deepcopy(os.path.splitext(j)[1]) nameOldClean = nameOldDirty.split("_")[0] @@ -173,11 +166,11 @@ def reformatNFTCollection(): animationCount += 1 if models: - modelsDir = os.path.join(config.nft_save_path, i, "Models") + modelsDir = os.path.join(nftBatch_save_path, i, "Models") modelsList = sorted(os.listdir(modelsDir)) for j in modelsList: - modelOldPath = os.path.join(config.nft_save_path, i, "Models", j) + modelOldPath = os.path.join(nftBatch_save_path, i, "Models", j) nameOldDirty = copy.deepcopy(os.path.splitext(j)[0]) extension = copy.deepcopy(os.path.splitext(j)[1]) nameOldClean = nameOldDirty.split("_")[0] @@ -190,11 +183,11 @@ def reformatNFTCollection(): modelCount += 1 if metaData: - dataDir = os.path.join(config.nft_save_path, i, "BMNFT_metaData") + dataDir = os.path.join(nftBatch_save_path, i, "BMNFT_metaData") dataList = sorted(os.listdir(dataDir)) for j in dataList: - dataOldPath = os.path.join(config.nft_save_path, i, "BMNFT_metaData", j) + dataOldPath = os.path.join(nftBatch_save_path, i, "BMNFT_metaData", j) nameOldDirty = copy.deepcopy(os.path.splitext(j)[0]) extension = copy.deepcopy(os.path.splitext(j)[1]) nameOldClean = nameOldDirty.split("_")[0] @@ -213,9 +206,9 @@ def reformatNFTCollection(): dataCount += 1 - print(f"All NFT files stored and sorted to the Complete_Collection folder in {config.save_path}") + print(f"All NFT files stored and sorted to the Complete_Collection folder in {save_path}") - renameMetaData(completeCollPath, completeMetaDataPath) + renameMetaData(completeCollPath, completeMetaDataPath, cardanoMetaDataBool, solanaMetaDataBool, erc721MetaData) if __name__ == '__main__': diff --git a/src/Main_Generators/Batch_Sorter.py b/main/Batch_Sorter.py similarity index 58% rename from src/Main_Generators/Batch_Sorter.py rename to main/Batch_Sorter.py index 328ca86..c3f07dc 100644 --- a/src/Main_Generators/Batch_Sorter.py +++ b/main/Batch_Sorter.py @@ -9,41 +9,40 @@ import json import random import importlib -dir = os.path.dirname(bpy.data.filepath) -sys.path.append(dir) -sys.modules.values() -from src import config +def makeBatches(nftName, maxNFTs, nftsPerBatch, save_path, batch_json_save_path): + Blend_My_NFTs_Output = os.path.join(save_path, "Blend_My_NFTs Output", "NFT_Data") + NFTRecord_save_path = os.path.join(Blend_My_NFTs_Output, "NFTRecord.json") -importlib.reload(config) - -if config.runPreview: - config.nftsPerBatch = config.maxNFTsTest - config.maxNFTs = config.maxNFTsTest - config.renderBatch = 1 - config.nftName = "TestImages" - - -def makeBatches(): - file_name = os.path.join(config.save_path, "NFTRecord.json") - DataDictionary = json.load(open(file_name)) + DataDictionary = json.load(open(NFTRecord_save_path)) numNFTsGenerated = DataDictionary["numNFTsGenerated"] hierarchy = DataDictionary["hierarchy"] DNAList = DataDictionary["DNAList"] - numBatches = config.maxNFTs / config.nftsPerBatch + numBatches = maxNFTs / nftsPerBatch - print(f"To generate batches of {config.nftsPerBatch} DNA sequences per batch, with a total of {numNFTsGenerated}" + print(f"To generate batches of {nftsPerBatch} DNA sequences per batch, with a total of {numNFTsGenerated}" f" possible NFT DNA sequences, the number of batches generated will be {numBatches}") + # Clears the Batch Data folder of Batches: + batchList = os.listdir(batch_json_save_path) + + if batchList: + for i in batchList: + batch = os.path.join(batch_json_save_path, i) + if os.path.exists(batch): + os.remove( + os.path.join(batch_json_save_path, i) + ) + i = 0 while i < numBatches: batchDictionary = {} BatchDNAList = [] j = 0 - while (j < config.nftsPerBatch) and (DNAList): + while (j < nftsPerBatch) and (DNAList): oneDNA = random.choice(DNAList) BatchDNAList.append(oneDNA) DNAList.remove(oneDNA) @@ -55,7 +54,7 @@ def makeBatches(): batchDictionaryObject = json.dumps(batchDictionary, indent=1, ensure_ascii=True) - with open(os.path.join(config.batch_json_save_path, ("Batch{}.json".format(i + 1))), "w") as outfile: + with open(os.path.join(batch_json_save_path, ("Batch{}.json".format(i + 1))), "w") as outfile: outfile.write(batchDictionaryObject) i += 1 @@ -67,7 +66,7 @@ def makeBatches(): incompleteBatch = json.dumps(incompleteBatch, indent=1, ensure_ascii=True) - with open(os.path.join(config.batch_json_save_path, ("Batch{}.json".format(i + 1))), "w") as outfile2: + with open(os.path.join(batch_json_save_path, ("Batch{}.json".format(i + 1))), "w") as outfile2: outfile2.write(incompleteBatch) diff --git a/src/Main_Generators/DNA_Generator.py b/main/DNA_Generator.py similarity index 84% rename from src/Main_Generators/DNA_Generator.py rename to main/DNA_Generator.py index f5f2af0..155a0d7 100644 --- a/src/Main_Generators/DNA_Generator.py +++ b/main/DNA_Generator.py @@ -4,7 +4,6 @@ import bpy import os import re -import sys import copy import time import json @@ -12,22 +11,11 @@ import random import importlib from functools import partial -dir = os.path.dirname(bpy.data.filepath) -sys.path.append(dir) -sys.modules.values() - -from src import config -from src.Main_Generators import Rarity_Sorter - -importlib.reload(config) +from . import Rarity_Sorter importlib.reload(Rarity_Sorter) - -if config.runPreview: - config.nftsPerBatch = config.maxNFTsTest - config.maxNFTs = config.maxNFTsTest - config.renderBatch = 1 - config.nftName = "TestImages" +enableGeneration = False +colorList = [] class bcolors: ''' @@ -38,14 +26,13 @@ class bcolors: ERROR = '\033[91m' # RED RESET = '\033[0m' # RESET COLOR -time_start = time.time() -print("") +time_start = time.time() def stripColorFromName(name): return "_".join(name.split("_")[:-1]) -def returnData(): +def returnData(nftName, maxNFTs, nftsPerBatch, save_path, enableRarity): ''' Generates important variables, dictionaries, and lists needed to be stored to catalog the NFTs. :return: listAllCollections, attributeCollections, attributeCollections1, hierarchy, variantMetaData, possibleCombinations @@ -84,9 +71,9 @@ def returnData(): ignoreList = listSubIgnoreCollections() for i in listAllCollInScene: - if config.enableGeneration: - if i.name in config.colorList: - for j in range(len(config.colorList[i.name])): + if enableGeneration: + if i.name in colorList: + for j in range(len(colorList[i.name])): if i.name[-1].isdigit() and i.name not in ignoreList: listAllCollections.append(i.name + "_" + str(j + 1)) elif j == 0: @@ -173,7 +160,7 @@ def returnData(): elif len(orderRarity) > 0: number = orderRarity[0] - if config.enableGeneration: + if enableGeneration: if count == 1 or count == 0: previousAttribute = i.partition("_")[0] count +=1 @@ -183,7 +170,7 @@ def returnData(): count = 1 number = str(count) rarity = orderRarity[1] - if config.enableGeneration and stripColorFromName(i) in config.colorList: + if enableGeneration and stripColorFromName(i) in colorList: color = orderRarity[2] else: color = "0" @@ -202,12 +189,12 @@ def returnData(): colParLong = list(bpy.data.collections[str(i)].children) colParShort = {} for x in colParLong: - if config.enableGeneration: + if enableGeneration: """ Append colors to blender name for PNG generator and NFTRecord.json to create the correct list """ - if x.name in config.colorList: - for j in range(len(config.colorList[x.name])): + if x.name in colorList: + for j in range(len(colorList[x.name])): colParShort[x.name + "_" + str(j+1)] = None else: colParShort[x.name + "_0"] = None @@ -244,7 +231,7 @@ def returnData(): combinations = combinations*i try: - numBatches = combinations/config.nftsPerBatch + numBatches = combinations/nftsPerBatch except: print(f"{bcolors.ERROR} ERROR:\nnftsPerBatch in config.py needs to be a positive integer. {bcolors.RESET}") @@ -259,7 +246,7 @@ def returnData(): if numBatches < 1: print(f"{bcolors.ERROR} ERROR: {bcolors.RESET}") print("The number of NFTs Per Batch (nftsPerBatch variable in config.py) is to high. There are a total of " - f" {combinations} possible NFT combinations and you've requested {config.nftsPerBatch} NFTs per batch. " + f" {combinations} possible NFT combinations and you've requested {nftsPerBatch} NFTs per batch. " f"Lower the number of NFTs per batch in config.py or increase the number of attributes and/or variants in your .blend file.") return combinations @@ -268,7 +255,7 @@ def returnData(): for i in variantMetaData: def cameraToggle(i, toggle=True): - if config.enableGeneration: + if enableGeneration: """ Remove Color code so blender recognises the collection """ @@ -279,21 +266,21 @@ def returnData(): return listAllCollections, attributeCollections, attributeCollections1, hierarchy, possibleCombinations -def generateNFT_DNA(): +def generateNFT_DNA(nftName, maxNFTs, nftsPerBatch, save_path, enableRarity): """ Returns batchDataDictionary containing the number of NFT combinations, hierarchy, and the DNAList. """ - listAllCollections, attributeCollections, attributeCollections1, hierarchy, possibleCombinations = returnData() + listAllCollections, attributeCollections, attributeCollections1, hierarchy, possibleCombinations = returnData(nftName, maxNFTs, nftsPerBatch, save_path, enableRarity) print(f"NFT Combinations: {possibleCombinations}\n") - print(f"Generating {config.maxNFTs} combinations of DNA.\n") + print(f"Generating {maxNFTs} combinations of DNA.\n") DataDictionary = {} listOptionVariant = [] DNAList = [] - if not config.enableRarity: + if not enableRarity: DNASet = set() for i in hierarchy: @@ -318,27 +305,27 @@ def generateNFT_DNA(): return str(dna) - for i in range(config.maxNFTs): + for i in range(maxNFTs): dnaPushToList = partial(createDNARandom) - DNASet |= {''.join([dnaPushToList()]) for _ in range(config.maxNFTs - len(DNASet))} + DNASet |= {''.join([dnaPushToList()]) for _ in range(maxNFTs - len(DNASet))} DNAList = list(DNASet) - possibleCombinations = config.maxNFTs + possibleCombinations = maxNFTs - if config.nftsPerBatch > config.maxNFTs: + if nftsPerBatch > maxNFTs: print(bcolors.WARNING + "\nWARNING:" + bcolors.RESET) - print(f"The Max num of NFTs you chose is smaller than the NFTs Per Batch you set. Only {config.maxNFTs} were added to 1 batch") + print(f"The Max num of NFTs you chose is smaller than the NFTs Per Batch you set. Only {maxNFTs} were added to 1 batch") - if config.enableRarity: + if enableRarity: print(f"{bcolors.OK} Rarity is on. Weights listed in .blend will be taken into account {bcolors.RESET}") - possibleCombinations = config.maxNFTs - DNAList = Rarity_Sorter.sortRarityWeights(hierarchy, listOptionVariant, DNAList) + possibleCombinations = maxNFTs + DNAList = Rarity_Sorter.sortRarityWeights(hierarchy, listOptionVariant, DNAList, nftName, maxNFTs, nftsPerBatch, save_path, enableRarity) - if len(DNAList) < config.maxNFTs: + if len(DNAList) < maxNFTs: print(f"{bcolors.ERROR} \nWARNING: \n" - f"You are seeing this warning because the program cannot generate {config.maxNFTs} NFTs with rarity enabled. " + f"You are seeing this warning because the program cannot generate {maxNFTs} NFTs with rarity enabled. " f"Only {len(DNAList)} NFT DNA were generated." f"Either A) Lower the number of NFTs you wish to create, or B) Increase the maximum number of possible NFTs by" f" creating more variants and attributes in your .blend file.{bcolors.RESET}") @@ -350,7 +337,7 @@ def generateNFT_DNA(): return DataDictionary, possibleCombinations, DNAList -def send_To_Record_JSON(): +def send_To_Record_JSON(nftName, maxNFTs, nftsPerBatch, save_path, enableRarity, Blend_My_NFTs_Output): """ Creates NFTRecord.json file and sends "batchDataDictionary" to it. NFTRecord.json is a permanent record of all DNA you've generated with all attribute variants. If you add new variants or attributes to your .blend file, other scripts @@ -358,19 +345,20 @@ def send_To_Record_JSON(): repeate DNA. """ - DataDictionary, possibleCombinations, DNAList = generateNFT_DNA() + DataDictionary, possibleCombinations, DNAList = generateNFT_DNA(nftName, maxNFTs, nftsPerBatch, save_path, enableRarity) + + NFTRecord_save_path = os.path.join(Blend_My_NFTs_Output, "NFTRecord.json") try: ledger = json.dumps(DataDictionary, indent=1, ensure_ascii=True) - with open(os.path.join(config.save_path, "NFTRecord.json"), 'w') as outfile: + with open(NFTRecord_save_path, 'w') as outfile: outfile.write(ledger + '\n') - print(f"{bcolors.OK}{len(DNAList)} NFT DNA sent to NFTRecord.json in %.4f seconds.\n" % (time.time() - time_start) + bcolors.RESET) + print(f"{bcolors.OK}{len(DNAList)} NFT DNA saved to {NFTRecord_save_path}\n" + f"NFT DNA Successfully created. {bcolors.RESET}") except: - print(f"{bcolors.ERROR} ERROR:\nNFT DNA not sent to NFTRecord.json.\n {bcolors.RESET}") + print(f"{bcolors.ERROR} ERROR:\nNFT DNA not sent to {NFTRecord_save_path}\n {bcolors.RESET}") if __name__ == '__main__': - stripColorFromName() - returnData() send_To_Record_JSON() diff --git a/src/Main_Generators/Exporter.py b/main/Exporter.py similarity index 62% rename from src/Main_Generators/Exporter.py rename to main/Exporter.py index 57492fe..128c551 100644 --- a/src/Main_Generators/Exporter.py +++ b/main/Exporter.py @@ -4,20 +4,13 @@ import bpy import os -import sys import time import json -import importlib -dir = os.path.dirname(bpy.data.filepath) -sys.path.append(dir) -sys.modules.values() -from src import config -from src.Main_Generators import metaData - -importlib.reload(config) -importlib.reload(metaData) +enableGeneration = False +colorList = [] +generationType = None class bcolors: ''' @@ -29,21 +22,15 @@ class bcolors: RESET = '\033[0m' # RESET COLOR -if config.runPreview: - config.nftsPerBatch = config.maxNFTsTest - config.maxNFTs = config.maxNFTsTest - config.renderBatch = 1 - config.nftName = "TestImages" - def stripColorFromName(name): return "_".join(name.split("_")[:-1]) -def getBatchData(): +def getBatchData(batchToGenerate, batch_json_save_path): """ Retrieves a given batches data determined by renderBatch in config.py """ - file_name = os.path.join(config.batch_json_save_path, "Batch{}.json".format(config.renderBatch)) + file_name = os.path.join(batch_json_save_path, "Batch{}.json".format(batchToGenerate)) batch = json.load(open(file_name)) NFTs_in_Batch = batch["NFTs_in_Batch"] @@ -52,13 +39,16 @@ def getBatchData(): return NFTs_in_Batch, hierarchy, BatchDNAList -def render_and_save_NFTs(): +def render_and_save_NFTs(nftName, maxNFTs, batchToGenerate, batch_json_save_path, nftBatch_save_path, enableImages, + imageFileFormat, enableAnimations, animationFileFormat, enableModelsBlender, + modelFileFormat + ): """ Renders the NFT DNA in a Batch#.json, where # is renderBatch in config.py. Turns off the viewport camera and the render camera for all items in hierarchy. """ - NFTs_in_Batch, hierarchy, BatchDNAList = getBatchData() + NFTs_in_Batch, hierarchy, BatchDNAList = getBatchData(batchToGenerate, batch_json_save_path) time_start_1 = time.time() @@ -66,7 +56,7 @@ def render_and_save_NFTs(): for a in BatchDNAList: for i in hierarchy: for j in hierarchy[i]: - if config.enableGeneration: + if enableGeneration: """ Remove Color code so blender recognises the collection """ @@ -94,20 +84,20 @@ def render_and_save_NFTs(): return dnaDictionary dnaDictionary = match_DNA_to_Variant(a) - name = config.nftName + "_" + str(x) + name = nftName + "_" + str(x) - print(f"\n{bcolors.OK}|---Generating {x} NFT Files---|{bcolors.RESET}") + print(f"\n{bcolors.OK}|---Generating NFT {x}/{NFTs_in_Batch} ---|{bcolors.RESET}") print(f"DNA attribute list:\n{dnaDictionary}\nDNA Code:{a}") for c in dnaDictionary: collection = dnaDictionary[c] - if not config.enableGeneration: + if not enableGeneration: bpy.data.collections[collection].hide_render = False bpy.data.collections[collection].hide_viewport = False time_start_2 = time.time() - batchFolder = os.path.join(config.nft_save_path, "Batch" + str(config.renderBatch)) + batchFolder = os.path.join(nftBatch_save_path, "Batch" + str(batchToGenerate)) imagePath = os.path.join(batchFolder, "Images", name) animationPath = os.path.join(batchFolder, "Animations", name) @@ -118,46 +108,50 @@ def render_and_save_NFTs(): modelFolder = os.path.join(batchFolder, "Models") metaDataFolder = os.path.join(batchFolder, "BMNFT_metaData") - if config.enableGeneration: + # Material handling: + if enableGeneration: for c in dnaDictionary: collection = dnaDictionary[c] - if stripColorFromName(collection) in config.colorList: + if stripColorFromName(collection) in colorList: colorVal = int(collection.rsplit("_", 1)[1])-1 collection = stripColorFromName(collection) bpy.data.collections[collection].hide_render = False bpy.data.collections[collection].hide_viewport = False - if config.generationType == 'color': + if generationType == 'color': for activeObject in bpy.data.collections[collection].all_objects: mat = bpy.data.materials.new("PKHG") - mat.diffuse_color = config.colorList[collection][colorVal] + mat.diffuse_color = colorList[collection][colorVal] activeObject.active_material = mat - if config.generationType == 'material': + if generationType == 'material': for activeObject in bpy.data.collections[collection].all_objects: - activeObject.material_slots[0].material = bpy.data.materials[config.colorList[collection][colorVal]] + activeObject.material_slots[0].material = bpy.data.materials[colorList[collection][colorVal]] else: collection = stripColorFromName(collection) bpy.data.collections[collection].hide_render = False bpy.data.collections[collection].hide_viewport = False - print(f"{bcolors.OK}Generating{bcolors.RESET}") - if config.enableImages: + if enableImages: + print(f"{bcolors.OK}Rendering Image{bcolors.RESET}") + if not os.path.exists(imageFolder): os.makedirs(imageFolder) bpy.context.scene.render.filepath = imagePath - bpy.context.scene.render.image_settings.file_format = config.imageFileFormat + bpy.context.scene.render.image_settings.file_format = imageFileFormat bpy.ops.render.render(write_still=True) - if config.enableAnimations: + if enableAnimations: + print(f"{bcolors.OK}Rendering Animation{bcolors.RESET}") if not os.path.exists(animationFolder): os.makedirs(animationFolder) bpy.context.scene.render.filepath = animationPath - bpy.context.scene.render.image_settings.file_format = config.animationFileFormat + bpy.context.scene.render.image_settings.file_format = animationFileFormat bpy.ops.render.render(animation=True) - if config.enableModelsBlender: + if enableModelsBlender: + print(f"{bcolors.OK}Generating 3D Model{bcolors.RESET}") if not os.path.exists(modelFolder): os.makedirs(modelFolder) @@ -170,29 +164,40 @@ def render_and_save_NFTs(): for obj in bpy.data.collections['Script_Ignore'].all_objects: obj.select_set(True) - if config.modelFileFormat == 'glb': - bpy.ops.export_scene.gltf(filepath=modelPath, + if modelFileFormat == 'GLB': + bpy.ops.export_scene.gltf(filepath=f"{modelPath}.glb", check_existing=True, export_format='GLB', use_selection=True) - elif config.modelFileFormat == 'fbx': - bpy.ops.export_scene.fbx(filepath=modelPath, + if modelFileFormat == 'GLTF_SEPARATE': + bpy.ops.export_scene.gltf(filepath=f"{modelPath}", + check_existing=True, + export_format='GLTF_SEPARATE', + use_selection=True) + if modelFileFormat == 'GLTF_EMBEDDED': + bpy.ops.export_scene.gltf(filepath=f"{modelPath}.gltf", + check_existing=True, + export_format='GLTF_EMBEDDED', + use_selection=True) + elif modelFileFormat == 'FBX': + bpy.ops.export_scene.fbx(filepath=f"{modelPath}.fbx", check_existing=True, use_selection=True) - elif config.modelFileFormat == 'obj': - bpy.ops.export_scene.obj(filepath=modelPath, + elif modelFileFormat == 'OBJ': + bpy.ops.export_scene.obj(filepath=f"{modelPath}.obj", check_existing=True, use_selection=True) - elif config.modelFileFormat == 'x3d': - bpy.ops.export_scene.x3d(filepath=modelPath, + elif modelFileFormat == 'X3D': + bpy.ops.export_scene.x3d(filepath=f"{modelPath}.x3d", check_existing=True, use_selection=True) + elif modelFileFormat == 'VOX': + bpy.ops.export_vox.some_data(filepath=f"{modelPath}.x3d") if not os.path.exists(metaDataFolder): os.makedirs(metaDataFolder) - metaDataDict = {"name": name, "description": config.metaDataDescription, "NFT_DNA": a, - "NFT_Variants": dnaDictionary} + metaDataDict = {"name": name, "NFT_DNA": a, "NFT_Variants": dnaDictionary} jsonMetaData = json.dumps(metaDataDict, indent=1, ensure_ascii=True) @@ -202,17 +207,16 @@ def render_and_save_NFTs(): print("Completed {} render in ".format(name) + "%.4f seconds" % (time.time() - time_start_2)) x += 1 - if config.enableResetViewport: - for a in BatchDNAList: - for i in hierarchy: - for j in hierarchy[i]: - if config.enableGeneration: - j = stripColorFromName(j) - bpy.data.collections[j].hide_render = False - bpy.data.collections[j].hide_viewport = False + for a in BatchDNAList: + for i in hierarchy: + for j in hierarchy[i]: + if enableGeneration: + j = stripColorFromName(j) + bpy.data.collections[j].hide_render = False + bpy.data.collections[j].hide_viewport = False - print("\nAll NFT PNGs rendered, process finished.") - print("Completed all renders in Batch{}.json in ".format(config.renderBatch) + "%.4f seconds" % (time.time() - time_start_1) + "\n") + print(f"\nAll NFTs successfully generated and sent to {nftBatch_save_path}") + print("Completed all renders in Batch{}.json in ".format(batchToGenerate) + "%.4f seconds" % (time.time() - time_start_1) + "\n") if __name__ == '__main__': diff --git a/src/Main_Generators/Rarity_Sorter.py b/main/Rarity_Sorter.py similarity index 75% rename from src/Main_Generators/Rarity_Sorter.py rename to main/Rarity_Sorter.py index feeb762..b6e5eb8 100644 --- a/src/Main_Generators/Rarity_Sorter.py +++ b/main/Rarity_Sorter.py @@ -5,29 +5,10 @@ import bpy import os import sys import random -import importlib from functools import partial -dir = os.path.dirname(bpy.data.filepath) -sys.path.append(dir) -sys.modules.values() - -from src import config -importlib.reload(config) - -from src.Main_Generators import DNA_Generator - -importlib.reload(DNA_Generator) - - -if config.runPreview: - config.nftsPerBatch = config.maxNFTsTest - config.maxNFTs = config.maxNFTsTest - config.renderBatch = 1 - config.nftName = "TestImages" - -def sortRarityWeights(hierarchy, listOptionVariant, DNAList): +def sortRarityWeights(hierarchy, listOptionVariant, DNAList, nftName, maxNFTs, nftsPerBatch, save_path, enableRarity): """ Sorts through DataDictionary and appropriately weights each variant based on their rarity percentage set in Blender ("rarity" in DNA_Generator). Then @@ -40,7 +21,7 @@ def sortRarityWeights(hierarchy, listOptionVariant, DNAList): possibleNums = list(range(1, numChild + 1)) listOptionVariant.append(possibleNums) - for x in range(config.maxNFTs): + for x in range(maxNFTs): def createDNA(): dnaStr1 = "" for i in hierarchy: @@ -75,7 +56,7 @@ def sortRarityWeights(hierarchy, listOptionVariant, DNAList): dnaPushToList = partial(createDNA) - DNASet |= {''.join([dnaPushToList()]) for _ in range(config.maxNFTs - len(DNASet))} + DNASet |= {''.join([dnaPushToList()]) for _ in range(maxNFTs - len(DNASet))} DNAListRare = list(DNASet) return DNAListRare diff --git a/src/Main_Generators/metaData.py b/main/metaData.py similarity index 80% rename from src/Main_Generators/metaData.py rename to main/metaData.py index b4b0cd1..dff172f 100644 --- a/src/Main_Generators/metaData.py +++ b/main/metaData.py @@ -10,23 +10,15 @@ import os import sys import importlib -dir = os.path.dirname(bpy.data.filepath) -sys.path.append(dir) -sys.modules.values() -from src import config - -importlib.reload(config) - - -def returnCardanoMetaData(name, description, NFT_DNA, NFT_Variants): +def returnCardanoMetaData(name, NFT_DNA, NFT_Variants): metaDataDictCardano = {"721": { "": { name: { "name": name, "image": "", "mediaType": "", - "description": description, + "description": "", } }, @@ -38,8 +30,8 @@ def returnCardanoMetaData(name, description, NFT_DNA, NFT_Variants): return metaDataDictCardano -def returnSolanaMetaData(name, description, NFT_DNA, NFT_Variants): - metaDataDictSolana = {"name": name, "symbol": "", "description": description, "seller_fee_basis_points": None, +def returnSolanaMetaData(name, NFT_DNA, NFT_Variants): + metaDataDictSolana = {"name": name, "symbol": "", "description": "", "seller_fee_basis_points": None, "image": "", "animation_url": "", "external_url": ""} attributes = [] @@ -65,10 +57,10 @@ def returnSolanaMetaData(name, description, NFT_DNA, NFT_Variants): } return metaDataDictSolana -def returnErc721MetaData(name, description, NFT_DNA, NFT_Variants): +def returnErc721MetaData(name, NFT_DNA, NFT_Variants): metaDataDictErc721 = { "name": name, - "description": description, + "description": "", "image": "", "attributes": None, } diff --git a/src/Model_Generators/Model_Generator.py b/src/Model_Generators/Model_Generator.py deleted file mode 100644 index e3df618..0000000 --- a/src/Model_Generators/Model_Generator.py +++ /dev/null @@ -1,152 +0,0 @@ -# Some of the code in this file was generously sponsored by the amazing team over at Rumble Worlds! -# Feel free to check out their amazing project and see how they are using Blend_My_NFTs: -# https://www.rumbleworlds.io/ - -# Purpose: -# This file imports object files from the 3D_Model_Import folder and exports possible combinations to the 3D_Model_Output folder - -import bpy -import os -import re -import sys -import copy -import time -import json -import random -import itertools -import importlib - -dir = os.path.dirname(bpy.data.filepath) -sys.path.append(dir) -sys.modules.values() - -from src import config - -importlib.reload(config) - - -class bcolors: - ''' - The colour of console messages. - ''' - OK = '\033[92m' # GREEN - WARNING = '\033[93m' # YELLOW - ERROR = '\033[91m' # RED - RESET = '\033[0m' # RESET COLOR - -def generate3DModels(): - ''' - This sorter assumes that every object file variant for each attribute has a unique name. Names can include numbers, or - any character value, but must be unique for each object. - ''' - time_start = time.time() - - def deleteAllObjects(): - ''' - Deletes all objects in the current scene open in Blender - ''' - deleteListObjects = ['MESH', 'CURVE', 'SURFACE', 'META', 'FONT', 'HAIR', 'POINTCLOUD', 'VOLUME', 'GPENCIL', - 'ARMATURE', 'LATTICE', 'EMPTY', 'LIGHT', 'LIGHT_PROBE', 'CAMERA', 'SPEAKER'] - - for o in bpy.context.scene.objects: - for i in deleteListObjects: - if o.type == i: - o.select_set(False) - else: - o.select_set(True) - bpy.ops.object.delete() - - deleteAllObjects() - attributeList = os.listdir(config.modelAssetPath) - removeList = [".gitignore", ".DS_Store", "Script_Ignore_Folder"] - attributeList = [x for x in attributeList if (x not in removeList)] - hierarchy = {} - - for i in attributeList: - file_unfiltered = os.listdir(os.path.join(config.modelAssetPath, i)) - add_to_hierarchy = [x for x in file_unfiltered if x not in removeList] - hierarchy[i] = add_to_hierarchy - - def numOfCombinations(hierarchy): - ''' - Returns "combinations" the number of all possible NFT combinations. - ''' - hierarchyByNum = [] - for i in hierarchy: - hierarchyByNum.append(len(hierarchy[i])) - combinations = 1 - for i in hierarchyByNum: - combinations = combinations*i - - if combinations == 0: - print(bcolors.FAIL + "\nERROR:" + bcolors.RESET) - print("The number of all possible combinations is equal to 0. Please review your collection hierarchy \n " - "and ensure it is formatted correctly.") - return combinations - - combinations = numOfCombinations(hierarchy) - allCombinationsNames = list(itertools.product(*hierarchy.values())) - - listToGenerate = [] - - while len(listToGenerate) < config.maxNFTs: - randCombo = random.choice(allCombinationsNames) - if randCombo not in listToGenerate: - listToGenerate.append(randCombo) - - count = 1 - - for i in listToGenerate: - if os.path.isdir(config.model_Script_Ignore_Path): - Script_Ignore_Folder = os.listdir(config.model_Script_Ignore_Path) - - for h in Script_Ignore_Folder: - fileName, fileExtension = os.path.splitext(h) - if fileExtension == ".glb": - bpy.ops.import_scene.gltf(filepath=os.path.join(config.model_Script_Ignore_Path, h)) - elif fileExtension == ".fbx": - bpy.ops.import_scene.fbx(filepath=os.path.join(config.model_Script_Ignore_Path, h)) - elif fileExtension == ".obj": - bpy.ops.import_scene.obj(filepath=os.path.join(config.model_Script_Ignore_Path, h)) - elif fileExtension == ".x3d": - bpy.ops.import_scene.obj(filepath=os.path.join(config.model_Script_Ignore_Path, h)) - - for j in i: - def getParent(hierarchy): - for x in hierarchy: - for y in hierarchy[x]: - if y == j: - return x - - parent = getParent(hierarchy) - path2 = os.path.join(config.modelAssetPath, parent, j) - fileName, fileExtension = os.path.splitext(j) - - if fileExtension == ".glb": - bpy.ops.import_scene.gltf(filepath=path2) - elif fileExtension == ".fbx": - bpy.ops.import_scene.fbx(filepath=path2) - elif fileExtension == ".obj": - bpy.ops.import_scene.obj(filepath=path2) - elif fileExtension == ".x3d": - bpy.ops.import_scene.obj(filepath=path2) - - if config.modelFileFormat == 'glb': - bpy.ops.export_scene.gltf(filepath=os.path.join(config.model_save_path, config.nftName + str(count)), - check_existing=True, export_format='GLB') - elif config.modelFileFormat == 'fbx': - bpy.ops.export_scene.fbx(filepath=os.path.join(config.model_save_path, config.nftName + str(count)), - check_existing=True) - elif config.modelFileFormat == 'obj': - bpy.ops.export_scene.obj(filepath=os.path.join(config.model_save_path, config.nftName + str(count)), - check_existing=True) - elif config.modelFileFormat == 'x3d': - bpy.ops.export_scene.x3d(filepath=os.path.join(config.model_save_path, config.nftName + str(count)), - check_existing=True) - deleteAllObjects() - count += 1 - - print("Generated ." + str(config.modelFileFormat) + " files in %.4f seconds" % (time.time() - time_start)) - -if __name__ == '__main__': - generate3DModels() diff --git a/src/Utility_Scripts/DuplicateChecker.py b/src/Utility_Scripts/DuplicateChecker.py deleted file mode 100644 index 0da9e3c..0000000 --- a/src/Utility_Scripts/DuplicateChecker.py +++ /dev/null @@ -1,52 +0,0 @@ -# Purpose: -# This file checks NFTRecord for duplicate NFT DNA and returns any found in the console. - -# Note - This file is provided for transparency, it is impossible for duplicates to be made with the current code in -# DNA_Generator.py. - -import bpy -import os -import sys -import json -import importlib - -dir = os.path.dirname(bpy.data.filepath) -sys.path.append(dir) -sys.modules.values() - -from src import config - -importlib.reload(config) - -class bcolors: - ''' - The colour of console messages. - ''' - OK = '\033[92m' # GREEN - WARNING = '\033[93m' # YELLOW - ERROR = '\033[91m' # RED - RESET = '\033[0m' # RESET COLOR - -def checkIfBatchDup(): - file_name = os.path.join(config.save_path, "NFTRecord.json") - DataDictionary = json.load(open(file_name)) - DNAList = DataDictionary["DNAList"] - - def countDups(thelist): - numOfDupDNA = 0 - seen = set() - for x in thelist: - if x in seen: - print(x) - numOfDupDNA += 1 - seen.add(x) - return numOfDupDNA - duplicates = countDups(DNAList) - return duplicates - -def checkDups(): - print(f"NFTRecord.json contains {checkIfBatchDup()} duplicate NFT DNA.") - - -if __name__ == '__main__': - checkDups() diff --git a/src/Utility_Scripts/Preview.py b/src/Utility_Scripts/Preview.py deleted file mode 100644 index 98d00da..0000000 --- a/src/Utility_Scripts/Preview.py +++ /dev/null @@ -1,84 +0,0 @@ -# Purpose: -# This file allows you to preview some calculations/numbers generated when you run main. It allows you to make adjustments -# to the config.py file before running main.py in case there are any issues. - -import bpy -import os -import sys -import platform -import importlib - -dir = os.path.dirname(bpy.data.filepath) -sys.path.append(dir) -sys.modules.values() - -from src.Main_Generators import DNA_Generator -from src.Utility_Scripts import RenderTest - -importlib.reload(DNA_Generator) -importlib.reload(RenderTest) - - -class bcolors: - ''' - The colour of console messages. - ''' - OK = '\033[92m' # GREEN - WARNING = '\033[93m' # YELLOW - ERROR = '\033[91m' # RED - RESET = '\033[0m' # RESET COLOR - -def printImportant(): - from src import config - importlib.reload(config) - - listAllCollections, attributeCollections, attributeCollections1, hierarchy, possibleCombinations = DNA_Generator.returnData() - - print(bcolors.OK + "--------YOU ARE RUNNING PREVIEW.py--------" + bcolors.RESET) - print("*Please Note: Running this test will have no effect on your config.py settings or the state of Blend_My_NFTs.") - print("") - print(bcolors.WARNING + "---config.py SETTINGS---" + bcolors.RESET) - print("NFTs Per Batch(nftsPerBatch): " + bcolors.WARNING + str(config.nftsPerBatch) + bcolors.RESET) - print("Image Name(imageName): " + bcolors.WARNING + config.nftName + bcolors.RESET) - print("Image File Format(imageFileFormat): " + bcolors.WARNING + config.imageFileFormat + bcolors.RESET) - print("Operating system: " + bcolors.WARNING + str(platform.system()) + bcolors.RESET) - print("Save Path(save_path): " + bcolors.WARNING + config.save_path + bcolors.RESET) - print("Possible DNA Combinations(possibleCombinations): " + bcolors.WARNING + str(possibleCombinations) + bcolors.RESET) - - remainder = config.maxNFTs % config.nftsPerBatch - Number_Of_Possible_Batches = (config.maxNFTs - remainder) / config.nftsPerBatch - - print("Max number of NFTs(maxNFTs): " + bcolors.WARNING + str(config.maxNFTs) + bcolors.RESET) - print("Number of possible batches: " + bcolors.WARNING + str(Number_Of_Possible_Batches) + bcolors.RESET) - - if remainder > 0: - print("One incomplete batch will have " + bcolors.WARNING + str(remainder) + bcolors.RESET + " DNA in it.") - elif remainder == 0: - print("There is no incomplete batch with this combination.") - - print("\nSettings:") - print("Reset viewport(enableResetViewport): " + bcolors.WARNING + str(config.enableResetViewport) + bcolors.RESET) - print("3D Models(enable3DModels): " + bcolors.WARNING + str(config.enable3DModels) + bcolors.RESET) - print("") - - if config.enable3DModels: - print("3D Model File Format(objectFormatExport): " + bcolors.WARNING + str(config.modelFileFormat) + bcolors.RESET) - - print("Generate Colours(enableGeneration): " + bcolors.WARNING + str(config.enableGeneration) + bcolors.RESET) - print("") - print("Colour List(colorList): \n" + bcolors.WARNING + str(config.colorList) + bcolors.RESET) - print("") - print("Rarity(enableRarity): " + bcolors.WARNING + str(config.enableRarity) + bcolors.RESET) - - if not config.enable3DModels: - RenderTest.imageRenderTest() - if config.enable3DModels: - print(f"{bcolors.WARNING} Cannot run Render Test when enable3DModels = True {bcolors.RESET}") - - -if __name__ == '__main__': - printImportant() - -# To run the following, run main.py with enableRarity = True in config.py: -# Somehow cross check percentage rarity of variant number in NFTRecord.json, iterate through all of them. Then print the -# percentage values that were generated relative to the ones set in .blend diff --git a/src/Utility_Scripts/RarityChecker.py b/src/Utility_Scripts/RarityChecker.py deleted file mode 100644 index 3f3e5b0..0000000 --- a/src/Utility_Scripts/RarityChecker.py +++ /dev/null @@ -1,102 +0,0 @@ -# Purpose: -# This file is run after the NFTRecord.json and Batch#.json files have been generated. It checks the percentage -# each variant is chosen in the NFTRecord, then compares it with its rarity percentage set in the .blend file. - -# Note - This file is provided for transparency. The accuracy of the rarity values you set in your .blend file as outlined -# in the README.md file are dependent on the maxNFTs, and the maximum number of combinations of your NFT collection. - -import bpy -import os -import sys -import json -import importlib -from collections import Counter -from collections import defaultdict - -dir = os.path.dirname(bpy.data.filepath) -sys.path.append(dir) -sys.modules.values() - -from src import config - -importlib.reload(config) - -class bcolors: - ''' - The colour of console messages. - ''' - OK = '\033[92m' # GREEN - WARNING = '\033[93m' # YELLOW - ERROR = '\033[91m' # RED - RESET = '\033[0m' # RESET COLOR - -def getRealRarity(): - file_name = os.path.join(config.save_path, "NFTRecord.json") - DataDictionary = json.load(open(file_name)) - numNFTsGenerated = DataDictionary["numNFTsGenerated"] - hierarchy = DataDictionary["hierarchy"] - DNAList = DataDictionary["DNAList"] - - attributeNames = [] - numDict = defaultdict(list) - - for i in hierarchy: - attributeNames.append(i) - - for i in DNAList: - dnaSplitList = i.split("-") - - for j, k in zip(dnaSplitList, attributeNames): - numDict[k].append(j) - - numDict = dict(numDict) - - for i in numDict: - count = dict(Counter(numDict[i])) - numDict[i] = count - - fullNumName = {} - - for i in hierarchy: - fullNumName[i] = {} - for j in hierarchy[i]: - variantNum = hierarchy[i][j]["number"] - - fullNumName[i][variantNum] = j - - completeData = {} - - for i, j in zip(fullNumName, numDict): - x = {} - - for k in fullNumName[i]: - - for l in numDict[j]: - if l == k: - name = fullNumName[i][k] - num = numDict[j][l] - x[name] = [(str(round(((num/numNFTsGenerated)*100), 2)) + "%"), str(num)] - - completeData[i] = x - - print(completeData) - - print(f"{bcolors.OK} Rarity Checker is active. These are the percentages for each variant per attribute you set in your .blend file:{bcolors.RESET}") - - for i in completeData: - print(i + ":") - for j in completeData[i]: - print(" " + j + ": " + completeData[i][j][0] + " Occurrences: " + completeData[i][j][1]) - - jsonMetaData = json.dumps(completeData, indent=1, ensure_ascii=True) - - with open(os.path.join(config.save_path, "RarityData.json"), 'w') as outfile: - outfile.write(jsonMetaData + '\n') - path = os.path.join(config.save_path, "RarityData.json") - print(f"{bcolors.OK}Rarity Data has been saved to {path}. {bcolors.RESET}") - - return - - -if __name__ == '__main__': - getRealRarity() diff --git a/src/Utility_Scripts/RenderTest.py b/src/Utility_Scripts/RenderTest.py deleted file mode 100644 index 86438ee..0000000 --- a/src/Utility_Scripts/RenderTest.py +++ /dev/null @@ -1,72 +0,0 @@ -# Purpose: -# This file allows you to test the time it takes to render an image, then calculate how long it will take to render all -# images specified in maxNFTs in config.py. - -import bpy -import os -import sys -import copy -import time -import shutil -import importlib - -dir = os.path.dirname(bpy.data.filepath) -sys.path.append(dir) -sys.modules.values() - -from src import config -from src.Main_Generators import Batch_Sorter, DNA_Generator, Exporter - -importlib.reload(config) -importlib.reload(DNA_Generator) -importlib.reload(Batch_Sorter) -importlib.reload(Exporter) - - -class bcolors: - ''' - The colour of console messages. - ''' - OK = '\033[92m' # GREEN - WARNING = '\033[93m' # YELLOW - ERROR = '\033[91m' # RED - RESET = '\033[0m' # RESET COLOR - -def imageRenderTest(): - originalMaxNFTs = copy.deepcopy(config.maxNFTs) - config.nftsPerBatch = config.maxNFTsTest - config.maxNFTs = config.maxNFTsTest - config.renderBatch = 1 - config.nftName = "TestImages" - - print(bcolors.WARNING + "\n---RUNNING IMAGE RENDER TEST---\n" + bcolors.RESET) - print("This test will render one image, record the time it took, then calculate the time to render") - print("the maxNFTs specified in config.py based on that image.") - print("*Please Note: All config.py settings will be preserved and the test image and batch folder will be") - print("deleted.") - - print(bcolors.WARNING + "\n---RUNNING DNA_Generator.py SHELL---\n" + bcolors.RESET) - DNA_Generator.send_To_Record_JSON() - - print(bcolors.WARNING + "\n---RUNNING Batch_Sorter.py SHELL---\n" + bcolors.RESET) - Batch_Sorter.makeBatches() - - fullRenderTime = time.time() - - print(bcolors.WARNING + "\n---RUNNING Exporter.py SHELL---\n" + bcolors.RESET) - Exporter.render_and_save_NFTs() - - print("Image(s) rendered in %.4f seconds" % (time.time() - fullRenderTime)) - print(bcolors.WARNING + "\nTime to render " + str(originalMaxNFTs) + " NFT Images: " + bcolors.RESET) - - renderMaxTime = str(((int(time.time() - fullRenderTime)) / int(config.maxNFTs)) * originalMaxNFTs) + "s" - - print(renderMaxTime) - - os.remove(os.path.join(config.batch_json_save_path, "Batch1.json")) - os.remove(os.path.join(config.save_path, "NFTRecord.json")) - shutil.rmtree(os.path.join(config.nft_save_path, "Batch1")) - - -if __name__ == '__main__': - imageRenderTest() diff --git a/src/config.py b/src/config.py deleted file mode 100644 index b0ef5e7..0000000 --- a/src/config.py +++ /dev/null @@ -1,169 +0,0 @@ -# Purpose: -# This file determines the settings of your NFT collection. Please read the README.md file to understand how to run this -# program. - -nftName = '' # The name of the NFT image produces by PNG-Generator - -maxNFTs = 0 # The maximum number of NFTs you want to generate. -nftsPerBatch = 0 # Number of NFTs per batch (Batches split maxNFTs into smaller manageable chunks) -renderBatch = 1 # The batch number to render in Exporter.py - -imageFileFormat = '' # Dictate the image extension when Blender renders the images -# Type the exact name provided below in the '' above: -# JPEG - Exports the .jpeg format -# PNG - Exports the .png format -# Visit https://docs.blender.org/api/current/bpy.types.Image.html#bpy.types.Image.file_format -# for a complete list of file formats supported by Blender. (Only use Image file extensions with imageFileFormat, 3D -# object, or animation file extensions will cause the program to fail) - -animationFileFormat = '' # Dictate the animations extension when Blender renders and compiles the images -# Type the exact name provided below in the '' above: -# AVI_JPEG - Exports the .avi jpeg format -# AVI_RAW - Exports the .avi raw format -# FFMPEG - Encodes the video using ffmpeg. Set your encoding settings in the Output Properties in Blender. Default is -# medium-quality .mp4 video. -# Visit https://docs.blender.org/api/current/bpy.types.Image.html#bpy.types.Image.file_format -# for a complete list of file formats supported by Blender. (These are the Blender only supported animation formats) - -modelFileFormat = '' # The file format of the objects you would like to export -# Type the exact name provided below in the '' above: -# fbx - The .FBX file format -# glb - The .glb file format -# obj - The .obj file format *Exports both a .obj and a .mtl files for the same generated object -# x3d - The .x3d file format -# Visit https://docs.blender.org/api/current/bpy.ops.export_scene.html?highlight=export_scene#module-bpy.ops.export_scene -# for a complete list of object formats supported by Blender. - -# The path to Blend_My_NFTs folder: -save_path_mac = '' -save_path_linux = '' -save_path_windows = r'' -# Place the path in the '', e.g: save_path_mac = '/Users/Path/to/Blend_My_NFTs' -# Example mac: /Users/Path/to/Blend_My_NFTs -# Example linux: /Users/Path/to/Blend_My_NFTs -# Example windows: C:\Users\Path\to\Blend_My_NFTs - -# Set to True to generate images or 3D models depending on your settings below when main.py is run in Blender. Only works -# if you have already generated NFTRecord.json and all batches. -enableExporter = False - -enableImages = False # Renders and exports Images when main.py is run in Blender if enableExporter = True -enableAnimations = False # Renders and exports Animations when main.py is run in Blender if enableExporter = True -enableModelsBlender = False # Generates 3D models when main.py is run in Blender if enableExporter = True -# ^^ Generates models with .blend file NOT external object library. - -# Enables Rarity_Sorter to weigh NFT DNA attributes and variants: -enableRarity = False -# generateColors must be turned off and enableMaxNFTs must be turned on. -# True = include weighted rarity percentages in NFTRecord.json calculations, -# False = Pure random selection of variants -# Note: The more attributes and variants you have, and by nature the more possible NFT combinations you have, the more -# accurate your percentages will be. - -refactorBatchOrder = False # When set to True, sorts, renames, and moves all NFTs files in all batches in NFT_Output -# folder to the Complete_Collection folder. -# After you generate all batches move them all to one computer and place them in the NFT_Output folder of Blend_My_NFTs. -# Run main.py with refactorBatchOrder set to True and all NFT files will be renamed and sorted into a folder called Complete_Collection. - -# Meta Data Templates - Run after refactorBatchOrder -# Set the following to True to generate the format of the Meta Data template for your NFTs blockchain. (You can use multiple) -cardanoMetaData = False # Cardano - Format Source: https://cips.cardano.org/cips/cip25/ -solanaMetaData = False # Solana - Format Source: https://docs.metaplex.com/nft-standard -erc721MetaData = False # Ethereum ERC721 - Format Source: https://docs.opensea.io/docs/metadata-standards - -turnNumsOff = True # When set to True, turns off the extension numbers representing order and rarity from the names of -# variants in meta Data. - -# NOTE: This is just the information Blend_My_NFTs can provide, you will have to add policy ID, URI information, etc -# yourself when you upload and mint your NFT collection. -# DISCLAIMER: These are only templates based on the common standards for the given blockchain, you will have to modify -# and fill them in with a script of your own when you mint your NFT collection. These metadata templates are only provided -# for your convenience and are as accurate to the standards above that I could make them. - -metaDataDescription = '' # The description of your NFT that will be inserted into its meta data - -# ADVANCED FEATURES: -### Select colour or material.### -# Object generation options: -enableGeneration = False # When set to true this applies the sets of colors listed below to the objects in the collections named below - -generationType = 'material' # You can either set 'color' or 'material' here. Type you set will correspond to following options. -# generationType = 'material' mode is experimental. Be sure that you back-up your file. -# You need to set materials as "fake user". Do not miss this step. Or your materials going to vanish after running this script. - -# The collections below are RGBA Color values. You can put as many or as little color values in these lists as you would like. -# You can create any number of rgbaColorLists and assign them to any number of collections that you would like. -# Each set of rgbaColorList1 assigned to an object by collection name in the colorList will act like an attribute and create a unique variant of that item. -rgbaColorList1 = [(1, 0, 0, 1), (0, 1, 0, 1), (0, 0, 1, 1), (1, 1, 1, 1), (.5, 0, 0, 1)] -rgbaColorList2 = [(1, 1, 0, 1), (0, 1, 1, 1), (.5, 0, 1, 1), (.5, 1, 1, 1), (0, .5, 0, 1)] -# The following color list can be as long or as short as you want it to be. -# To use this all you need to do is place the name of the collection you want colored in the "" and the set of colors you want to apply to it after the : -# The collection named can only contain objects and not sub collections. Every object in the collection will be set to the colors you assigned above for each attribute -if generationType == 'color': # Do not change this line. - colorList = {"Cube_1_33": rgbaColorList1, "Sphere_4_0": rgbaColorList2} - -### These materials must be in your Current Files' Materials. Make sure that you've set your materials as "fake user". ### -# The collections below are Current Files' Materials. You can put as many or as little materials values in these lists as you would like. -# You can create any number of materialLists and assign them to any number of collections that you would like. -# Each set of materialLists assigned to an object by collection name in the materialList will act like an attribute and create a unique variant of that item. -materialList1 = ['Material1', 'Material1.001', 'Material1.002', 'Material1.003', 'Material1.004'] -materialList2 = ['Material2', 'Material2.001', 'Material2.002', 'Material2.003', 'Material2.004'] - -# The following material list can be as long or as short as you want it to be. -# To use this all you need to do is place the name of the collection you want materials assigned in the "" and the set of materials you want to apply to it after the : -# The collection named can only contain objects and not sub collections. Every object in the collection will be set to the materials you assigned above for each attribute -if generationType == 'material': # Do not change this line. - colorList = {"Cube_1_33": materialList1, "Sphere_2_0": materialList2} - -enableResetViewport = True # If True: turns all viewport and render cameras on after Image_Generator is finished operations - -# 3D model imports and exports variables: -enable3DModels = False # Set to True if using external models as attributes instead of Blender objects -# ^Does not work with colour options and rarity, both must be turned off in order to use this. - -# Tests and Previews: - -# Preview and render test settings: -# Set to True to run Preview test, set to False to stop test. Run main.py in Blender to initiate the test. Results will -# be displayed in the Blender terminal or console. enableExporter must be False, and enableImages and/or enableModelsBlender -# to run a preview. -runPreview = False -maxNFTsTest = 5 # Increase to get a more accurate reading of the render time. The number of images generated in the render test. - -# Turn this on when you run main.py to generate NFTRecord.json and appropriate batches to confirm there are no duplicate -# NFT DNA. Note - This file is provided for transparency, it is impossible for duplicates to be made with the current code in -# DNA_Generator.py. -checkDups = False - -# Turn this on when running main.py to generate NFTRecord.json and Batch#.json files to record the rarity percentage of each variant. -# Note - This file is provided for transparency. The accuracy of the rarity values you set in your .blend file as outlined -# in the README.md file are dependent on the maxNFTs, and the maximum number of combinations of your NFT collection. -checkRarity = False - -# Utilities - DO NOT TOUCH: -import platform -import os - -# Save_path utilities and os compatibility -mac = 'Darwin' -linux = 'Linux' -windows = 'Windows' -save_path = None - -if platform.system() == mac: - save_path = save_path_mac -elif platform.system() == linux: - save_path = save_path_linux -elif platform.system() == windows: - save_path = save_path_windows - -# Paths to folders -batch_json_save_path = os.path.join(save_path, 'Batch_Json_files') # The output path for batches generated by Batch_Sorter.py -nft_save_path = os.path.join(save_path, 'NFT_Output') # The output path for images generated by Exporter.py -modelAssetPath = os.path.join(save_path, "3D_Model_Input") # The input path for 3D models -model_save_path = os.path.join(save_path, "3D_Model_Output") # The output path for 3D models generated by Model_Generator.py -model_Script_Ignore_Path = os.path.join(modelAssetPath, "Script_Ignore_Folder") # The path to the Script_Ignore_Folder for 3D models - -# error handling # -if modelFileFormat not in ['fbx', 'glb', 'obj', 'x3d'] and enable3DModels: - raise ValueError("Output format in `objectFormatExport` can only be 'fbx', 'glb', 'obj', 'x3d'.") diff --git a/src/main.py b/src/main.py deleted file mode 100644 index f4179d0..0000000 --- a/src/main.py +++ /dev/null @@ -1,65 +0,0 @@ -# Purpose: -# This file is the main file you run in Blender. - -import bpy -import os -import sys -import importlib - -dir = os.path.dirname(bpy.data.filepath) -sys.path.append(dir) -sys.modules.values() - -class bcolors: - ''' - The colour of console messages. - ''' - OK = '\033[92m' # GREEN - WARNING = '\033[93m' # YELLOW - ERROR = '\033[91m' # RED - RESET = '\033[0m' # RESET COLOR - -try: - from src import config - from src.Utility_Scripts import DuplicateChecker, RenderTest, Preview, BatchRefactorer, RarityChecker - from src.Model_Generators import Model_Generator - from src.Main_Generators import Batch_Sorter, DNA_Generator, Exporter - -except: - print(bcolors.ERROR + "ERROR:\nBlender cannot find the Blend_My_NFTs folder." + bcolors.RESET + "\nChange the " - "directory of your .blend file to be inside the Blend_My_NFTs-main folder. For more details see the README file: " - "https://github.com/torrinworx/Blend_My_NFTs\n\n") - -importlib.reload(config) -importlib.reload(DuplicateChecker) -importlib.reload(Model_Generator) -importlib.reload(Batch_Sorter) -importlib.reload(DNA_Generator) -importlib.reload(Preview) -importlib.reload(RenderTest) -importlib.reload(Exporter) -importlib.reload(BatchRefactorer) -importlib.reload(RarityChecker) - - -if not config.enableExporter and not config.runPreview and not config.refactorBatchOrder: - if config.enable3DModels: - Model_Generator.generate3DModels() - - if not config.enable3DModels: - DNA_Generator.send_To_Record_JSON() - Batch_Sorter.makeBatches() - if config.checkDups: - DuplicateChecker.checkDups() - -if config.enableExporter and not config.runPreview and not config.refactorBatchOrder: - Exporter.render_and_save_NFTs() - -if config.runPreview: - Preview.printImportant() - -if config.refactorBatchOrder: - BatchRefactorer.reformatNFTCollection() - -if config.checkRarity: - RarityChecker.getRealRarity()