├── .gitignore ├── LICENSE.txt ├── README.md ├── __init__.py ├── engine └── __init__.py ├── handlers └── __init__.py ├── nodes ├── __init__.py ├── comp │ ├── __init__.py │ └── mfb_comp_nodes_displayfilter.py ├── mfb_nodes.py └── shaders │ ├── __init__.py │ ├── mfb_lightshader_nodes_lightfilter.py │ ├── mfb_shader_nodes_displacement.py │ ├── mfb_shader_nodes_map.py │ ├── mfb_shader_nodes_normal.py │ ├── mfb_shader_nodes_output.py │ └── mfb_shader_nodes_shader.py ├── operators ├── __init__.py ├── io.py ├── node.py ├── sets.py └── userdata.py ├── preferences.py ├── properties.py ├── props ├── __init__.py ├── attributes.py ├── deep.py ├── meta.py ├── render_output.py ├── sets.py └── userdata.py └── ui ├── __init__.py ├── mfb_light.py ├── mfb_menus.py ├── mfb_node_menus.py ├── mfb_object.py ├── mfb_output.py ├── mfb_panel.py ├── mfb_render.py └── mfb_view_layer.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | parts/ 18 | sdist/ 19 | var/ 20 | wheels/ 21 | share/python-wheels/ 22 | *.egg-info/ 23 | .installed.cfg 24 | *.egg 25 | MANIFEST 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .nox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | *.py,cover 48 | .hypothesis/ 49 | .pytest_cache/ 50 | cover/ 51 | 52 | # Translations 53 | *.mo 54 | *.pot 55 | 56 | # Django stuff: 57 | *.log 58 | local_settings.py 59 | db.sqlite3 60 | db.sqlite3-journal 61 | 62 | # Flask stuff: 63 | instance/ 64 | .webassets-cache 65 | 66 | # Scrapy stuff: 67 | .scrapy 68 | 69 | # Sphinx documentation 70 | docs/_build/ 71 | 72 | # PyBuilder 73 | .pybuilder/ 74 | target/ 75 | 76 | # Jupyter Notebook 77 | .ipynb_checkpoints 78 | 79 | # IPython 80 | profile_default/ 81 | ipython_config.py 82 | 83 | # pyenv 84 | # For a library or package, you might want to ignore these files since the code is 85 | # intended to run in multiple environments; otherwise, check them in: 86 | # .python-version 87 | 88 | # pipenv 89 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 90 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 91 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 92 | # install all needed dependencies. 93 | #Pipfile.lock 94 | 95 | # poetry 96 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 97 | # This is especially recommended for binary packages to ensure reproducibility, and is more 98 | # commonly ignored for libraries. 99 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 100 | #poetry.lock 101 | 102 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 103 | __pypackages__/ 104 | 105 | # Celery stuff 106 | celerybeat-schedule 107 | celerybeat.pid 108 | 109 | # SageMath parsed files 110 | *.sage.py 111 | 112 | # Environments 113 | .env 114 | .venv 115 | env/ 116 | venv/ 117 | ENV/ 118 | env.bak/ 119 | venv.bak/ 120 | 121 | # Spyder project settings 122 | .spyderproject 123 | .spyproject 124 | 125 | # Rope project settings 126 | .ropeproject 127 | 128 | # mkdocs documentation 129 | /site 130 | 131 | # mypy 132 | .mypy_cache/ 133 | .dmypy.json 134 | dmypy.json 135 | 136 | # Pyre type checker 137 | .pyre/ 138 | 139 | # pytype static type analyzer 140 | .pytype/ 141 | 142 | # Cython debug symbols 143 | cython_debug/ 144 | 145 | # PyCharm 146 | # JetBrains specific template is maintainted in a separate JetBrains.gitignore that can 147 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 148 | # and can be added to the global gitignore or merged into this file. For a more nuclear 149 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 150 | #.idea/ 151 | 152 | 153 | ./install 154 | mfb/ 155 | .vs/ 156 | .vscode/ 157 | 158 | build/ 159 | build-deps/ 160 | deps/ 161 | source/ 162 | optix/ -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MoonRay for Blender 2 | 3 | MoonRay for Blender is a render engine addon which allows users to utilise Dreamworks' MoonRay Production Renderer inside of Blender. 4 | 5 | 6 |
7 | 8 | THIS ADDON IS CURRENTLY BROKEN. 9 | 10 |
11 | 12 | ## Installing 13 | 14 | To use, download the latest release of the MoonRayForBlender addon and save the zip file. 15 | 16 | Start Blender and from `File -> User Preferences -> Add-ons` install the zip file. 17 | 18 | You should then be able to select MoonRay in the render engines. 19 | 20 | ## Getting Help 21 | 22 | If you need help, report an issue and I will try to deal with it as soon as possible. 23 | 24 | ## Support 25 | 26 | * Blender 4.1.0 27 | 28 | Currently, this addon is not linked to MoonRay, due to issues with building the render engine. I'm currently waiting on the Dreamworks team to update moonray. 29 | 30 | 31 | ## Acknowledgements 32 | 33 | This code has been modified from: 34 | 35 | - [RenderManForBlender](https://github.com/prman-pixar/RenderManForBlender) 36 | 37 | - [BlendLuxCore](https://github.com/prman-pixar/RenderManForBlender) 38 | 39 | *MoonRayForBlender is in no way affiliated with DreamWorks or DreamWorks Animation* 40 | 41 | ## Contact 42 | 43 | MoonRay For Blender is written by me, Christopher Hosken. If you have any concerns, ideas, or would like to help with developing this addon you can get in contact with me here. 44 | 45 | - [hoskenchristopher@gmail.com](https://hoskenchristopher@gmail.com) 46 | - [LinkedIn](https://www.linkedin.com/in/christopher-hosken/) 47 | 48 | 49 | ## License 50 | 51 | GNU General Public License v3.0, see `LICENSE` for details. 52 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | import bpy, os 2 | 3 | bl_info = { 4 | "name" : "MoonRay For Blender", 5 | "author" : "Christopher Hosken", 6 | "version" : (1, 7, 0, 0), 7 | "blender" : (4, 4, 0), 8 | "description" : "Dreamworks' MoonRay Production Renderer integration into Blender", 9 | "warning" : "This Addon is currently under development", 10 | "support": "COMMUNITY", 11 | "doc_url": "https:bl//github.com/cjhosken/moonray_for_blender/wiki", 12 | "tracker_url": "https://github.com/cjhosken/moonray_for_blender/issues", 13 | "category" : "Render" 14 | } 15 | 16 | from . import properties, nodes, engine, ui, handlers, operators, props, preferences 17 | 18 | def register(): 19 | props.register() 20 | properties.register() 21 | preferences.register() 22 | engine.register() 23 | handlers.register() 24 | operators.register() 25 | nodes.register() 26 | ui.register() 27 | 28 | def unregister(): 29 | ui.unregister() 30 | nodes.unregister() 31 | operators.unregister() 32 | handlers.unregister() 33 | engine.unregister() 34 | preferences.unregister() 35 | properties.unregister() 36 | props.unregister() -------------------------------------------------------------------------------- /engine/__init__.py: -------------------------------------------------------------------------------- 1 | import bpy, os 2 | 3 | class MoonRayRenderEngine(bpy.types.HydraRenderEngine): 4 | bl_idname = "MOONRAY" 5 | bl_label = "MoonRay" 6 | bl_info = "Dreamworks' MoonRay Production Renderer integration" 7 | 8 | bl_use_preview = True 9 | bl_use_gpu_context = True 10 | bl_use_materialx = True 11 | 12 | bl_delegate_id = "HdMoonrayRendererPlugin" 13 | 14 | @classmethod 15 | def register(cls): 16 | import pxr.Plug 17 | rel = os.path.join(os.path.expanduser("~"), ".mfb","installs","openmoonray") 18 | 19 | os.environ["REL"] = rel 20 | 21 | # Set other environment variables using the expanded `REL` path 22 | os.environ["RDL2_DSO_PATH"] = os.path.join(rel, "rdl2dso.proxy") + ":" + os.path.join(rel, "rdl2dso") 23 | os.environ['ARRAS_SESSION_PATH'] = os.path.join(rel, "sessions") 24 | os.environ["MOONRAY_CLASS_PATH"] = os.path.join(rel, "shader_json") 25 | 26 | # Update PATH and PXR_PLUGINPATH_NAME by expanding the current environment variables 27 | os.environ["PATH"] = os.path.join(rel, "bin") + ":" + os.environ.get("PATH", "") 28 | 29 | os.environ["PXR_PLUGINPATH_NAME"] = os.path.join(rel, "plugin", "usd") + ":" + os.environ.get("PXR_PLUGINPATH_NAME", "") 30 | 31 | #os.environ["HDMOONRAY_DEBUG_MODE"] = "1" 32 | #os.environ["HDMOONRAY_DEBUG"] = "1" 33 | #os.environ["HDMOONRAY_INFO"] = "1" 34 | #os.environ["HDMOONRAY_DISABLE"]="0" 35 | #os.environ["HDMOONRAY_RDLA_OUTPUT"]="temp" 36 | 37 | pxr.Plug.Registry().RegisterPlugins([os.path.join(rel, "plugin", "pxr")]) 38 | 39 | 40 | def get_render_settings(self, engine_type): 41 | moonray = bpy.context.scene.moonray 42 | 43 | result = { 44 | 'volumeRaymarchingStepSize': 2.0, 45 | 'volumeRaymarchingStepSizeLighting': 3.0, 46 | 47 | "houdini:interactive": False, 48 | 49 | 50 | "sceneVariable:min_frame": 0.0, 51 | "sceneVariable:max_frame": 0.0, 52 | 53 | "sceneVariable:frame": 0.0, 54 | 55 | "sceneVariable:dicing_camera": None, 56 | "sceneVariable_dicing_camera": None, 57 | 58 | "sceneVariable:exr_header_attributes": None, # {"name", "type". "value"} 59 | "sceneVariable_exr_header_attributes": None, # {"name", "type". "value"} 60 | "sceneVariable:res": 1.0, 61 | 62 | "sceneVariable:aperture_window": {0, 0, 1280, 720}, 63 | "sceneVariable_aperture_window": {0, 0, 1280, 720}, 64 | 65 | "sceneVariable:region_window": {}, 66 | "sceneVariable_region_window": {}, 67 | 68 | "sceneVariable:sub_viewport": {0, 0}, 69 | "sceneVariable_sub_viewport": {0, 0}, 70 | 71 | "sceneVariable:fps": 24.0, 72 | "sceneVariable:scene_scale": 0.01, 73 | "sceneVariable:sampling_mode": 0, # (0:uniform (default), 2:adaptive) 74 | "sceneVariable:min_adaptive_samples": 16, 75 | "sceneVariable:max_adaptive_samples": 4096, 76 | 77 | "sceneVariable:target_adaptive_error": 10.0, 78 | 79 | "sceneVariable:light_sampling_mode": 0, # (0:uniform (default), 1:adaptive) 80 | "sceneVariable:light_sampling_quality": 0.5, 81 | 82 | "sceneVariable:russian_roulette_threshold": 0.0375, 83 | 84 | 85 | "sceneVariable:pixel_samples": 8, 86 | "sceneVariable:light_samples": 2, 87 | "sceneVariable:bsdf_samples": 2, 88 | "sceneVariable:bssrdf_samples": 2, 89 | 90 | "sceneVariable:max_depth": 5, 91 | "sceneVariable:max_diffuse_depth": 2, 92 | "sceneVariable:max_glossy_depth": 2, 93 | "sceneVariable:max_mirror_depth": 3, 94 | "sceneVariable:max_volume_depth": 1, 95 | "sceneVariable:max_presence_depth": 16, 96 | "sceneVariable:max_hair_depth": 5, 97 | 98 | "sceneVariable:disable_optimized_hair_sampling": False, 99 | "sceneVariable:max_subsurface_per_path": 1, 100 | "sceneVariable:transparency_threshold": 1.0, 101 | "sceneVariable:presence_threshold": 0.999, 102 | "sceneVariable:lock_frame_noise": False, 103 | "sceneVariable:volume_quality": 0.5, 104 | "sceneVariable:volume_shadow_quality": 1.0, 105 | 106 | "sceneVariable:volume_illumination_samples": 4, 107 | 108 | "sceneVariable:volume_opacity_threshold": 0.995, 109 | "sceneVariable:volume_overlap_mode": 0, # (0:sum (default), 1: max, 2: rnd) 110 | "sceneVariable:volume_attenuation_factor": 0.65, 111 | 112 | "sceneVariable:volume_contribution_factor": 0.65, 113 | "sceneVariable:volume_phase_attenuation_factor": 0.5, 114 | 115 | "sceneVariable:path_guide_enable": False, 116 | 117 | "sceneVariable:sample_clamping_value": 10.0, 118 | "sceneVariable:sample_clamping_depth": 1, 119 | 120 | "sceneVariable:roughness_clamping_factor": 0.0, 121 | "sceneVariable:texture_blur": 0.0, 122 | 123 | "sceneVariable:pixel_filter_width": 3.0, 124 | "sceneVariable:pixel_filter": 1, # (0: box, 1: cubic b-spline (default), 2: quadratic b-spline) 125 | 126 | "sceneVariable:deep_format": 1, # (0: openexr2.0, 1: opencx2.0 (default)) 127 | "sceneVariable:deep_curvature_tolerance": 45.0, 128 | 129 | "sceneVariable:deep_z_tolerance": 2.0, 130 | 131 | "sceneVariable:deep_vol_compression_res": 10, 132 | 133 | "sceneVariable:deep_id_attribute_names": {}, 134 | "sceneVariable_deep_id_attribute_names": {}, 135 | 136 | "sceneVariable:texture_cache_size": 4000, 137 | 138 | "sceneVariable:crypto_uv_attribute_name": "", 139 | "sceneVariable:texture_file_handles": 24000, 140 | 141 | "sceneVariable:fast_geometry_update": False, 142 | 143 | "sceneVariable:checkpoint_active": False, 144 | "sceneVariable:checkpoint_interval": 15.0, 145 | "sceneVariable:checkpoint_quality_steps": 2, 146 | "sceneVariable:checkpoint_time_cap": 0.0, 147 | "sceneVariable:checkpoint_sample_cap": 0, 148 | "sceneVariable:checkpoint_overwrite": True, 149 | "sceneVariable:checkpoint_mode": 0, # (0: time (default), 1: quality) 150 | "sceneVariable:checkpoint_start_sample": 1, 151 | "sceneVariable:checkpoint_bg_write": True, 152 | "sceneVariable:checkpoint_post_script": "", 153 | "sceneVariable:checkpoint_total_files": 0, 154 | "sceneVariable:checkpoint_max_bgcache": 2, 155 | "sceneVariable:checkpoint_max_snapshot_overhead": 0.0, 156 | 157 | "sceneVariable:checkpoint_snapshot_interval": 0.0, 158 | "sceneVariable:resumable_output": False, 159 | "sceneVariable:resume_render": False, 160 | "sceneVariable:on_resume_script": "", 161 | "sceneVariable:enable_dof": True, 162 | "sceneVariable:enable_max_geometry_resolution": False, 163 | "sceneVariable:max_geometry_resolution": 2147483647, 164 | "sceneVariable:enable_displacement": True, 165 | "sceneVariable:enable_subsurface_scattering": True, 166 | "sceneVariable:enable_shadowing": True, 167 | "sceneVariable:enable_presence_shadows": False, 168 | "sceneVariable:lights_visible_in_camera": 1, 169 | "sceneVariable:propagate_visibility_bounce_type": False, 170 | "sceneVariable:shadow_terminator_fix": 0, # (0: off (default), 1: on, 2: on (sine compensation alternative), 3: on (GGX compensation alternative), 4: on (Cosine compensation alternative)) 171 | "sceneVariable:machine_id": -1, 172 | "sceneVariable:num_machines": -1, 173 | "sceneVariable:task_distribution_type": 1, # (0: non-overlapped tile, 1: multiplex pixel (default)) 174 | "sceneVariable:batch_tile_order": 4, # (0:top,1:bottom,2:left,3:right,4:morton(default),5:random,6:spiralsquare,7:spiralrect,8:moronshiftflip) 175 | "sceneVariable:progressive_tile_order": 4, # (0:top,1:bottom,2:left,3:right,4:morton(default),5:random,6:spiralsquare,7:spiralrect,8:moronshiftflip) 176 | "sceneVariable:checkpoint_tile_order": 4, # (0:top,1:bottom,2:left,3:right,4:morton(default),5:random,6:spiralsquare,7:spiralrect,8:moronshiftflip) 177 | "sceneVariable:output_file": "", 178 | "sceneVariable:tmp_dir": "", 179 | "sceneVariable:two_stage_output": True, 180 | "sceneVariable:log_debug": False, 181 | "sceneVariable:log_info": False, 182 | 183 | "sceneVariable:fatal_color": [1, 0, 1], 184 | "sceneVariable_fatal_color": [1, 0, 1], 185 | 186 | "sceneVariable:stats_file": "", 187 | "sceneVariable:athena_debug": False, 188 | 189 | "sceneVariable:debug_pixel": {}, 190 | "sceneVariable_debug_pixel": {}, 191 | 192 | "sceneVariable:debug_rays_file": "", 193 | 194 | "sceneVariable:debug_rays_primary_range": {}, 195 | "sceneVariable_debug_rays_primary_range": {}, 196 | 197 | "sceneVariable:debug_rays_depth_range": {}, 198 | "sceneVariable_debug_rays_depth_range": {}, 199 | 200 | "sceneVariable:debug_console": -1, 201 | "sceneVariable:validate_geometry": False, 202 | "sceneVariable:cryptomatte_multi_presence": False 203 | 204 | 205 | 206 | } 207 | 208 | 209 | # 210 | # There's also these controls for the objects, but im not so sure how to transfer that data over. 211 | # 212 | # moonray:visible_in_camera 213 | # moonray:visible_shadow 214 | # moonray:visible_diffuse_reflection 215 | # moonray:visible_diffuse_transmission 216 | # moonray:visible_glossy_reflection 217 | # moonray:visible_glossy_transmission 218 | # moonray:visible_mirror_reflection 219 | # moonray:visible_mirror_transmission 220 | # moonray:visible_volume 221 | # moonray:side_type 222 | 223 | return result 224 | 225 | def update_render_passes(self, scene, render_layer): 226 | if render_layer.use_pass_z: 227 | self.register_pass(scene, render_layer, 'Depth', 1, 'Z', 'VALUE') 228 | 229 | def update(self, data, depsgraph): 230 | super().update(data, depsgraph) 231 | 232 | 233 | def register(): 234 | bpy.utils.register_class(MoonRayRenderEngine) 235 | 236 | def unregister(): 237 | bpy.utils.unregister_class(MoonRayRenderEngine) -------------------------------------------------------------------------------- /handlers/__init__.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | 3 | from ..engine import MoonRayRenderEngine 4 | 5 | def add_moonray_output_to_materials(scene): 6 | if scene.render.engine == 'MOONRAY': # Assuming 'MOONRAY' is the identifier for MoonRayRenderEngine 7 | # Add MoonRayShaderNode_Output for object materials 8 | for obj in bpy.data.objects: 9 | if obj.type == 'MESH' and obj.data.materials: 10 | for mat_slot in obj.material_slots: 11 | mat = mat_slot.material 12 | if not mat.use_nodes: 13 | mat.use_nodes = True 14 | node_tree = mat.node_tree 15 | nodes = node_tree.nodes 16 | 17 | # Check if a MoonRayShaderNode_Output already exists 18 | if not any(node.bl_idname == 'MoonRayShaderNode_Output' for node in nodes): 19 | output_node = nodes.new(type='MoonRayShaderNode_Output') 20 | output_node.location = (400, 0) 21 | 22 | # Add MoonRayShaderNode_Output for world materials 23 | world = bpy.context.scene.world 24 | if world: 25 | if not world.use_nodes: 26 | world.use_nodes = True 27 | node_tree = world.node_tree 28 | nodes = node_tree.nodes 29 | 30 | # Check if a MoonRayShaderNode_Output already exists 31 | if not any(node.bl_idname == 'MoonRayWorldShaderNode_Output' for node in nodes): 32 | output_node = nodes.new(type='MoonRayWorldShaderNode_Output') 33 | output_node.location = (400, 0) 34 | 35 | 36 | 37 | def register(): 38 | bpy.app.handlers.depsgraph_update_post.append(add_moonray_output_to_materials) 39 | 40 | def unregister(): 41 | try: 42 | bpy.app.handlers.depsgraph_update_post.remove(add_moonray_output_to_materials) 43 | except: 44 | pass -------------------------------------------------------------------------------- /nodes/__init__.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from bpy.types import NodeTree, Node, NodeSocket 3 | from nodeitems_utils import NodeItem 4 | 5 | from . import shaders 6 | from . import comp 7 | # Register the custom shader node 8 | def register(): 9 | shaders.register() 10 | comp.register() 11 | 12 | def unregister(): 13 | shaders.unregister() 14 | comp.unregister() -------------------------------------------------------------------------------- /nodes/comp/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | import bpy 3 | 4 | from . import mfb_comp_nodes_displayfilter 5 | 6 | 7 | def register(): 8 | mfb_comp_nodes_displayfilter.register() 9 | 10 | def unregister(): 11 | mfb_comp_nodes_displayfilter.unregister() -------------------------------------------------------------------------------- /nodes/comp/mfb_comp_nodes_displayfilter.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from ..mfb_nodes import MoonRayCompNode 3 | 4 | class MoonRayCompNode_DisplayFilter(MoonRayCompNode): 5 | bl_idname = 'MoonRayCompNode_DisplayFilter' 6 | bl_label = 'MoonRay DisplayFilter' 7 | 8 | def init(self, context): 9 | pass 10 | 11 | def update(self): 12 | pass 13 | 14 | 15 | class MoonRayCompNode_BlendDisplayFilter(MoonRayCompNode): 16 | bl_idname = 'MoonRayCompNode_BlendDisplayFilter' 17 | bl_label = 'Blend Display' 18 | 19 | def init(self, context): 20 | pass 21 | 22 | def update(self): 23 | pass 24 | 25 | class MoonRayCompNode_ClampDisplayFilter(MoonRayCompNode): 26 | bl_idname = 'MoonRayCompNode_ClampDisplayFilter' 27 | bl_label = 'Clamp Display' 28 | 29 | def init(self, context): 30 | pass 31 | 32 | def update(self): 33 | pass 34 | 35 | class MoonRayCompNode_ColorCorrectDisplayFilter(MoonRayCompNode): 36 | bl_idname = 'MoonRayCompNode_ColorCorrectDisplayFilter' 37 | bl_label = 'Color Correct Display' 38 | 39 | def init(self, context): 40 | pass 41 | 42 | def update(self): 43 | pass 44 | 45 | class MoonRayCompNode_ConstantDisplayFilter(MoonRayCompNode): 46 | bl_idname = 'MoonRayCompNode_ConstantDisplayFilter' 47 | bl_label = 'Constant Display' 48 | 49 | def init(self, context): 50 | pass 51 | 52 | def update(self): 53 | pass 54 | 55 | class MoonRayCompNode_ConvolutionDisplayFilter(MoonRayCompNode): 56 | bl_idname = 'MoonRayCompNode_ConvolutionDisplayFilter' 57 | bl_label = 'Convolution Display' 58 | 59 | def init(self, context): 60 | pass 61 | 62 | def update(self): 63 | pass 64 | 65 | class MoonRayCompNode_DiscretizeDisplayFilter(MoonRayCompNode): 66 | bl_idname = 'MoonRayCompNode_DiscretizeDisplayFilter' 67 | bl_label = 'Discretize Display' 68 | 69 | def init(self, context): 70 | pass 71 | 72 | def update(self): 73 | pass 74 | 75 | class MoonRayCompNode_DofDisplayFilter(MoonRayCompNode): 76 | bl_idname = 'MoonRayCompNode_DofDisplayFilter' 77 | bl_label = 'DOF Display' 78 | 79 | def init(self, context): 80 | pass 81 | 82 | def update(self): 83 | pass 84 | 85 | class MoonRayCompNode_HalftoneDisplayFilter(MoonRayCompNode): 86 | bl_idname = 'MoonRayCompNode_HalftoneDisplayFilter' 87 | bl_label = 'Halftone Display' 88 | 89 | def init(self, context): 90 | pass 91 | 92 | def update(self): 93 | pass 94 | 95 | class MoonRayCompNode_ImageDisplayFilter(MoonRayCompNode): 96 | bl_idname = 'MoonRayCompNode_ImageDisplayFilter' 97 | bl_label = 'Image Display' 98 | 99 | def init(self, context): 100 | pass 101 | 102 | def update(self): 103 | pass 104 | 105 | class MoonRayCompNode_OpDisplayFilter(MoonRayCompNode): 106 | bl_idname = 'MoonRayCompNode_OpDisplayFilter' 107 | bl_label = 'Op Display' 108 | 109 | def init(self, context): 110 | pass 111 | 112 | def update(self): 113 | pass 114 | 115 | class MoonRayCompNode_OverDisplayFilter(MoonRayCompNode): 116 | bl_idname = 'MoonRayCompNode_OverDisplayFilter' 117 | bl_label = 'Over Display' 118 | 119 | def init(self, context): 120 | pass 121 | 122 | def update(self): 123 | pass 124 | 125 | class MoonRayCompNode_RampDisplayFilter(MoonRayCompNode): 126 | bl_idname = 'MoonRayCompNode_RampDisplayFilter' 127 | bl_label = 'Ramp Display' 128 | 129 | def init(self, context): 130 | pass 131 | 132 | def update(self): 133 | pass 134 | 135 | class MoonRayCompNode_RemapDisplayFilter(MoonRayCompNode): 136 | bl_idname = 'MoonRayCompNode_RemapDisplayFilter' 137 | bl_label = 'Remap Display' 138 | 139 | def init(self, context): 140 | pass 141 | 142 | def update(self): 143 | pass 144 | 145 | class MoonRayCompNode_RgbToFloatDisplayFilter(MoonRayCompNode): 146 | bl_idname = 'MoonRayCompNode_RgbToFloatDisplayFilter' 147 | bl_label = 'RGB to Float Display' 148 | 149 | def init(self, context): 150 | pass 151 | 152 | def update(self): 153 | pass 154 | 155 | class MoonRayCompNode_RgbToHsvDisplayFilter(MoonRayCompNode): 156 | bl_idname = 'MoonRayCompNode_RgbToHsvDisplayFilter' 157 | bl_label = 'RGB to HSV Display' 158 | 159 | def init(self, context): 160 | pass 161 | 162 | def update(self): 163 | pass 164 | 165 | class MoonRayCompNode_ShadowDisplayFilter(MoonRayCompNode): 166 | bl_idname = 'MoonRayCompNode_ShadowDisplayFilter' 167 | bl_label = 'Shadow Display' 168 | 169 | def init(self, context): 170 | pass 171 | 172 | def update(self): 173 | pass 174 | 175 | class MoonRayCompNode_TangentSpaceDisplayFilter(MoonRayCompNode): 176 | bl_idname = 'MoonRayCompNode_TangentSpaceDisplayFilter' 177 | bl_label = 'Tangent Space Display' 178 | 179 | def init(self, context): 180 | pass 181 | 182 | def update(self): 183 | pass 184 | 185 | class MoonRayCompNode_ToonDisplayFilter(MoonRayCompNode): 186 | bl_idname = 'MoonRayCompNode_ToonDisplayFilter' 187 | bl_label = 'Toon Display' 188 | 189 | def init(self, context): 190 | pass 191 | 192 | def update(self): 193 | pass 194 | 195 | classes = [ 196 | MoonRayCompNode_BlendDisplayFilter, 197 | MoonRayCompNode_ClampDisplayFilter, 198 | MoonRayCompNode_ColorCorrectDisplayFilter, 199 | MoonRayCompNode_ConstantDisplayFilter, 200 | MoonRayCompNode_ConvolutionDisplayFilter, 201 | MoonRayCompNode_DiscretizeDisplayFilter, 202 | MoonRayCompNode_DofDisplayFilter, 203 | MoonRayCompNode_HalftoneDisplayFilter, 204 | MoonRayCompNode_ImageDisplayFilter, 205 | MoonRayCompNode_OpDisplayFilter, 206 | MoonRayCompNode_OverDisplayFilter, 207 | MoonRayCompNode_RampDisplayFilter, 208 | MoonRayCompNode_RemapDisplayFilter, 209 | MoonRayCompNode_RgbToFloatDisplayFilter, 210 | MoonRayCompNode_RgbToHsvDisplayFilter, 211 | MoonRayCompNode_ShadowDisplayFilter, 212 | MoonRayCompNode_TangentSpaceDisplayFilter, 213 | MoonRayCompNode_ToonDisplayFilter, 214 | ] 215 | 216 | def register(): 217 | for cls in classes: 218 | bpy.utils.register_class(cls) 219 | 220 | def unregister(): 221 | for cls in reversed(classes): 222 | bpy.utils.unregister_class(cls) 223 | -------------------------------------------------------------------------------- /nodes/mfb_nodes.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | 3 | class MoonRayShaderNode(bpy.types.ShaderNode): 4 | bl_idname = 'MoonRayShaderNode' 5 | bl_label = 'MoonRay Shader Node' 6 | 7 | def init(self, context): 8 | pass 9 | 10 | def update(self): 11 | pass 12 | 13 | class MoonRayCompNode(bpy.types.CompositorNode): 14 | bl_idname = 'MoonRayCompNode' 15 | bl_label = 'MoonRay Comp Node' 16 | 17 | def init(self, context): 18 | pass 19 | 20 | def update(self): 21 | pass -------------------------------------------------------------------------------- /nodes/shaders/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | import bpy 3 | 4 | from . import mfb_shader_nodes_shader 5 | from . import mfb_shader_nodes_output 6 | from . import mfb_shader_nodes_displacement 7 | from . import mfb_shader_nodes_normal 8 | from . import mfb_shader_nodes_map 9 | 10 | from . import mfb_lightshader_nodes_lightfilter 11 | 12 | def register(): 13 | mfb_shader_nodes_shader.register() 14 | mfb_shader_nodes_output.register() 15 | mfb_shader_nodes_displacement.register() 16 | mfb_shader_nodes_normal.register() 17 | mfb_shader_nodes_map.register() 18 | 19 | mfb_lightshader_nodes_lightfilter.register() 20 | 21 | def unregister(): 22 | mfb_shader_nodes_shader.unregister() 23 | mfb_shader_nodes_output.unregister() 24 | mfb_shader_nodes_displacement.unregister() 25 | mfb_shader_nodes_normal.unregister() 26 | mfb_shader_nodes_map.unregister() 27 | 28 | mfb_lightshader_nodes_lightfilter.unregister() -------------------------------------------------------------------------------- /nodes/shaders/mfb_lightshader_nodes_lightfilter.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from ..mfb_nodes import MoonRayShaderNode 3 | 4 | class MoonRayLightShaderNode_BarnDoorLightFilter(MoonRayShaderNode): 5 | bl_idname = 'MoonRayLightShaderNode_BarnDoorLightFilter' 6 | bl_label = 'Barn Door' 7 | 8 | def init(self, context): 9 | pass 10 | 11 | def update(self): 12 | pass 13 | 14 | class MoonRayLightShaderNode_ColorRampLightFilter(MoonRayShaderNode): 15 | bl_idname = 'MoonRayLightShaderNode_ColorRampLightFilter' 16 | bl_label = 'Color Ramp Light Filter' 17 | 18 | def init(self, context): 19 | pass 20 | 21 | def update(self): 22 | pass 23 | 24 | class MoonRayLightShaderNode_CombineLightFilter(MoonRayShaderNode): 25 | bl_idname = 'MoonRayLightShaderNode_CombineLightFilter' 26 | bl_label = 'Combine Light Filter' 27 | 28 | def init(self, context): 29 | pass 30 | 31 | def update(self): 32 | pass 33 | 34 | class MoonRayLightShaderNode_CookieLightFilter(MoonRayShaderNode): 35 | bl_idname = 'MoonRayLightShaderNode_CookieLightFilter' 36 | bl_label = 'Cookie Light Filter' 37 | 38 | def init(self, context): 39 | pass 40 | 41 | def update(self): 42 | pass 43 | 44 | class MoonRayLightShaderNode_CookieLightFilter_v2(MoonRayShaderNode): 45 | bl_idname = 'MoonRayLightShaderNode_CookieLightFilter_v2' 46 | bl_label = 'Cookie Light Filter v2' 47 | 48 | def init(self, context): 49 | pass 50 | 51 | def update(self): 52 | pass 53 | 54 | class MoonRayLightShaderNode_DecayLightFilter(MoonRayShaderNode): 55 | bl_idname = 'MoonRayLightShaderNode_DecayLightFilter' 56 | bl_label = 'Decay Light Filter' 57 | 58 | def init(self, context): 59 | pass 60 | 61 | def update(self): 62 | pass 63 | 64 | class MoonRayLightShaderNode_IntensityLightFilter(MoonRayShaderNode): 65 | bl_idname = 'MoonRayLightShaderNode_IntensityLightFilter' 66 | bl_label = 'Intensity Light Filter' 67 | 68 | def init(self, context): 69 | pass 70 | 71 | def update(self): 72 | pass 73 | 74 | class MoonRayLightShaderNode_RodLightFilter(MoonRayShaderNode): 75 | bl_idname = 'MoonRayLightShaderNode_RodLightFilter' 76 | bl_label = 'Rod Light Filter' 77 | 78 | def init(self, context): 79 | pass 80 | 81 | def update(self): 82 | pass 83 | 84 | class MoonRayLightShaderNode_VdbLightFilter(MoonRayShaderNode): 85 | bl_idname = 'MoonRayLightShaderNode_VdbLightFilter' 86 | bl_label = 'Vdb Light Filter' 87 | 88 | def init(self, context): 89 | pass 90 | 91 | def update(self): 92 | pass 93 | 94 | classes = [ 95 | MoonRayLightShaderNode_BarnDoorLightFilter, 96 | MoonRayLightShaderNode_ColorRampLightFilter, 97 | MoonRayLightShaderNode_CombineLightFilter, 98 | MoonRayLightShaderNode_CookieLightFilter, 99 | MoonRayLightShaderNode_CookieLightFilter_v2, 100 | MoonRayLightShaderNode_DecayLightFilter, 101 | MoonRayLightShaderNode_IntensityLightFilter, 102 | MoonRayLightShaderNode_RodLightFilter, 103 | MoonRayLightShaderNode_VdbLightFilter 104 | ] 105 | 106 | def register(): 107 | for cls in classes: 108 | bpy.utils.register_class(cls) 109 | 110 | def unregister(): 111 | for cls in reversed(classes): 112 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /nodes/shaders/mfb_shader_nodes_displacement.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from ..mfb_nodes import MoonRayShaderNode 3 | 4 | class MoonRayShaderNode_CombineDisplacement(MoonRayShaderNode): 5 | bl_idname = 'MoonRayShaderNode_CombineDisplacement' 6 | bl_label = 'Combine Displacement' 7 | 8 | def init(self, context): 9 | pass 10 | 11 | def update(self): 12 | pass 13 | 14 | class MoonRayShaderNode_NormalDisplacement(MoonRayShaderNode): 15 | bl_idname = 'MoonRayShaderNode_NormalDisplacement' 16 | bl_label = 'Normal Displacement' 17 | 18 | def init(self, context): 19 | pass 20 | 21 | def update(self): 22 | pass 23 | 24 | class MoonRayShaderNode_SwitchDisplacement(MoonRayShaderNode): 25 | bl_idname = 'MoonRayShaderNode_SwitchDisplacement' 26 | bl_label = 'Switch Displacement' 27 | 28 | def init(self, context): 29 | pass 30 | 31 | def update(self): 32 | pass 33 | 34 | class MoonRayShaderNode_VectorDisplacement(MoonRayShaderNode): 35 | bl_idname = 'MoonRayShaderNode_VectorDisplacement' 36 | bl_label = 'Vector Displacement' 37 | 38 | def init(self, context): 39 | pass 40 | 41 | def update(self): 42 | pass 43 | 44 | 45 | classes = [ 46 | MoonRayShaderNode_CombineDisplacement, 47 | MoonRayShaderNode_NormalDisplacement, 48 | MoonRayShaderNode_SwitchDisplacement, 49 | MoonRayShaderNode_VectorDisplacement 50 | ] 51 | 52 | def register(): 53 | for cls in classes: 54 | bpy.utils.register_class(cls) 55 | 56 | def unregister(): 57 | for cls in reversed(classes): 58 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /nodes/shaders/mfb_shader_nodes_map.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from ..mfb_nodes import MoonRayShaderNode 3 | 4 | class MoonRayShaderNode_Map_Attribute(MoonRayShaderNode): 5 | bl_idname = 'MoonRayShaderNode_Map_Attribute' 6 | bl_label = 'Attribute Node' 7 | 8 | def init(self, context): 9 | pass 10 | 11 | def update(self): 12 | pass 13 | 14 | class MoonRayShaderNode_Map_Debug(MoonRayShaderNode): 15 | bl_idname = 'MoonRayShaderNode_Map_Debug' 16 | bl_label = 'Debug Node' 17 | 18 | def init(self, context): 19 | pass 20 | 21 | def update(self): 22 | pass 23 | 24 | class MoonRayShaderNode_Map_List(MoonRayShaderNode): 25 | bl_idname = 'MoonRayShaderNode_Map_List' 26 | bl_label = 'List Node' 27 | 28 | def init(self, context): 29 | pass 30 | 31 | def update(self): 32 | pass 33 | 34 | class MoonRayShaderNode_Map_UsdPrimvarReader_float2(MoonRayShaderNode): 35 | bl_idname = 'MoonRayShaderNode_Map_UsdPrimvarReader_float2' 36 | bl_label = 'UsdPrimvarReader Float2 Node' 37 | 38 | def init(self, context): 39 | pass 40 | 41 | def update(self): 42 | pass 43 | 44 | class MoonRayShaderNode_Map_UsdPrimvarReader_point(MoonRayShaderNode): 45 | bl_idname = 'MoonRayShaderNode_Map_UsdPrimvarReader_point' 46 | bl_label = 'UsdPrimvarReader Point Node' 47 | 48 | def init(self, context): 49 | pass 50 | 51 | def update(self): 52 | pass 53 | 54 | class MoonRayShaderNode_Map_UsdUVTexture(MoonRayShaderNode): 55 | bl_idname = 'MoonRayShaderNode_Map_UsdUVTexture' 56 | bl_label = 'UsdUVTexture Node' 57 | 58 | def init(self, context): 59 | pass 60 | 61 | def update(self): 62 | pass 63 | 64 | class MoonRayShaderNode_Map_Checkerboard(MoonRayShaderNode): 65 | bl_idname = 'MoonRayShaderNode_Map_Checkerboard' 66 | bl_label = 'Checkerboard Node' 67 | 68 | def init(self, context): 69 | pass 70 | 71 | def update(self): 72 | pass 73 | 74 | class MoonRayShaderNode_Map_ExtraAov(MoonRayShaderNode): 75 | bl_idname = 'MoonRayShaderNode_Map_ExtraAov' 76 | bl_label = 'ExtraAov Node' 77 | 78 | def init(self, context): 79 | pass 80 | 81 | def update(self): 82 | pass 83 | 84 | class MoonRayShaderNode_Map_UsdPrimvarReader_float3(MoonRayShaderNode): 85 | bl_idname = 'MoonRayShaderNode_Map_UsdPrimvarReader_float3' 86 | bl_label = 'UsdPrimvarReader Float3 Node' 87 | 88 | def init(self, context): 89 | pass 90 | 91 | def update(self): 92 | pass 93 | 94 | class MoonRayShaderNode_Map_UsdPrimvarReader_vector(MoonRayShaderNode): 95 | bl_idname = 'MoonRayShaderNode_Map_UsdPrimvarReader_vector' 96 | bl_label = 'UsdPrimvarReader Vector Node' 97 | 98 | def init(self, context): 99 | pass 100 | 101 | def update(self): 102 | pass 103 | 104 | class MoonRayShaderNode_Map_Image(MoonRayShaderNode): 105 | bl_idname = 'MoonRayShaderNode_Map_Image' 106 | bl_label = 'Image Node' 107 | 108 | def init(self, context): 109 | pass 110 | 111 | def update(self): 112 | pass 113 | 114 | class MoonRayShaderNode_Map_UsdPrimvarReader_float(MoonRayShaderNode): 115 | bl_idname = 'MoonRayShaderNode_Map_UsdPrimvarReader_float' 116 | bl_label = 'UsdPrimvarReader Float Node' 117 | 118 | def init(self, context): 119 | pass 120 | 121 | def update(self): 122 | pass 123 | 124 | class MoonRayShaderNode_Map_UsdTransform2d(MoonRayShaderNode): 125 | bl_idname = 'MoonRayShaderNode_Map_UsdTransform2d' 126 | bl_label = 'UsdTransform2d Node' 127 | 128 | def init(self, context): 129 | pass 130 | 131 | def update(self): 132 | pass 133 | 134 | class MoonRayShaderNode_Map_AxisAngle(MoonRayShaderNode): 135 | bl_idname = 'MoonRayShaderNode_Map_AxisAngle' 136 | bl_label = 'AxisAngle Node' 137 | 138 | def init(self, context): 139 | pass 140 | 141 | def update(self): 142 | pass 143 | 144 | class MoonRayShaderNode_Map_ColorCorrectLegacy(MoonRayShaderNode): 145 | bl_idname = 'MoonRayShaderNode_Map_ColorCorrectLegacy' 146 | bl_label = 'ColorCorrectLegacy Node' 147 | 148 | def init(self, context): 149 | pass 150 | 151 | def update(self): 152 | pass 153 | 154 | class MoonRayShaderNode_Map_Directional(MoonRayShaderNode): 155 | bl_idname = 'MoonRayShaderNode_Map_Directional' 156 | bl_label = 'Directional Node' 157 | 158 | def init(self, context): 159 | pass 160 | 161 | def update(self): 162 | pass 163 | 164 | class MoonRayShaderNode_Map_LOD(MoonRayShaderNode): 165 | bl_idname = 'MoonRayShaderNode_Map_LOD' 166 | bl_label = 'LOD Node' 167 | 168 | def init(self, context): 169 | pass 170 | 171 | def update(self): 172 | pass 173 | 174 | class MoonRayShaderNode_Map_ProjectSpherical(MoonRayShaderNode): 175 | bl_idname = 'MoonRayShaderNode_Map_ProjectSpherical' 176 | bl_label = 'ProjectSpherical Node' 177 | 178 | def init(self, context): 179 | pass 180 | 181 | def update(self): 182 | pass 183 | 184 | class MoonRayShaderNode_Map_SwitchColor(MoonRayShaderNode): 185 | bl_idname = 'MoonRayShaderNode_Map_SwitchColor' 186 | bl_label = 'SwitchColor Node' 187 | 188 | def init(self, context): 189 | pass 190 | 191 | def update(self): 192 | pass 193 | 194 | class MoonRayShaderNode_Map_Blend(MoonRayShaderNode): 195 | bl_idname = 'MoonRayShaderNode_Map_Blend' 196 | bl_label = 'Blend Node' 197 | 198 | def init(self, context): 199 | pass 200 | 201 | def update(self): 202 | pass 203 | 204 | class MoonRayShaderNode_Map_ColorCorrect(MoonRayShaderNode): 205 | bl_idname = 'MoonRayShaderNode_Map_ColorCorrect' 206 | bl_label = 'ColorCorrect Node' 207 | 208 | def init(self, context): 209 | pass 210 | 211 | def update(self): 212 | pass 213 | 214 | class MoonRayShaderNode_Map_FloatToRgb(MoonRayShaderNode): 215 | bl_idname = 'MoonRayShaderNode_Map_FloatToRgb' 216 | bl_label = 'FloatToRgb Node' 217 | 218 | def init(self, context): 219 | pass 220 | 221 | def update(self): 222 | pass 223 | 224 | class MoonRayShaderNode_Map_Noise(MoonRayShaderNode): 225 | bl_idname = 'MoonRayShaderNode_Map_Noise' 226 | bl_label = 'Noise Node' 227 | 228 | def init(self, context): 229 | pass 230 | 231 | def update(self): 232 | pass 233 | 234 | class MoonRayShaderNode_Map_ProjectTriplanar(MoonRayShaderNode): 235 | bl_idname = 'MoonRayShaderNode_Map_ProjectTriplanar' 236 | bl_label = 'ProjectTriplanar Node' 237 | 238 | def init(self, context): 239 | pass 240 | 241 | def update(self): 242 | pass 243 | 244 | class MoonRayShaderNode_Map_SwitchFloat(MoonRayShaderNode): 245 | bl_idname = 'MoonRayShaderNode_Map_SwitchFloat' 246 | bl_label = 'SwitchFloat Node' 247 | 248 | def init(self, context): 249 | pass 250 | 251 | def update(self): 252 | pass 253 | 254 | class MoonRayShaderNode_Map_Clamp(MoonRayShaderNode): 255 | bl_idname = 'MoonRayShaderNode_Map_Clamp' 256 | bl_label = 'Clamp Node' 257 | 258 | def init(self, context): 259 | pass 260 | 261 | def update(self): 262 | pass 263 | 264 | class MoonRayShaderNode_Map_ColorCorrectNuke(MoonRayShaderNode): 265 | bl_idname = 'MoonRayShaderNode_Map_ColorCorrectNuke' 266 | bl_label = 'ColorCorrectNuke Node' 267 | 268 | def init(self, context): 269 | pass 270 | 271 | def update(self): 272 | pass 273 | 274 | class MoonRayShaderNode_Map_Gradient(MoonRayShaderNode): 275 | bl_idname = 'MoonRayShaderNode_Map_Gradient' 276 | bl_label = 'Gradient Node' 277 | 278 | def init(self, context): 279 | pass 280 | 281 | def update(self): 282 | pass 283 | 284 | class MoonRayShaderNode_Map_NoiseWorley(MoonRayShaderNode): 285 | bl_idname = 'MoonRayShaderNode_Map_NoiseWorley' 286 | bl_label = 'NoiseWorley Node' 287 | 288 | def init(self, context): 289 | pass 290 | 291 | def update(self): 292 | pass 293 | 294 | class MoonRayShaderNode_Map_ProjectTriplanarUdim(MoonRayShaderNode): 295 | bl_idname = 'MoonRayShaderNode_Map_ProjectTriplanarUdim' 296 | bl_label = 'ProjectTriplanarUdim Node' 297 | 298 | def init(self, context): 299 | pass 300 | 301 | def update(self): 302 | pass 303 | 304 | class MoonRayShaderNode_Map_Template(MoonRayShaderNode): 305 | bl_idname = 'MoonRayShaderNode_Map_Template' 306 | bl_label = 'Template Node' 307 | 308 | def init(self, context): 309 | pass 310 | 311 | def update(self): 312 | pass 313 | 314 | class MoonRayShaderNode_Map_ColorCorrectSaturation(MoonRayShaderNode): 315 | bl_idname = 'MoonRayShaderNode_Map_ColorCorrectSaturation' 316 | bl_label = 'ColorCorrectSaturation Node' 317 | 318 | def init(self, context): 319 | pass 320 | 321 | def update(self): 322 | pass 323 | 324 | class MoonRayShaderNode_Map_HairColorPresets(MoonRayShaderNode): 325 | bl_idname = 'MoonRayShaderNode_Map_HairColorPresets' 326 | bl_label = 'HairColorPresets Node' 327 | 328 | def init(self, context): 329 | pass 330 | 331 | def update(self): 332 | pass 333 | 334 | class MoonRayShaderNode_Map_NormalToRgb(MoonRayShaderNode): 335 | bl_idname = 'MoonRayShaderNode_Map_NormalToRgb' 336 | bl_label = 'NormalToRgb Node' 337 | 338 | def init(self, context): 339 | pass 340 | 341 | def update(self): 342 | pass 343 | 344 | class MoonRayShaderNode_Map_Ramp(MoonRayShaderNode): 345 | bl_idname = 'MoonRayShaderNode_Map_Ramp' 346 | bl_label = 'Ramp Node' 347 | 348 | def init(self, context): 349 | pass 350 | 351 | def update(self): 352 | pass 353 | 354 | class MoonRayShaderNode_Map_Toon(MoonRayShaderNode): 355 | bl_idname = 'MoonRayShaderNode_Map_Toon' 356 | bl_label = 'Toon Node' 357 | 358 | def init(self, context): 359 | pass 360 | 361 | def update(self): 362 | pass 363 | 364 | class MoonRayShaderNode_Map_ColorCorrectContrast(MoonRayShaderNode): 365 | bl_idname = 'MoonRayShaderNode_Map_ColorCorrectContrast' 366 | bl_label = 'ColorCorrectContrast Node' 367 | 368 | def init(self, context): 369 | pass 370 | 371 | def update(self): 372 | pass 373 | 374 | class MoonRayShaderNode_Map_ColorCorrectTMI(MoonRayShaderNode): 375 | bl_idname = 'MoonRayShaderNode_Map_ColorCorrectTMI' 376 | bl_label = 'ColorCorrectTMI Node' 377 | 378 | def init(self, context): 379 | pass 380 | 381 | def update(self): 382 | pass 383 | 384 | class MoonRayShaderNode_Map_HairColumn(MoonRayShaderNode): 385 | bl_idname = 'MoonRayShaderNode_Map_HairColumn' 386 | bl_label = 'HairColumn Node' 387 | 388 | def init(self, context): 389 | pass 390 | def update(self): 391 | pass 392 | 393 | class MoonRayShaderNode_Map_Op(MoonRayShaderNode): 394 | bl_idname = 'MoonRayShaderNode_Map_Op' 395 | bl_label = 'Op Node' 396 | 397 | def init(self, context): 398 | pass 399 | 400 | def update(self): 401 | pass 402 | 403 | class MoonRayShaderNode_Map_Random(MoonRayShaderNode): 404 | bl_idname = 'MoonRayShaderNode_Map_Random' 405 | bl_label = 'Random Node' 406 | 407 | def init(self, context): 408 | pass 409 | 410 | def update(self): 411 | pass 412 | 413 | class MoonRayShaderNode_Map_TransformNormal(MoonRayShaderNode): 414 | bl_idname = 'MoonRayShaderNode_Map_TransformNormal' 415 | bl_label = 'TransformNormal Node' 416 | 417 | def init(self, context): 418 | pass 419 | 420 | def update(self): 421 | pass 422 | 423 | class MoonRayShaderNode_Map_ColorCorrectGainOffset(MoonRayShaderNode): 424 | bl_idname = 'MoonRayShaderNode_Map_ColorCorrectGainOffset' 425 | bl_label = 'ColorCorrectGainOffset Node' 426 | 427 | def init(self, context): 428 | pass 429 | 430 | def update(self): 431 | pass 432 | 433 | class MoonRayShaderNode_Map_ConstantColor(MoonRayShaderNode): 434 | bl_idname = 'MoonRayShaderNode_Map_ConstantColor' 435 | bl_label = 'ConstantColor Node' 436 | 437 | def init(self, context): 438 | pass 439 | 440 | def update(self): 441 | pass 442 | 443 | class MoonRayShaderNode_Map_Hair(MoonRayShaderNode): 444 | bl_idname = 'MoonRayShaderNode_Map_Hair' 445 | bl_label = 'Hair Node' 446 | 447 | def init(self, context): 448 | pass 449 | 450 | def update(self): 451 | pass 452 | 453 | class MoonRayShaderNode_Map_OpSqrt(MoonRayShaderNode): 454 | bl_idname = 'MoonRayShaderNode_Map_OpSqrt' 455 | bl_label = 'OpSqrt Node' 456 | 457 | def init(self, context): 458 | pass 459 | 460 | def update(self): 461 | pass 462 | 463 | class MoonRayShaderNode_Map_Remap(MoonRayShaderNode): 464 | bl_idname = 'MoonRayShaderNode_Map_Remap' 465 | bl_label = 'Remap Node' 466 | 467 | def init(self, context): 468 | pass 469 | 470 | def update(self): 471 | pass 472 | 473 | class MoonRayShaderNode_Map_TransformSpace(MoonRayShaderNode): 474 | bl_idname = 'MoonRayShaderNode_Map_TransformSpace' 475 | bl_label = 'TransformSpace Node' 476 | 477 | def init(self, context): 478 | pass 479 | 480 | def update(self): 481 | pass 482 | 483 | class MoonRayShaderNode_Map_ColorCorrectGamma(MoonRayShaderNode): 484 | bl_idname = 'MoonRayShaderNode_Map_ColorCorrectGamma' 485 | bl_label = 'ColorCorrectGamma Node' 486 | 487 | def init(self, context): 488 | pass 489 | 490 | def update(self): 491 | pass 492 | 493 | class MoonRayShaderNode_Map_ConstantScalar(MoonRayShaderNode): 494 | bl_idname = 'MoonRayShaderNode_Map_ConstantScalar' 495 | bl_label = 'ConstantScalar Node' 496 | 497 | def init(self, context): 498 | pass 499 | 500 | def update(self): 501 | pass 502 | 503 | class MoonRayShaderNode_Map_HsvToRgb(MoonRayShaderNode): 504 | bl_idname = 'MoonRayShaderNode_Map_HsvToRgb' 505 | bl_label = 'HsvToRgb Node' 506 | 507 | def init(self, context): 508 | pass 509 | 510 | def update(self): 511 | pass 512 | 513 | class MoonRayShaderNode_Map_ProjectCamera(MoonRayShaderNode): 514 | bl_idname = 'MoonRayShaderNode_Map_ProjectCamera' 515 | bl_label = 'ProjectCamera Node' 516 | 517 | def init(self, context): 518 | pass 519 | 520 | def update(self): 521 | pass 522 | 523 | class MoonRayShaderNode_Map_RgbToFloat(MoonRayShaderNode): 524 | bl_idname = 'MoonRayShaderNode_Map_RgbToFloat' 525 | bl_label = 'RgbToFloat Node' 526 | 527 | def init(self, context): 528 | pass 529 | 530 | def update(self): 531 | pass 532 | 533 | class MoonRayShaderNode_Map_UVTransform(MoonRayShaderNode): 534 | bl_idname = 'MoonRayShaderNode_Map_UVTransform' 535 | bl_label = 'UVTransform Node' 536 | 537 | def init(self, context): 538 | pass 539 | 540 | def update(self): 541 | pass 542 | 543 | class MoonRayShaderNode_Map_ColorCorrectHsv(MoonRayShaderNode): 544 | bl_idname = 'MoonRayShaderNode_Map_ColorCorrectHsv' 545 | bl_label = 'ColorCorrectHsv Node' 546 | 547 | def init(self, context): 548 | pass 549 | 550 | def update(self): 551 | pass 552 | 553 | class MoonRayShaderNode_Map_Curvature(MoonRayShaderNode): 554 | bl_idname = 'MoonRayShaderNode_Map_Curvature' 555 | bl_label = 'Curvature Node' 556 | 557 | def init(self, context): 558 | pass 559 | 560 | def update(self): 561 | pass 562 | 563 | class MoonRayShaderNode_Map_Layer(MoonRayShaderNode): 564 | bl_idname = 'MoonRayShaderNode_Map_Layer' 565 | bl_label = 'Layer Node' 566 | 567 | def init(self, context): 568 | pass 569 | 570 | def update(self): 571 | pass 572 | 573 | class MoonRayShaderNode_Map_ProjectCylindrical(MoonRayShaderNode): 574 | bl_idname = 'MoonRayShaderNode_Map_ProjectCylindrical' 575 | bl_label = 'ProjectCylindrical Node' 576 | 577 | def init(self, context): 578 | pass 579 | 580 | def update(self): 581 | pass 582 | 583 | class MoonRayShaderNode_Map_RgbToHsv(MoonRayShaderNode): 584 | bl_idname = 'MoonRayShaderNode_Map_RgbToHsv' 585 | bl_label = 'RgbToHsv Node' 586 | 587 | def init(self, context): 588 | pass 589 | 590 | def update(self): 591 | pass 592 | 593 | class MoonRayShaderNode_Map_Wireframe(MoonRayShaderNode): 594 | bl_idname = 'MoonRayShaderNode_Map_Wireframe' 595 | bl_label = 'Wireframe Node' 596 | 597 | def init(self, context): 598 | pass 599 | 600 | def update(self): 601 | pass 602 | 603 | class MoonRayShaderNode_Map_ColorCorrectHueShift(MoonRayShaderNode): 604 | bl_idname = 'MoonRayShaderNode_Map_ColorCorrectHueShift' 605 | bl_label = 'ColorCorrectHueShift Node' 606 | 607 | def init(self, context): 608 | pass 609 | 610 | def update(self): 611 | pass 612 | 613 | class MoonRayShaderNode_Map_Deformation(MoonRayShaderNode): 614 | bl_idname = 'MoonRayShaderNode_Map_Deformation' 615 | bl_label = 'Deformation Node' 616 | 617 | def init(self, context): 618 | pass 619 | 620 | def update(self): 621 | pass 622 | 623 | class MoonRayShaderNode_Map_LcToRgb(MoonRayShaderNode): 624 | bl_idname = 'MoonRayShaderNode_Map_LcToRgb' 625 | bl_label = 'LcToRgb Node' 626 | 627 | def init(self, context): 628 | pass 629 | 630 | def update(self): 631 | pass 632 | 633 | class MoonRayShaderNode_Map_ProjectPlanar(MoonRayShaderNode): 634 | bl_idname = 'MoonRayShaderNode_Map_ProjectPlanar' 635 | bl_label = 'ProjectPlanar Node' 636 | 637 | def init(self, context): 638 | pass 639 | 640 | def update(self): 641 | pass 642 | 643 | class MoonRayShaderNode_Map_RgbToLab(MoonRayShaderNode): 644 | bl_idname = 'MoonRayShaderNode_Map_RgbToLab' 645 | bl_label = 'RgbToLab Node' 646 | 647 | def init(self, context): 648 | pass 649 | 650 | def update(self): 651 | pass 652 | 653 | classes = [ 654 | MoonRayShaderNode_Map_Attribute, 655 | MoonRayShaderNode_Map_Debug, 656 | MoonRayShaderNode_Map_List, 657 | MoonRayShaderNode_Map_UsdPrimvarReader_float2, 658 | MoonRayShaderNode_Map_UsdPrimvarReader_point, 659 | MoonRayShaderNode_Map_UsdUVTexture, 660 | MoonRayShaderNode_Map_Checkerboard, 661 | MoonRayShaderNode_Map_ExtraAov, 662 | MoonRayShaderNode_Map_UsdPrimvarReader_float3, 663 | MoonRayShaderNode_Map_UsdPrimvarReader_vector, 664 | MoonRayShaderNode_Map_Image, 665 | MoonRayShaderNode_Map_UsdPrimvarReader_float, 666 | MoonRayShaderNode_Map_UsdTransform2d, 667 | MoonRayShaderNode_Map_AxisAngle, 668 | MoonRayShaderNode_Map_ColorCorrectLegacy, 669 | MoonRayShaderNode_Map_Directional, 670 | MoonRayShaderNode_Map_LOD, 671 | MoonRayShaderNode_Map_ProjectSpherical, 672 | MoonRayShaderNode_Map_SwitchColor, 673 | MoonRayShaderNode_Map_Blend, 674 | MoonRayShaderNode_Map_ColorCorrect, 675 | MoonRayShaderNode_Map_FloatToRgb, 676 | MoonRayShaderNode_Map_Noise, 677 | MoonRayShaderNode_Map_ProjectTriplanar, 678 | MoonRayShaderNode_Map_SwitchFloat, 679 | MoonRayShaderNode_Map_Clamp, 680 | MoonRayShaderNode_Map_ColorCorrectNuke, 681 | MoonRayShaderNode_Map_Gradient, 682 | MoonRayShaderNode_Map_NoiseWorley, 683 | MoonRayShaderNode_Map_ProjectTriplanarUdim, 684 | MoonRayShaderNode_Map_Template, 685 | MoonRayShaderNode_Map_ColorCorrectSaturation, 686 | MoonRayShaderNode_Map_HairColorPresets, 687 | MoonRayShaderNode_Map_NormalToRgb, 688 | MoonRayShaderNode_Map_Ramp, 689 | MoonRayShaderNode_Map_Toon, 690 | MoonRayShaderNode_Map_ColorCorrectContrast, 691 | MoonRayShaderNode_Map_ColorCorrectTMI, 692 | MoonRayShaderNode_Map_HairColumn, 693 | MoonRayShaderNode_Map_Op, 694 | MoonRayShaderNode_Map_Random, 695 | MoonRayShaderNode_Map_TransformNormal, 696 | MoonRayShaderNode_Map_ColorCorrectGainOffset, 697 | MoonRayShaderNode_Map_ConstantColor, 698 | MoonRayShaderNode_Map_Hair, 699 | MoonRayShaderNode_Map_OpSqrt, 700 | MoonRayShaderNode_Map_Remap, 701 | MoonRayShaderNode_Map_TransformSpace, 702 | MoonRayShaderNode_Map_ColorCorrectGamma, 703 | MoonRayShaderNode_Map_ConstantScalar, 704 | MoonRayShaderNode_Map_HsvToRgb, 705 | MoonRayShaderNode_Map_ProjectCamera, 706 | MoonRayShaderNode_Map_RgbToFloat, 707 | MoonRayShaderNode_Map_UVTransform, 708 | MoonRayShaderNode_Map_ColorCorrectHsv, 709 | MoonRayShaderNode_Map_Curvature, 710 | MoonRayShaderNode_Map_Layer, 711 | MoonRayShaderNode_Map_ProjectCylindrical, 712 | MoonRayShaderNode_Map_RgbToHsv, 713 | MoonRayShaderNode_Map_Wireframe, 714 | MoonRayShaderNode_Map_ColorCorrectHueShift, 715 | MoonRayShaderNode_Map_Deformation, 716 | MoonRayShaderNode_Map_LcToRgb, 717 | MoonRayShaderNode_Map_ProjectPlanar, 718 | MoonRayShaderNode_Map_RgbToLab 719 | ] 720 | 721 | 722 | def register(): 723 | for cls in classes: 724 | bpy.utils.register_class(cls) 725 | 726 | def unregister(): 727 | for cls in reversed(classes): 728 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /nodes/shaders/mfb_shader_nodes_normal.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from ..mfb_nodes import MoonRayShaderNode 3 | 4 | class MoonRayShaderNode_CombineNormalMap(MoonRayShaderNode): 5 | bl_idname = 'MoonRayShaderNode_CombineNormalMap' 6 | bl_label = 'Combine Normal Map' 7 | 8 | def init(self, context): 9 | pass 10 | 11 | def update(self): 12 | pass 13 | 14 | class MoonRayShaderNode_DistortNormalMap(MoonRayShaderNode): 15 | bl_idname = 'MoonRayShaderNode_DistortNormalMap' 16 | bl_label = 'Distort Normal Map' 17 | 18 | def init(self, context): 19 | pass 20 | 21 | def update(self): 22 | pass 23 | 24 | class MoonRayShaderNode_ImageNormalMap(MoonRayShaderNode): 25 | bl_idname = 'MoonRayShaderNode_ImageNormalMap' 26 | bl_label = 'Image Normal Map' 27 | 28 | def init(self, context): 29 | pass 30 | 31 | def update(self): 32 | pass 33 | 34 | class MoonRayShaderNode_ProjectCameraNormalMap(MoonRayShaderNode): 35 | bl_idname = 'MoonRayShaderNode_ProjectCameraNormalMap' 36 | bl_label = 'Project Camera Normal Map' 37 | 38 | def init(self, context): 39 | pass 40 | 41 | def update(self): 42 | pass 43 | 44 | class MoonRayShaderNode_ProjectPlanarNormalMap(MoonRayShaderNode): 45 | bl_idname = 'MoonRayShaderNode_ProjectPlanarNormalMap' 46 | bl_label = 'Project Planar Normal Map' 47 | 48 | def init(self, context): 49 | pass 50 | 51 | def update(self): 52 | pass 53 | 54 | class MoonRayShaderNode_ProjectTriPlanarNormalMap(MoonRayShaderNode): 55 | bl_idname = 'MoonRayShaderNode_ProjectTriPlanarNormalMap' 56 | bl_label = 'Project TriPlanar Normal Map' 57 | 58 | def init(self, context): 59 | pass 60 | 61 | def update(self): 62 | pass 63 | 64 | class MoonRayShaderNode_RandomNormalMap(MoonRayShaderNode): 65 | bl_idname = 'MoonRayShaderNode_RandomNormalMap' 66 | bl_label = 'Random Normal Map' 67 | 68 | def init(self, context): 69 | pass 70 | 71 | def update(self): 72 | pass 73 | 74 | class MoonRayShaderNode_RgbToNormalMap(MoonRayShaderNode): 75 | bl_idname = 'MoonRayShaderNode_RgbToNormalMap' 76 | bl_label = 'RGB to Normal Map' 77 | 78 | def init(self, context): 79 | pass 80 | 81 | def update(self): 82 | pass 83 | 84 | class MoonRayShaderNode_SwitchNormalMap(MoonRayShaderNode): 85 | bl_idname = 'MoonRayShaderNode_SwitchNormalMap' 86 | bl_label = 'Switch Normal Map' 87 | 88 | def init(self, context): 89 | pass 90 | 91 | def update(self): 92 | pass 93 | 94 | class MoonRayShaderNode_TransformNormalMap(MoonRayShaderNode): 95 | bl_idname = 'MoonRayShaderNode_TransformNormalMap' 96 | bl_label = 'Transform Normal Map' 97 | 98 | def init(self, context): 99 | pass 100 | 101 | def update(self): 102 | pass 103 | 104 | classes = [ 105 | MoonRayShaderNode_CombineNormalMap, 106 | MoonRayShaderNode_DistortNormalMap, 107 | MoonRayShaderNode_ImageNormalMap, 108 | MoonRayShaderNode_ProjectCameraNormalMap, 109 | MoonRayShaderNode_ProjectPlanarNormalMap, 110 | MoonRayShaderNode_ProjectTriPlanarNormalMap, 111 | MoonRayShaderNode_RandomNormalMap, 112 | MoonRayShaderNode_RgbToNormalMap, 113 | MoonRayShaderNode_SwitchNormalMap, 114 | MoonRayShaderNode_TransformNormalMap 115 | ] 116 | 117 | def register(): 118 | for cls in classes: 119 | bpy.utils.register_class(cls) 120 | 121 | def unregister(): 122 | for cls in reversed(classes): 123 | bpy.utils.unregister_class(cls) 124 | 125 | -------------------------------------------------------------------------------- /nodes/shaders/mfb_shader_nodes_output.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from ..mfb_nodes import MoonRayShaderNode 3 | 4 | class MoonRayShaderNode_Output(MoonRayShaderNode): 5 | bl_idname = 'MoonRayShaderNode_Output' 6 | bl_label = 'MoonRay Output' 7 | 8 | def init(self, context): 9 | pass 10 | 11 | def update(self): 12 | pass 13 | 14 | class MoonRayShaderNode_BakeCamera(MoonRayShaderNode): 15 | bl_idname = 'MoonRayShaderNode_BakeCamera' 16 | bl_label = 'MoonRay Bake Camera' 17 | 18 | def init(self, context): 19 | pass 20 | 21 | def update(self): 22 | pass 23 | 24 | class MoonRayLightShaderNode_Output(MoonRayShaderNode): 25 | bl_idname = 'MoonRayLightShaderNode_Output' 26 | bl_label = 'MoonRay Light Output' 27 | 28 | def init(self, context): 29 | pass 30 | 31 | def update(self): 32 | pass 33 | 34 | class MoonRayWorldShaderNode_Output(MoonRayShaderNode): 35 | bl_idname = 'MoonRayWorldShaderNode_Output' 36 | bl_label = 'MoonRay World Output' 37 | 38 | def init(self, context): 39 | pass 40 | 41 | def update(self): 42 | pass 43 | 44 | classes = [MoonRayShaderNode_Output, MoonRayShaderNode_BakeCamera, MoonRayLightShaderNode_Output, MoonRayWorldShaderNode_Output] 45 | 46 | def register(): 47 | for cls in classes: 48 | bpy.utils.register_class(cls) 49 | 50 | def unregister(): 51 | for cls in reversed(classes): 52 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /nodes/shaders/mfb_shader_nodes_shader.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from ..mfb_nodes import MoonRayShaderNode 3 | 4 | class MoonRayShaderNode_Axf(MoonRayShaderNode): 5 | bl_idname = 'MoonRayShaderNode_Axf' 6 | bl_label = 'Axf Shader Node' 7 | 8 | def init(self, context): 9 | pass 10 | 11 | def update(self): 12 | pass 13 | 14 | class MoonRayShaderNode_Base(MoonRayShaderNode): 15 | bl_idname = 'MoonRayShaderNode_Base' 16 | bl_label = 'MoonRay Node' 17 | 18 | def init(self, context): 19 | pass 20 | 21 | def update(self): 22 | pass 23 | 24 | class MoonRayShaderNode_Measured(MoonRayShaderNode): 25 | bl_idname = 'MoonRayShaderNode_Measured' 26 | bl_label = 'Measured Shader Node' 27 | 28 | def init(self, context): 29 | pass 30 | 31 | def update(self): 32 | pass 33 | 34 | class MoonRayShaderNode_RaySwitch(MoonRayShaderNode): 35 | bl_idname = 'MoonRayShaderNode_RaySwitch' 36 | bl_label = 'RaySwitch Shader Node' 37 | 38 | def init(self, context): 39 | pass 40 | 41 | def update(self): 42 | pass 43 | 44 | class MoonRayShaderNode_Switch(MoonRayShaderNode): 45 | bl_idname = 'MoonRayShaderNode_Switch' 46 | bl_label = 'Switch Shader Node' 47 | 48 | def init(self, context): 49 | pass 50 | 51 | def update(self): 52 | pass 53 | 54 | class MoonRayShaderNode_UsdPreviewSurface(MoonRayShaderNode): 55 | bl_idname = 'MoonRayShaderNode_UsdPreviewSurface' 56 | bl_label = 'UsdPreviewSurface Shader Node' 57 | 58 | def init(self, context): 59 | pass 60 | 61 | def update(self): 62 | pass 63 | 64 | class MoonRayShaderNode_DwaColorCorrect(MoonRayShaderNode): 65 | bl_idname = 'MoonRayShaderNode_DwaColorCorrect' 66 | bl_label = 'DwaColorCorrect Shader Node' 67 | 68 | def init(self, context): 69 | pass 70 | 71 | def update(self): 72 | pass 73 | 74 | class MoonRayShaderNode_DwaLayer(MoonRayShaderNode): 75 | bl_idname = 'MoonRayShaderNode_DwaLayer' 76 | bl_label = 'DwaLayer Shader Node' 77 | 78 | def init(self, context): 79 | pass 80 | 81 | def update(self): 82 | pass 83 | 84 | class MoonRayShaderNode_DwaRefractive(MoonRayShaderNode): 85 | bl_idname = 'MoonRayShaderNode_DwaRefractive' 86 | bl_label = 'DwaRefractive Shader Node' 87 | 88 | def init(self, context): 89 | pass 90 | 91 | def update(self): 92 | pass 93 | 94 | class MoonRayShaderNode_DwaSwitch(MoonRayShaderNode): 95 | bl_idname = 'MoonRayShaderNode_DwaSwitch' 96 | bl_label = 'DwaSwitch Shader Node' 97 | 98 | def init(self, context): 99 | pass 100 | 101 | def update(self): 102 | pass 103 | 104 | class MoonRayShaderNode_GlitterFlake(MoonRayShaderNode): 105 | bl_idname = 'MoonRayShaderNode_GlitterFlake' 106 | bl_label = 'GlitterFlake Shader Node' 107 | 108 | def init(self, context): 109 | pass 110 | 111 | def update(self): 112 | pass 113 | 114 | class MoonRayShaderNode_HairDiffuse(MoonRayShaderNode): 115 | bl_idname = 'MoonRayShaderNode_HairDiffuse' 116 | bl_label = 'HairDiffuse Shader Node' 117 | 118 | def init(self, context): 119 | pass 120 | 121 | def update(self): 122 | pass 123 | 124 | class MoonRayShaderNode_Toon(MoonRayShaderNode): 125 | bl_idname = 'MoonRayShaderNode_Toon' 126 | bl_label = 'Toon Shader Node' 127 | 128 | def init(self, context): 129 | pass 130 | 131 | def update(self): 132 | pass 133 | 134 | class MoonRayShaderNode_HairToon(MoonRayShaderNode): 135 | bl_idname = 'MoonRayShaderNode_HairToon' 136 | bl_label = 'HairToon Shader Node' 137 | 138 | def init(self, context): 139 | pass 140 | 141 | def update(self): 142 | pass 143 | 144 | class MoonRayShaderNode_DwaAdjust(MoonRayShaderNode): 145 | bl_idname = 'MoonRayShaderNode_DwaAdjust' 146 | bl_label = 'DwaAdjust Shader Node' 147 | 148 | def init(self, context): 149 | pass 150 | 151 | def update(self): 152 | pass 153 | 154 | class MoonRayShaderNode_DwaEmissive(MoonRayShaderNode): 155 | bl_idname = 'MoonRayShaderNode_DwaEmissive' 156 | bl_label = 'DwaEmissive Shader Node' 157 | 158 | def init(self, context): 159 | pass 160 | 161 | def update(self): 162 | pass 163 | 164 | class MoonRayShaderNode_DwaMetal(MoonRayShaderNode): 165 | bl_idname = 'MoonRayShaderNode_DwaMetal' 166 | bl_label = 'DwaMetal Shader Node' 167 | 168 | def init(self, context): 169 | pass 170 | 171 | def update(self): 172 | pass 173 | 174 | class MoonRayShaderNode_DwaSkin(MoonRayShaderNode): 175 | bl_idname = 'MoonRayShaderNode_DwaSkin' 176 | bl_label = 'DwaSkin Shader Node' 177 | 178 | def init(self, context): 179 | pass 180 | 181 | def update(self): 182 | pass 183 | 184 | class MoonRayShaderNode_DwaTwoSided(MoonRayShaderNode): 185 | bl_idname = 'MoonRayShaderNode_DwaTwoSided' 186 | bl_label = 'DwaTwoSided Shader Node' 187 | 188 | def init(self, context): 189 | pass 190 | 191 | def update(self): 192 | pass 193 | 194 | class MoonRayShaderNode_Hair(MoonRayShaderNode): 195 | bl_idname = 'MoonRayShaderNode_Hair' 196 | bl_label = 'Hair Shader Node' 197 | 198 | def init(self, context): 199 | pass 200 | 201 | def update(self): 202 | pass 203 | 204 | class MoonRayShaderNode_HairLayer(MoonRayShaderNode): 205 | bl_idname = 'MoonRayShaderNode_HairLayer' 206 | bl_label = 'HairLayer Shader Node' 207 | 208 | def init(self, context): 209 | pass 210 | 211 | def update(self): 212 | pass 213 | 214 | class MoonRayShaderNode_DwaBase(MoonRayShaderNode): 215 | bl_idname = 'MoonRayShaderNode_DwaBase' 216 | bl_label = 'DwaBase Shader Node' 217 | 218 | def init(self, context): 219 | pass 220 | 221 | def update(self): 222 | pass 223 | 224 | class MoonRayShaderNode_DwaFabric(MoonRayShaderNode): 225 | bl_idname = 'MoonRayShaderNode_DwaFabric' 226 | bl_label = 'DwaFabric Shader Node' 227 | 228 | def init(self, context): 229 | pass 230 | 231 | def update(self): 232 | pass 233 | 234 | class MoonRayShaderNode_DwaMix(MoonRayShaderNode): 235 | bl_idname = 'MoonRayShaderNode_DwaMix' 236 | bl_label = 'DwaMix Shader Node' 237 | 238 | def init(self, context): 239 | pass 240 | 241 | def update(self): 242 | pass 243 | 244 | class MoonRayShaderNode_DwaSolidDielectric(MoonRayShaderNode): 245 | bl_idname = 'MoonRayShaderNode_DwaSolidDielectric' 246 | bl_label = 'DwaSolidDielectric Shader Node' 247 | 248 | def init(self, context): 249 | pass 250 | 251 | def update(self): 252 | pass 253 | 254 | class MoonRayShaderNode_DwaVelvet(MoonRayShaderNode): 255 | bl_idname = 'MoonRayShaderNode_DwaVelvet' 256 | bl_label = 'DwaVelvet Shader Node' 257 | 258 | def init(self, context): 259 | pass 260 | 261 | def update(self): 262 | pass 263 | 264 | class MoonRayShaderNode_HairColorCorrect(MoonRayShaderNode): 265 | bl_idname = 'MoonRayShaderNode_HairColorCorrect' 266 | bl_label = 'HairColorCorrect Shader Node' 267 | 268 | def init(self, context): 269 | pass 270 | 271 | def update(self): 272 | pass 273 | 274 | class MoonRayShaderNode_MacroFlake(MoonRayShaderNode): 275 | bl_idname = 'MoonRayShaderNode_MacroFlake' 276 | bl_label = 'MacroFlake Shader Node' 277 | 278 | def init(self, context): 279 | pass 280 | 281 | def update(self): 282 | pass 283 | 284 | classes = [ 285 | MoonRayShaderNode_Axf, 286 | MoonRayShaderNode_Base, 287 | MoonRayShaderNode_Measured, 288 | MoonRayShaderNode_RaySwitch, 289 | MoonRayShaderNode_Switch, 290 | MoonRayShaderNode_UsdPreviewSurface, 291 | MoonRayShaderNode_DwaColorCorrect, 292 | MoonRayShaderNode_DwaLayer, 293 | MoonRayShaderNode_DwaRefractive, 294 | MoonRayShaderNode_DwaSwitch, 295 | MoonRayShaderNode_GlitterFlake, 296 | MoonRayShaderNode_HairDiffuse, 297 | MoonRayShaderNode_Toon, 298 | MoonRayShaderNode_HairToon, 299 | MoonRayShaderNode_DwaAdjust, 300 | MoonRayShaderNode_DwaEmissive, 301 | MoonRayShaderNode_DwaMetal, 302 | MoonRayShaderNode_DwaSkin, 303 | MoonRayShaderNode_DwaTwoSided, 304 | MoonRayShaderNode_Hair, 305 | MoonRayShaderNode_HairLayer, 306 | MoonRayShaderNode_DwaBase, 307 | MoonRayShaderNode_DwaFabric, 308 | MoonRayShaderNode_DwaMix, 309 | MoonRayShaderNode_DwaSolidDielectric, 310 | MoonRayShaderNode_DwaVelvet, 311 | MoonRayShaderNode_HairColorCorrect, 312 | MoonRayShaderNode_MacroFlake, 313 | ] 314 | 315 | def register(): 316 | for cls in classes: 317 | bpy.utils.register_class(cls) 318 | 319 | def unregister(): 320 | for cls in reversed(classes): 321 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /operators/__init__.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | 3 | from . import node 4 | from . import sets 5 | from . import userdata 6 | from . import io 7 | 8 | def register(): 9 | io.register() 10 | userdata.register() 11 | node.register() 12 | sets.register() 13 | 14 | def unregister(): 15 | userdata.unregister() 16 | node.unregister() 17 | sets.unregister() 18 | io.unregister() -------------------------------------------------------------------------------- /operators/io.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | import os, subprocess 3 | from bpy.props import * 4 | 5 | # Define the export operator 6 | class MOONRAY_OT_ExportRDL(bpy.types.Operator): 7 | bl_idname = "moonray.export_rdl" 8 | bl_description="Export Dreamworks MoonRay RDL2 (.rdla/.rdlb) file" 9 | bl_label = "Export Dreamworks MoonRay RDL2 (.rdla/.rdlb)" 10 | 11 | filepath: StringProperty(subtype="FILE_PATH", default=os.path.join(os.path.expanduser("~"), "scene.rdla")) 12 | 13 | filter_glob: StringProperty( 14 | default="*.rdla;*.rdlb", 15 | options={'HIDDEN'}, 16 | ) 17 | 18 | export_selection_only: BoolProperty( 19 | name="Export Selection Only", 20 | description="Export only the selected objects", 21 | default=False 22 | ) 23 | 24 | export_visible_only: BoolProperty( 25 | name="Export Visible Only", 26 | description="Export only the visible objects", 27 | default=False 28 | ) 29 | 30 | export_animation: BoolProperty( 31 | name="Export Animation", 32 | description="Export the animation", 33 | default=False 34 | ) 35 | 36 | export_materials: BoolProperty( 37 | name="Export Materials", 38 | description="Include materials in the .rdla/.rdlb export", 39 | default=True 40 | ) 41 | 42 | export_lights: BoolProperty( 43 | name="Export Lights", 44 | description="Include lights in the .rdla/.rdlb export", 45 | default=True 46 | ) 47 | 48 | export_hair: BoolProperty( 49 | name="Export Hair", 50 | description="Include hair in the .rdla/.rdlb export", 51 | default=True 52 | ) 53 | 54 | export_cameras: BoolProperty( 55 | name="Export Cameras", 56 | description="Include cameras in the .rdla/.rdlb export", 57 | default=True 58 | ) 59 | 60 | keep_usd : BoolProperty( 61 | name="Export USD", 62 | description="Export a .usd file alongisde the .rdla/.rdlb file.", 63 | default=True 64 | ) 65 | 66 | def execute(self, context): 67 | print(self.filepath) 68 | if len(os.path.basename(self.filepath)) < 1: 69 | return {"FINISHED"} 70 | 71 | # Export the current Blender scene to a USD file 72 | usd_filepath = os.path.splitext(self.filepath)[0] + ".usd" 73 | is_rdla = os.path.splitext(self.filepath)[1] == ".rdla" 74 | is_rdlb = os.path.splitext(self.filepath)[1] == ".rdlb" 75 | 76 | bpy.ops.wm.usd_export(filepath=usd_filepath, 77 | selected_objects_only=self.export_selection_only, 78 | visible_objects_only=self.export_visible_only, 79 | export_animation=self.export_animation, 80 | export_materials=False 81 | ) 82 | 83 | # https://docs.blender.org/api/current/bpy.ops.wm.html 84 | 85 | print(f"Exported USD file to {usd_filepath}") 86 | 87 | # Convert the USD file to RDLA/RDLB 88 | rdla_filepath = self.convert_usd_to_rdla(usd_filepath, is_rdla, is_rdlb) 89 | if rdla_filepath: 90 | print(f"Converted USD to RDLA: {rdla_filepath}") 91 | # Delete the temporary USD file 92 | try: 93 | if (not self.keep_usd): 94 | os.remove(usd_filepath) 95 | print(f"Deleted temporary USD file: {usd_filepath}") 96 | except OSError as e: 97 | print(f"Error deleting USD file: {e}") 98 | else: 99 | print("Conversion failed.") 100 | return {'CANCELLED'} 101 | 102 | return {'FINISHED'} 103 | 104 | def convert_usd_to_rdla(self, usd_filepath, is_rdla=False, is_rdlb=False): 105 | # Set up paths 106 | extension = ".rdla" if is_rdla else ".rdlb" if is_rdlb else "" 107 | 108 | rdla_filepath = os.path.splitext(usd_filepath)[0] + extension 109 | 110 | # Construct the command to source the setup script and run the conversion 111 | 112 | command = f'source {os.path.join(os.path.expanduser("~"), ".mfb/installs/openmoonray/scripts/setup.sh")} && ' \ 113 | f'{os.path.join(os.path.expanduser("~"), ".mfb/installs/openmoonray/bin/hd_usd2rdl")} -in {usd_filepath} -out {rdla_filepath}' 114 | 115 | try: 116 | # Run the command in a shell 117 | subprocess.run(command, shell=True, check=True, executable="/bin/bash") 118 | 119 | texture_path = os.path.join(os.path.dirname(rdla_filepath), "textures") 120 | maketx_path = os.path.join(os.path.expanduser("~"), ".mfb/dependencies/bl_deps/openimageio/bin/maketx") 121 | 122 | for file in os.listdir(texture_path): 123 | file_path = os.path.join(texture_path, file) 124 | 125 | if not file.lower().endswith(('.jpg', '.png', '.tif', '.tiff', '.exr')): 126 | print(f"Skipping non-image file: {file}") 127 | continue 128 | 129 | # Define the command to convert to .tx 130 | maketx_command = [maketx_path, file_path] 131 | 132 | subprocess.run(maketx_command, shell=True, check=True, executable="/bin/bash") 133 | 134 | return rdla_filepath 135 | except subprocess.CalledProcessError as e: 136 | print(f"Error during USD to RDLA conversion: {e}") 137 | return None 138 | 139 | 140 | def invoke(self, context, event): 141 | context.window_manager.fileselect_add(self) 142 | return {'RUNNING_MODAL'} 143 | 144 | classes = [MOONRAY_OT_ExportRDL] 145 | 146 | 147 | def register(): 148 | for cls in classes: 149 | bpy.utils.register_class(cls) 150 | 151 | def unregister(): 152 | for cls in reversed(classes): 153 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /operators/node.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | 3 | class NODE_OT_add_moonray_node(bpy.types.Operator): 4 | bl_idname = "node.add_moonray_node" 5 | bl_label = "Add MoonRay Node" 6 | 7 | type: bpy.props.StringProperty() 8 | 9 | def execute(self, context): 10 | bpy.ops.node.add_node( 11 | 'INVOKE_DEFAULT', 12 | type=self.type, 13 | use_transform=True 14 | ) 15 | return {'FINISHED'} 16 | 17 | classes = [NODE_OT_add_moonray_node] 18 | 19 | def register(): 20 | for cls in classes: 21 | bpy.utils.register_class(cls) 22 | 23 | def unregister(): 24 | for cls in reversed(classes): 25 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /operators/sets.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | 3 | from bpy.props import * 4 | 5 | # Operator to add light groups 6 | class MOONRAY_OT_AddLightSet(bpy.types.Operator): 7 | bl_idname = "moonray.add_light_set" 8 | bl_label = "Add Light Set" 9 | bl_description = "Add a new light set to the list" 10 | 11 | def execute(self, context): 12 | sets = context.scene.moonray.light_sets 13 | new_item = sets.items.add() 14 | new_item.name = "Light Set {}".format(len(sets.items)) 15 | sets.index = len(sets.items) - 1 16 | return {'FINISHED'} 17 | 18 | class MOONRAY_OT_RemoveLightSet(bpy.types.Operator): 19 | bl_idname = "moonray.remove_light_set" 20 | bl_label = "Remove Light Set" 21 | bl_description = "Remove the selected light set from the list" 22 | 23 | def execute(self, context): 24 | sets = context.scene.moonray.light_sets 25 | if sets.items: 26 | sets.items.remove(sets.index) 27 | sets.index = min(max(0, sets.index - 1), len(sets.items) - 1) 28 | return {'FINISHED'} 29 | 30 | 31 | # Operator to add light groups 32 | class MOONRAY_OT_AddLightFilterSet(bpy.types.Operator): 33 | bl_idname = "moonray.add_lightfilter_set" 34 | bl_label = "Add Light Filter Set" 35 | bl_description = "Add a new light filter set to the list" 36 | 37 | def execute(self, context): 38 | sets = context.scene.moonray.lightfilter_sets 39 | new_item = sets.items.add() 40 | new_item.name = "Light Filter Set {}".format(len(sets.items)) 41 | sets.index = len(sets.items) - 1 42 | return {'FINISHED'} 43 | 44 | class MOONRAY_OT_RemoveLightFilterSet(bpy.types.Operator): 45 | bl_idname = "moonray.remove_lightfilter_set" 46 | bl_label = "Remove Light Filter Set" 47 | bl_description = "Remove the selected light filter set from the list" 48 | 49 | def execute(self, context): 50 | sets = context.scene.moonray.lightfilter_sets 51 | if sets.items: 52 | sets.items.remove(sets.index) 53 | sets.index = min(max(0, sets.index - 1), len(sets.items) - 1) 54 | return {'FINISHED'} 55 | 56 | 57 | 58 | 59 | # Operator to add light groups 60 | class MOONRAY_OT_AddShadowSet(bpy.types.Operator): 61 | bl_idname = "moonray.add_shadow_set" 62 | bl_label = "Add Shadow Set" 63 | bl_description = "Add a new shadow set to the list" 64 | 65 | def execute(self, context): 66 | sets = context.scene.moonray.shadow_sets 67 | new_item = sets.items.add() 68 | new_item.name = "Shadow Set {}".format(len(sets.items)) 69 | sets.index = len(sets.items) - 1 70 | return {'FINISHED'} 71 | 72 | class MOONRAY_OT_RemoveShadowSet(bpy.types.Operator): 73 | bl_idname = "moonray.remove_shadow_set" 74 | bl_label = "Remove Shadow Set" 75 | bl_description = "Remove the selected shadow set from the list" 76 | 77 | def execute(self, context): 78 | sets = context.scene.moonray.shadow_sets 79 | if sets.items: 80 | sets.items.remove(sets.index) 81 | sets.index = min(max(0, sets.index - 1), len(sets.items) - 1) 82 | return {'FINISHED'} 83 | 84 | 85 | # Operator to add light groups 86 | class MOONRAY_OT_AddShadowReceiverSet(bpy.types.Operator): 87 | bl_idname = "moonray.add_shadowreceiver_set" 88 | bl_label = "Add Shadow Receiver Set" 89 | bl_description = "Add a new shadow receiver set to the list" 90 | 91 | def execute(self, context): 92 | sets = context.scene.moonray.shadowreceiver_sets 93 | new_item = sets.items.add() 94 | new_item.name = "Shadow Receiver Set {}".format(len(sets.items)) 95 | sets.index = len(sets.items) - 1 96 | return {'FINISHED'} 97 | 98 | class MOONRAY_OT_RemoveShadowReceiverSet(bpy.types.Operator): 99 | bl_idname = "moonray.remove_shadowreceiver_set" 100 | bl_label = "Remove Shadow Receiver Set" 101 | bl_description = "Remove the selected shadow receiver set from the list" 102 | 103 | def execute(self, context): 104 | sets = context.scene.moonray.shadowreceiver_sets 105 | if sets.items: 106 | sets.items.remove(sets.index) 107 | sets.index = min(max(0, sets.index - 1), len(sets.items) - 1) 108 | return {'FINISHED'} 109 | 110 | 111 | # Operator to add light groups 112 | class MOONRAY_OT_AddTraceSet(bpy.types.Operator): 113 | bl_idname = "moonray.add_trace_set" 114 | bl_label = "Add Trace Set" 115 | bl_description = "Add a new trace set to the list" 116 | 117 | def execute(self, context): 118 | sets = context.scene.moonray.trace_sets 119 | new_item = sets.items.add() 120 | new_item.name = "Trace Set {}".format(len(sets.items)) 121 | sets.index = len(sets.items) - 1 122 | return {'FINISHED'} 123 | 124 | class MOONRAY_OT_RemoveTraceSet(bpy.types.Operator): 125 | bl_idname = "moonray.remove_trace_set" 126 | bl_label = "Remove Trace Set" 127 | bl_description = "Remove the selected trace set from the list" 128 | 129 | def execute(self, context): 130 | sets = context.scene.moonray.trace_sets 131 | if sets.items: 132 | sets.items.remove(sets.index) 133 | sets.index = min(max(0, sets.index - 1), len(sets.items) - 1) 134 | return {'FINISHED'} 135 | 136 | classes = [MOONRAY_OT_AddLightSet, MOONRAY_OT_RemoveLightSet, MOONRAY_OT_AddLightFilterSet, MOONRAY_OT_RemoveLightFilterSet, MOONRAY_OT_AddShadowSet, MOONRAY_OT_RemoveShadowSet, MOONRAY_OT_AddShadowReceiverSet, MOONRAY_OT_RemoveShadowReceiverSet, MOONRAY_OT_AddTraceSet, MOONRAY_OT_RemoveTraceSet] 137 | 138 | def register(): 139 | for cls in classes: 140 | bpy.utils.register_class(cls) 141 | 142 | def unregister(): 143 | for cls in reversed(classes): 144 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /operators/userdata.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from bpy.props import * 3 | 4 | from ..props.userdata import MoonRayUserData 5 | 6 | class MOONRAY_OT_AddUserData(bpy.types.Operator): 7 | bl_idname = "moonray.add_userdata" 8 | bl_label = "Add User Data" 9 | bl_description = "Add a custom userdata attribute" 10 | 11 | attribute: PointerProperty(type=MoonRayUserData) 12 | 13 | def execute(self, context): 14 | user_data = context.object.moonray.user_data 15 | 16 | new_attr = user_data.add() 17 | new_attr.name = self.attribute.name 18 | new_attr.type = self.attribute.type 19 | 20 | # Set value based on type 21 | if self.attribute.type == 'BOOL': 22 | new_attr.value_bool = self.attribute.value_bool 23 | elif self.attribute.type == 'COLOR': 24 | new_attr.value_color = self.attribute.value_color 25 | elif self.attribute.type == 'FLOAT': 26 | new_attr.value_float = self.attribute.value_float 27 | elif self.attribute.type == 'INTEGER': 28 | new_attr.value_int = self.attribute.value_int 29 | elif self.attribute.type == 'MAT4F': 30 | new_attr.value_mat4f = self.attribute.value_mat4f 31 | elif self.attribute.type == 'STRING': 32 | new_attr.value_string = self.attribute.value_string 33 | elif self.attribute.type == 'VEC2F': 34 | new_attr.value_vec2f = self.attribute.value_vec2f 35 | elif self.attribute.type == 'VEC3F': 36 | new_attr.value_vec3f = self.attribute.value_vec3f 37 | 38 | return {'FINISHED'} 39 | 40 | def invoke(self, context, event): 41 | self.attribute.name = "default" 42 | wm = context.window_manager 43 | return wm.invoke_props_dialog(self) 44 | 45 | def draw(self, context): 46 | layout = self.layout 47 | layout.prop(self.attribute, "name") 48 | layout.prop(self.attribute, "type") 49 | 50 | # Additional properties for value types 51 | if self.attribute.type == 'BOOL': 52 | layout.prop(self.attribute, "value_bool") 53 | elif self.attribute.type == 'COLOR': 54 | layout.prop(self.attribute, "value_color") 55 | elif self.attribute.type == 'FLOAT': 56 | layout.prop(self.attribute, "value_float") 57 | elif self.attribute.type == 'INTEGER': 58 | layout.prop(self.attribute, "value_int") 59 | elif self.attribute.type == 'MAT4F': 60 | layout.prop(self.attribute, "value_mat4f") 61 | elif self.attribute.type == 'STRING': 62 | layout.prop(self.attribute, "value_string") 63 | elif self.attribute.type == 'VEC2F': 64 | layout.prop(self.attribute, "value_vec2f") 65 | elif self.attribute.type == 'VEC3F': 66 | layout.prop(self.attribute, "value_vec3f") 67 | 68 | 69 | class MOONRAY_OT_RemoveUserData(bpy.types.Operator): 70 | bl_idname = "moonray.remove_userdata" 71 | bl_label = "Remove Custom Attribute" 72 | bl_description = "Remove a custom attribute" 73 | 74 | index: IntProperty() 75 | 76 | def execute(self, context): 77 | obj = context.object 78 | user_data = obj.moonray.user_data 79 | user_data.remove(self.index) 80 | return {'FINISHED'} 81 | 82 | classes = [MOONRAY_OT_AddUserData, MOONRAY_OT_RemoveUserData] 83 | 84 | def register(): 85 | for cls in classes: 86 | bpy.utils.register_class(cls) 87 | 88 | def unregister(): 89 | for cls in reversed(classes): 90 | bpy.utils.unregister_class(cls) 91 | -------------------------------------------------------------------------------- /preferences.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from bpy.props import * 3 | 4 | 5 | class MoonRayPreferences(bpy.types.AddonPreferences): 6 | bl_idname = "moonray_for_blender" 7 | 8 | def draw(self, context): 9 | layout = self.layout 10 | scene = context.scene 11 | moonray = scene.moonray 12 | 13 | 14 | layout.label(text="Global") 15 | layout.prop(moonray.mfb, "hdmoonray_path") 16 | layout.prop(moonray.driver, "output_file") 17 | layout.prop(moonray.driver, "tmp_dir") 18 | 19 | layout.label(text="Debugging") 20 | layout.prop(moonray.debug, "debug_console") 21 | layout.prop(moonray.debug, "debug_pixel") 22 | layout.prop(moonray.debug, "validate_geometry") 23 | 24 | layout.label(text="Driver") 25 | layout.prop(moonray.driver, "machine_id") 26 | layout.prop(moonray.driver, "num_machines") 27 | layout.prop(moonray.driver, "task_distribution_type") 28 | 29 | layout.label(text="Caching") 30 | layout.prop(moonray.caching, "fast_geometry_update") 31 | layout.prop(moonray.caching, "texture_cache_size") 32 | layout.prop(moonray.caching, "texture_file_handles") 33 | 34 | layout.label(text="Logging") 35 | layout.prop(moonray.logging, "athena_debug") 36 | layout.prop(moonray.logging, "fatal_color") 37 | layout.prop(moonray.logging, "log_debug") 38 | layout.prop(moonray.logging, "log_info") 39 | 40 | def register(): 41 | bpy.utils.register_class(MoonRayPreferences) 42 | 43 | def unregister(): 44 | bpy.utils.unregister_class(MoonRayPreferences) -------------------------------------------------------------------------------- /properties.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from bpy.props import * 3 | 4 | from .props.sets import MoonRayLightSets, MoonRayLightFilterSets, MoonRayShadowSets, MoonRayShadowReceiverSets, MoonRayTraceSets 5 | from .props.attributes import ( 6 | MoonRayAttributes_Caching, 7 | MoonRayAttributes_CameraAndLayer, 8 | MoonRayAttributes_Checkpoint, 9 | MoonRayAttributes_Debug, 10 | MoonRayAttributes_DeepImages, 11 | MoonRayAttributes_Driver, 12 | MoonRayAttributes_Filtering, 13 | MoonRayAttributes_FirefliesRemoval, 14 | MoonRayAttributes_Frame, 15 | MoonRayAttributes_GlobalToggles, 16 | MoonRayAttributes_ImageSize, 17 | MoonRayAttributes_Logging, 18 | MoonRayAttributes_MetaData, 19 | MoonRayAttributes_MotionAndScale, 20 | MoonRayAttributes_PathGuide, 21 | MoonRayAttributes_ResumeRender, 22 | MoonRayAttributes_Sampling, 23 | MoonRayAttributes_Volumes, 24 | MoonRayAttributes_General 25 | ) 26 | 27 | from .props.render_output import MoonRayAttributes_RenderOutput 28 | from .props import MoonRayAttributes_Mfb 29 | 30 | from .props.userdata import MoonRayUserData 31 | 32 | class MoonRaySceneProperties(bpy.types.PropertyGroup): 33 | 34 | mfb: PointerProperty(type=MoonRayAttributes_Mfb) 35 | 36 | caching : PointerProperty(type=MoonRayAttributes_Caching) 37 | camera_and_layer: PointerProperty(type=MoonRayAttributes_CameraAndLayer) 38 | checkpoint: PointerProperty(type=MoonRayAttributes_Checkpoint) 39 | debug: PointerProperty(type=MoonRayAttributes_Debug) 40 | deep_images: PointerProperty(type=MoonRayAttributes_DeepImages) 41 | driver: PointerProperty(type=MoonRayAttributes_Driver) 42 | filtering: PointerProperty(type=MoonRayAttributes_Filtering) 43 | fireflies_removal: PointerProperty(type=MoonRayAttributes_FirefliesRemoval) 44 | frame: PointerProperty(type=MoonRayAttributes_Frame) 45 | global_toggles: PointerProperty(type=MoonRayAttributes_GlobalToggles) 46 | image_size: PointerProperty(type=MoonRayAttributes_ImageSize) 47 | logging: PointerProperty(type=MoonRayAttributes_Logging) 48 | metadata: PointerProperty(type=MoonRayAttributes_MetaData) 49 | motion_and_scale: PointerProperty(type=MoonRayAttributes_MotionAndScale) 50 | path_guide: PointerProperty(type=MoonRayAttributes_PathGuide) 51 | resume_render: PointerProperty(type=MoonRayAttributes_ResumeRender) 52 | sampling: PointerProperty(type=MoonRayAttributes_Sampling) 53 | volumes: PointerProperty(type=MoonRayAttributes_Volumes) 54 | general: PointerProperty(type=MoonRayAttributes_General) 55 | 56 | 57 | output:PointerProperty(type=MoonRayAttributes_RenderOutput) 58 | 59 | light_sets: PointerProperty(type=MoonRayLightSets) 60 | lightfilter_sets: PointerProperty(type=MoonRayLightFilterSets) 61 | shadow_sets: PointerProperty(type=MoonRayShadowSets) 62 | shadowreceiver_sets: PointerProperty(type=MoonRayShadowReceiverSets) 63 | trace_sets: PointerProperty(type=MoonRayTraceSets) 64 | 65 | class MoonRayLightProperties(bpy.types.PropertyGroup): 66 | visible : BoolProperty(name="Visible") 67 | motion_blur : BoolProperty(name="Motion Blur") 68 | texture : StringProperty(name="Texture", subtype="FILE_PATH") 69 | 70 | type : EnumProperty( 71 | name="Light Type", 72 | description="Choose a light type", 73 | items=[ 74 | ('CYLINDER', 'Cylinder', ''), 75 | ('DISK', 'Disk', ''), 76 | ('DISTANT', 'Distant', ''), 77 | ('ENV', 'Environment', ''), 78 | ('RECT', 'Rect', ''), 79 | ('SPHERE', 'Sphere', ''), 80 | ('SPOT', 'Spot', '') 81 | ] 82 | ) 83 | 84 | lightfilter_set: StringProperty(name="Light Filter Set") 85 | light_set_input: StringProperty(name="Light Sets") 86 | shadow_set_input: StringProperty(name="Shadow Sets") 87 | 88 | class MoonRayObjectProperties(bpy.types.PropertyGroup): 89 | is_light : BoolProperty(name="Is Light Source") 90 | 91 | light_set: StringProperty(name="Light Set") 92 | shadow_set: StringProperty(name="Shadow Set") 93 | shadowreceiver_set: StringProperty(name="Shadow Receiver Set") 94 | trace_set_input: StringProperty(name="Trace Set") 95 | shadowreceiver_set_input: StringProperty(name="Shadow Receiver Set") 96 | 97 | user_data : CollectionProperty(type=MoonRayUserData) 98 | 99 | classes = [MoonRaySceneProperties, MoonRayLightProperties, MoonRayObjectProperties] 100 | 101 | def register(): 102 | for cls in classes: 103 | bpy.utils.register_class(cls) 104 | 105 | bpy.types.Scene.moonray = PointerProperty(type=MoonRaySceneProperties) 106 | bpy.types.Light.moonray = PointerProperty(type=MoonRayLightProperties) 107 | bpy.types.Object.moonray = PointerProperty(type=MoonRayObjectProperties) 108 | 109 | def unregister(): 110 | del bpy.types.Scene.moonray 111 | del bpy.types.Object.moonray 112 | del bpy.types.Light.moonray 113 | 114 | for cls in reversed(classes): 115 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /props/__init__.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from bpy.props import * 3 | 4 | from . import sets 5 | from . import userdata 6 | from . import deep 7 | from . import meta 8 | from . import attributes 9 | from . import render_output 10 | 11 | 12 | class MoonRayAttributes_Mfb(bpy.types.PropertyGroup): 13 | 14 | hdmoonray_path : StringProperty( 15 | name="HdMoonRay Path", 16 | description="Path to the hydra plugin for MoonRay", 17 | subtype="FILE_PATH", 18 | default="" 19 | ) 20 | 21 | execution_mode : EnumProperty( 22 | name="Execution Mode", 23 | description="MoonRay runs in four different execution modes", 24 | items=[ 25 | ("0", "Scalar", """ 26 | Scalar mode processes one ray at a time. The rendering is distributed across multiple CPU cores, but MoonRay does not attempt to use the multiple SIMD lanes within the CPU cores for additional parallelism. It also does not batch rays together for improved memory access coherency. 27 | Hence, it can be considered a “classical” path tracing algorithm 28 | """), 29 | ("1", "Vector", """ 30 | Vector mode achieves higher performance than scalar mode with two strategies: 31 | 32 | Batch rays and shading operations together for improved memory access coherency. 33 | Process multiple rays and shading calculations in parallel by using the multiple SIMD lanes within the multiple CPU cores. 34 | The ray/shading batching is implemented as a “wave-front” path tracer, where rays and shading operations are batched and sorted into queues. When these queues fill up, they are processed/emptied as one batch of work. This makes better use of the CPU’s caches than scalar mode’s “single-ray” operation, which results in a more random memory access pattern. 35 | 36 | SIMD calculation is implemented in special vectorized code. On typical CPUs, there are eight “lanes”, so up to eight rays or shading operations can be processed at once per CPU core. 37 | 38 | Vector mode is designed to generate identical images as scalar mode, however due to architectural differences there are a few unsupported features: 39 | 40 | 1. Physically-correct overlapping dielectrics 41 | 2. Path guiding 42 | 3. Variance buffers 43 | 4. Volume rendering with deep file output 44 | If the scene uses one of these unsupported features, a warning message will be logged and the scene will be rendered without the feature. 45 | 46 | MoonRay’s vector mode is described in detail in the paper “Vectorized Production Path Tracing”, available from ACM at: https://dl.acm.org/doi/10.1145/3105762.3105768 47 | """), 48 | 49 | ("2", "XPU", """ 50 | MoonRay’s XPU mode uses a NVIDIA CUDA/OptiX-capable GPU to accelerate ray-scene intersection queries. Hence, it is not a complete GPU implementation of MoonRay, but rather uses the GPU as a heterogeneous coprocessor that offloads work from the CPU. 51 | 52 | XPU mode is designed to pixel-match MoonRay’s vector mode output. It utilizes the vector mode infrastructure, hence it inherits the same performance benefits and feature limitations of vector mode. 53 | 54 | XPU mode has the following additional unsupported features: 55 | 56 | 1. Round bezier curves 57 | 2. Round curves with more than 2 motion samples 58 | 3. Meshes with more than 2 motion samples 59 | If the scene uses one of these unsupported features, a warning message will be logged and the scene will be rendered without the feature. 60 | 61 | XPU mode may also fall back to CPU vector mode if there is insufficient GPU memory for the scene, or if there is a problem initializing the GPU 62 | """), 63 | 64 | ("3", "Auto", """ 65 | Auto mode will first try to render in xpu mode. If the scene uses a feature that is unsupported in xpu mode, MoonRay will fall back to vector mode. Then, if the scene uses a feature that is unsupported in vector mode, MoonRay will fall back to scalar mode. This prioritizes features over performance 66 | """), 67 | 68 | ], 69 | default="3" 70 | ) 71 | 72 | 73 | classes = [MoonRayAttributes_Mfb] 74 | 75 | 76 | def register(): 77 | for cls in classes: 78 | bpy.utils.register_class(cls) 79 | 80 | meta.register() 81 | deep.register() 82 | attributes.register() 83 | render_output.register() 84 | userdata.register() 85 | sets.register() 86 | 87 | def unregister(): 88 | for cls in reversed(classes): 89 | bpy.utils.unregister_class(cls) 90 | 91 | userdata.unregister() 92 | sets.unregister() 93 | render_output.unregister() 94 | attributes.unregister() 95 | deep.unregister() 96 | meta.unregister() -------------------------------------------------------------------------------- /props/deep.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from bpy.props import * 3 | 4 | class MoonRayDeepIDAttribute(bpy.types.PropertyGroup): 5 | name: StringProperty(name="Deep ID Attribute Name") 6 | 7 | classes = [MoonRayDeepIDAttribute] 8 | 9 | def register(): 10 | for cls in classes: 11 | bpy.utils.register_class(cls) 12 | 13 | def unregister(): 14 | for cls in reversed(classes): 15 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /props/meta.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from bpy.props import * 3 | 4 | class MoonRayEXRHeaderAttribute(bpy.types.PropertyGroup): 5 | name: StringProperty(name="Name", description="Metadata name") 6 | type: EnumProperty(name="Type", 7 | description="Allowed types for exr headers:\n* box2i\n* box2f\n* chromaticities\n* double\n* float\n* int\n* m33f\n* m44f\n* string\n* v2i\n* v2f\n* v3i\n* v3f", 8 | items = [ 9 | ("BOX2I", "box2i", ""), 10 | ("BOX2F", "box2f", ""), 11 | ("CHROMATICITIES", "chromaticities", ""), 12 | ("DOUBLE", "double", ""), 13 | ("FLOAT", "float", ""), 14 | ("INT", "int", ""), 15 | ("M33F", "m33f", ""), 16 | ("M44F", "m44f", ""), 17 | ("STRING", "string", ""), 18 | ("V2I", "v2i", ""), 19 | ("V2F", "v2f", ""), 20 | ("V3I", "v3i", ""), 21 | ("V3F", "v2f", "") 22 | ], 23 | default="STRING" 24 | ) 25 | value: StringProperty(name="Value", description="Metadata value", default="") 26 | 27 | classes = [MoonRayEXRHeaderAttribute] 28 | 29 | def register(): 30 | for cls in classes: 31 | bpy.utils.register_class(cls) 32 | 33 | def unregister(): 34 | for cls in reversed(classes): 35 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /props/render_output.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from bpy.props import * 3 | 4 | from .deep import MoonRayDeepIDAttribute 5 | from .meta import MoonRayEXRHeaderAttribute 6 | from .attributes import MoonRayAttributes_CameraAndLayer 7 | 8 | class MoonRayAttributes_RenderOutput(bpy.types.PropertyGroup): 9 | active : BoolProperty(name="Active", description="true enables, false disables render output", default=True) 10 | 11 | camera : PointerProperty( 12 | name="Camera", 13 | description="Camera to use for this output. If not specified, defaults to the primary camera", 14 | type=bpy.types.Object, 15 | poll=lambda self, obj: obj.type == 'CAMERA' 16 | ) 17 | 18 | channel_format : EnumProperty( 19 | name="Channel Format", 20 | description="The pixel encoding (bit depth and type) of the output channel", 21 | items=[ 22 | ("0", "Float", ""), 23 | ("1", "Half", "") 24 | ], 25 | default="1" 26 | ) 27 | 28 | channel_name : StringProperty( 29 | name="Channel Name", 30 | description="Name of the output channel. In the case of an empty channel name a sensible default name is chosen", 31 | default="beauty" 32 | ) 33 | 34 | channel_suffix_mode : EnumProperty( 35 | name="Channel Suffix Mode", 36 | description="When processing multi-channel outputs, how should channel names be suffixed?", 37 | items=[ 38 | ("0", "Auto", "A best guess suffix is chosen based on the type of output"), 39 | ("1", "RGB", ".R, .G, .B"), 40 | ("2", "XYZ", ".X, .Y, .Z"), 41 | ("3", "UVW", ".U, .V, .W") 42 | ], 43 | default="1" 44 | ) 45 | 46 | checkpoint_file_name : StringProperty( 47 | name="Checkpoint File Name", 48 | description="Name of checkpoint output file", 49 | default="checkpoint.exr" 50 | ) 51 | 52 | checkpoint_multi_version_file_name : StringProperty( 53 | name="Checkpoint Multi Version File Name", 54 | description="Name of checkpoint output file under checkpoint file overwrite=off condition", 55 | default="" 56 | ) 57 | 58 | compression : EnumProperty( 59 | name="Compression", 60 | description="Compression used for file (or file part in the multi-part case). All render outputs that target the same image must specify the same compression", 61 | items=[ 62 | ("0", "None", ""), 63 | ("1", "Zip", ""), 64 | ("2", "RLE", ""), 65 | ("3", "Zips", ""), 66 | ("4", "PIZ", ""), 67 | ("5", "Pxr24", ""), 68 | ("6", "B44", ""), 69 | ("7", "B44A", ""), 70 | ("8", "DWAA", ""), 71 | ("9", "DWAB", "") 72 | ], 73 | default="1" 74 | ) 75 | 76 | cryptomatte_depth : IntProperty(name="Cryptomatte Depth", description="", default=6) 77 | cryptomatte_enable_refract : BoolProperty(name="Cryptomatte Enable Refract", description="Enable refractive cryptomatte channels. Doubles the number of cryptomatte channels", default=True) 78 | cryptomatte_output_beauty : BoolProperty(name="Cryptomatte Output Beauty", description="Whether to output beauty data per cryptomatte id", default=False) 79 | cryptomatte_output_normals: BoolProperty(name="Cryptomatte Output Normals", description="Whether to output shading normal data per cryptomatte id", default=False) 80 | cryptomatte_output_p0 : BoolProperty(name="Cryptomatte Output p0", description="Whether to output p0 data per cryptomatte id", default=False) 81 | cryptomatte_output_positions : BoolProperty(name="Cryptomatte Output Positions", description="Whether to output position data per cryptomatte id", default=False) 82 | cryptomatte_output_refn : BoolProperty(name="Cryptomatte Output RefN", description="Whether to output refn data per cryptomatte id", default=False) 83 | cryptomatte_output_refp : BoolProperty(name="Cryptomatte Outpiut RefP", description="Whether to output refp data per cryptomatte id", default=False) 84 | cryptomatte_output_uv : BoolProperty(name="Cryptomatte Output UV", description="Whether to output uv data per cryptomatte id", default=False) 85 | cryptomatte_support_resume_render : BoolProperty(name="Cryptomatte Support Resume Render", description="Whether to add additional cryptomatte layers to support checkpoint/resume rendering", default=False) 86 | denoise : BoolProperty(name="Enable Denoising", description="Run optix denoiser before writing to disk", default=False) 87 | 88 | denoiser_input: EnumProperty( 89 | name="Denoiser Input", 90 | description="How to use this output as a denoiser input", 91 | items=[ 92 | ("0", "Not an Input", ""), 93 | ("1", "As Albedo", ""), 94 | ("2", "As Normal", "") 95 | ], 96 | default="0" 97 | ) 98 | 99 | display_filter : PointerProperty( 100 | name="Display Filter", 101 | description="If 'result' is 'display filter', this attribute refers to a display filter object which is used to compute the output pixel values.", 102 | type=MoonRayEXRHeaderAttribute 103 | ) 104 | 105 | exr_dwa_compression_level : FloatProperty( 106 | name="EXR DWA Compression Level", 107 | description="Compression level used for file with dwaa or dwab compression. All render outputs that target the same image must specify the same compression level", 108 | default=85.0 109 | ) 110 | 111 | exr_header_attributes : CollectionProperty(name="EXR Header Attributes", description="Metadata that is passed directly to the exr header. Format: {'name', 'type', 'value'}", type=MoonRayEXRHeaderAttribute) 112 | 113 | file_name: StringProperty(name="File Name", description="Name of destination file", subtype="FILE_PATH", default="scene.exr") 114 | file_part : StringProperty(name="File Part", description="Name of sub-image if using a multi-part exr file", default="") 115 | lpe : StringProperty( 116 | name="LPE", 117 | description="""This attribute specifies a light path expression to output. For details on light path expression syntax see: 118 |   https://github.com/imageworks/OpenShadingLanguage/wiki/OSL-Light-Path-Expressions 119 |  Labels on scattering events are constructed from two parts: [ML.]LL Where: 120 |    is the label attribute value of the material (if non-empty) 121 |    is the lobe label assigned in the shader by the shader writer 122 |  Labels on light events are set from the label attribute of the light. 123 |  Additionally, a small set of pre-defined expressions are available: 124 |   'caustic' : CD[S]+[O] 125 |   'diffuse' : CD[O] 126 |   'emission' : CO 127 |   'glossy' : CG[O] 128 |   'mirror' : CS[O] 129 |   'reflection' : C[DSG]+[O] 130 |   'translucent' : C[DSG]+[O] 131 |   'transmission' : C[DSG]+[O]""", 132 | default="" 133 | ) 134 | 135 | material_aov : StringProperty( 136 | name="Material Aov", 137 | description="""If 'result' is 'material aov', this attribute specifies a material aov expression to output. The expression format is: 138 |  [('')+\.][('')+\.][('')+\.][(SS|R|T|D|G|M)+\.][fresnel\.]. Where: 139 |    is a label associated with the geometry 140 |    is a label associated with the material 141 |    is a lobe label 142 |   R means reflection side lobe 143 |   T means transmission side lobe 144 |   D means diffuse lobe category 145 |   G means glossy lobe category 146 |   M means mirror lobe category 147 |   SS means sub-surface component of the material 148 |   fresnel means to select the lobe's or sub-surface's fresnel 149 |    can be one of: 150 |    'albedo' (bsdf lobe | subsurface) (RGB), 151 |    'color' (bsdf lobe | subsurface | fresnel) (RGB), 152 |    'depth' (state variable) (FLOAT), 153 |    'dPds' (state variable) (VEC3F), 154 |    'dPdt' (state variable) (VEC3F), 155 |    'dSdx' (state variable) (FLOAT), 156 |    'dSdy' (state variable) (FLOAT), 157 |    'dTdx' (state variable) (FLOAT), 158 |    'dTdy' (state variable) (FLOAT), 159 |    'emission' (bsdf) (RGB), 160 |    'factor' (fresnel) (FLOAT), 161 |    'float:' (primitive attribute) (FLOAT), 162 |    'matte' (bsdf lobe | subsurface) (FLOAT), 163 |    'motionvec' (state variable) (VEC2F), 164 |    'N' (state variable) (VEC3F), 165 |    'Ng' (state variable) (VEC3F), 166 |    'normal' (bsdf lobe | subsurface) (VEC3F), 167 |    'P' (state variable) (VEC3F), 168 |    'pbr_validity' (bsdf lobe | subsurface) (RGB), 169 |    'radius' (subsurface) (RGB), 170 |    'rgb:' (primitive attribute) (RGB), 171 |    'roughness' (bsdf lobe) (fresnel) (VEC2F), 172 |    'St' (state variable) (VEC2F), 173 |    'vec2:' (primitive attribute) (VEC2F), 174 |    'vec3:' (primitive attribute) (VEC3F), 175 |    'Wp' (state variable) (VEC3F) 176 |  Examples: 177 |   albedo : Albedo of all rendered materials 178 |   R.albedo : Total reflection albedo 179 |   'spec'.MG.roughness : Roughness of all mirror and glossy lobes that have the 'spec' label""", 180 | default="" 181 | ) 182 | 183 | math_filter : EnumProperty( 184 | name="Math Filter", 185 | description="the math filter over the pixel", 186 | items=[ 187 | ("0", "Average", ""), 188 | ("1", "Sum", ""), 189 | ("2", "Min", ""), 190 | ("3", "Max", ""), 191 | ("4", "Force_Consistent_Sampling", "Average of the first 'min_adaptive_samples'"), 192 | ("5", "Closest", "Use sample with minimum z-depth") 193 | ], 194 | default="5" 195 | ) 196 | 197 | output_type : StringProperty( 198 | name="Output Type", 199 | description="Specifies the type of output. Defaults to 'flat', meaning a flat exr file. 'deep' will output a deep exr file", 200 | default="flat" 201 | ) 202 | 203 | primitive_attribute : StringProperty( 204 | name="Primtive Attribute", 205 | description="If 'result' is 'primitive attribute', this attribute specifies the particular primitive attribute to output. Default channel name is based on primitive attribute name and type", 206 | default="" 207 | ) 208 | 209 | primitive_attribute_type : EnumProperty( 210 | name="Primitive Attribute Type", 211 | description="This attribute specifies the type of the attribute named with the 'primitive attribute' setting. This is required to uniquely specify the primitive attribute", 212 | items=[ 213 | ("0", "Float", ""), 214 | ("1", "Vec2f", ""), 215 | ("2", "Vec3f", ""), 216 | ("3", "RGB", "") 217 | ], 218 | default="0" 219 | ) 220 | 221 | result : EnumProperty( 222 | name="Result", 223 | description="The result to output", 224 | items=[ 225 | ("0", "Beauty", "Full render (R, G, B)"), 226 | ("1", "Alpha", "Full render alpha channel (A)"), 227 | ("2", "Depth", "Z distance from camera (Z)"), 228 | ("3", "State Variable", "Built-in state variable"), 229 | ("4", "Primitive Attribute", "Procedural provided attributes"), 230 | ("5", "Time Per Pixel", "Time per pixel heat map metric"), 231 | ("6", "Wireframe", "Render as wireframe"), 232 | ("7", "Material Aov", "Aovs provided via material expressions"), 233 | ("8", "Light Aov", "Aovs provided via light path expressions"), 234 | ("9", "Visiblity Aov", "Fraction of light samples that hit light source"), 235 | ("11", "Weight", "weight"), 236 | ("12", "Beauty Aux", "RenderBuffer auxiliary sample data for adaptive sampling"), 237 | ("13", "Cryptomatte", "Cryptomatte"), 238 | ("14", "Alpha Aux", "Alpha auxiliary sample data for adaptive sampling"), 239 | ("15", "Display Filter", "Output results from a display filter") 240 | ], 241 | default="0" 242 | ) 243 | 244 | resume_file_name: StringProperty( 245 | name="Resume File Name", 246 | description="Name of input file for resume render start condition", 247 | default="" 248 | ) 249 | 250 | state_variable : EnumProperty( 251 | name="State Variable", 252 | description="If 'result' is 'state variable', this attribute specifies the particular state variable result", 253 | items=[ 254 | ("0", "P", "Position (P.X, P.Y, P.Z)"), 255 | ("1", "Ng", "Geometric normal (Ng.X, Ng.Y, Ng.Z)"), 256 | ("2", "N", "Normal (N.X, N.Y, N.Z)"), 257 | ("3", "St", "Texture coordinates (St.X, St.Y)"), 258 | ("4", "dPds", "Derivative of P w.r.t S (dPds.X, dPds.Y, dPds.Z)"), 259 | ("5", "dPdt", "Derivative of P w.r.t T (dPdt.X, dPdt.Y, dPdt.Z)"), 260 | ("6", "dSdx", "S derivative w.r.t. x (dSdx)"), 261 | ("7", "dSdy", "S derivative w.r.t. y (dSdy)"), 262 | ("8", "dTdx", "T derivative w.r.t. x (dTdx)"), 263 | ("9", "dTdy", "T derivative w.r.t. y (dTdy)"), 264 | ("10", "Wp", "World position (Wp.X, Wp.Y, Wp.Z)"), 265 | ("11", "Depth", "Z distance from camera (Z)"), 266 | ("12", "MotionVec", "2D motion vector") 267 | ], 268 | default="2" 269 | ) 270 | 271 | visibility_aov : StringProperty( 272 | name="Visibility Aov", 273 | description="If 'result' is 'visibility aov', this attribute specifies a light path expression that defines the set of all paths used to compute the visibility ratio.", 274 | default="C[]*[][LO]" 275 | ) 276 | 277 | 278 | classes = [ 279 | MoonRayAttributes_RenderOutput 280 | ] 281 | 282 | def register(): 283 | for cls in classes: 284 | bpy.utils.register_class(cls) 285 | 286 | def unregister(): 287 | for cls in reversed(classes): 288 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /props/sets.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from bpy.props import * 3 | 4 | 5 | # Light Sets 6 | 7 | class MoonRayLightSetItem(bpy.types.PropertyGroup): 8 | name: StringProperty(name="Name") 9 | 10 | class MoonRayLightSets(bpy.types.PropertyGroup): 11 | items: CollectionProperty(type=MoonRayLightSetItem) 12 | index: IntProperty(name="Index", default=0) 13 | 14 | # Light Filter Sets 15 | 16 | class MoonRayLightFilterSetItem(bpy.types.PropertyGroup): 17 | name: StringProperty(name="Name") 18 | 19 | class MoonRayLightFilterSets(bpy.types.PropertyGroup): 20 | items: CollectionProperty(type=MoonRayLightSetItem) 21 | index: IntProperty(name="Index", default=0) 22 | 23 | # Shadow Sets 24 | 25 | class MoonRayShadowSetItem(bpy.types.PropertyGroup): 26 | name: StringProperty(name="Name") 27 | 28 | class MoonRayShadowSets(bpy.types.PropertyGroup): 29 | items: CollectionProperty(type=MoonRayShadowSetItem) 30 | index: IntProperty(name="Index", default=0) 31 | 32 | # Shadow Receiver Sets 33 | 34 | class MoonRayShadowReceiverSetItem(bpy.types.PropertyGroup): 35 | name: StringProperty(name="Name") 36 | 37 | class MoonRayShadowReceiverSets(bpy.types.PropertyGroup): 38 | items: CollectionProperty(type=MoonRayShadowReceiverSetItem) 39 | index: IntProperty(name="Index", default=0) 40 | 41 | # Trace Sets 42 | 43 | class MoonRayTraceSetItem(bpy.types.PropertyGroup): 44 | name: StringProperty(name="Name") 45 | 46 | class MoonRayTraceSets(bpy.types.PropertyGroup): 47 | items: CollectionProperty(type=MoonRayShadowReceiverSetItem) 48 | index: IntProperty(name="Index", default=0) 49 | 50 | classes = [MoonRayLightSetItem, MoonRayLightSets, MoonRayLightFilterSetItem, MoonRayLightFilterSets, MoonRayShadowSetItem, MoonRayShadowSets, MoonRayShadowReceiverSetItem, MoonRayShadowReceiverSets, MoonRayTraceSetItem, MoonRayTraceSets] 51 | 52 | def register(): 53 | for cls in classes: 54 | bpy.utils.register_class(cls) 55 | 56 | def unregister(): 57 | for cls in reversed(classes): 58 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /props/userdata.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from bpy.props import * 3 | from bpy.types import * 4 | 5 | class MoonRayUserData(bpy.types.PropertyGroup): 6 | name: StringProperty() 7 | type: EnumProperty( 8 | items=[ 9 | ("BOOL", "Boolean", ""), 10 | ("COLOR", "Color", ""), 11 | ("FLOAT", "Float", ""), 12 | ("INTEGER", "Integer", ""), 13 | ("MAT4F", "Mat4f", ""), 14 | ("STRING", "String", ""), 15 | ("VEC2F", "Vec2f", ""), 16 | ("VEC3F", "Vec3f", ""), 17 | ], 18 | default="FLOAT" 19 | ) 20 | value_bool: BoolProperty(default=False) 21 | value_color: FloatVectorProperty(subtype='COLOR', default=(1.0, 1.0, 1.0)) 22 | value_float: FloatProperty(default=0.0) 23 | value_int: IntProperty(default=0) 24 | value_mat4f: FloatVectorProperty(size=16, default=[0.0]*16) 25 | value_string: StringProperty(default="") 26 | value_vec2f: FloatVectorProperty(size=2, default=(0.0, 0.0)) 27 | value_vec3f: FloatVectorProperty(size=3, default=(0.0, 0.0, 0.0)) 28 | 29 | classes = [MoonRayUserData] 30 | 31 | def register(): 32 | for cls in classes: 33 | bpy.utils.register_class(cls) 34 | 35 | def unregister(): 36 | for cls in reversed(classes): 37 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /ui/__init__.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | 3 | from . import mfb_node_menus 4 | from ..engine import MoonRayRenderEngine 5 | 6 | from . import mfb_light 7 | from . import mfb_object 8 | from . import mfb_view_layer 9 | from . import mfb_render 10 | from . import mfb_output 11 | from . import mfb_menus 12 | 13 | def get_panels(): 14 | # Follow the Cycles model of excluding panels we don't want. 15 | exclude_panels = { 16 | 'DATA_PT_light', 17 | 'DATA_PT_spot', 18 | 'NODE_DATA_PT_light', 19 | 'DATA_PT_falloff_curve', 20 | 'SCENE_PT_audio', 21 | 22 | 23 | 'RENDER_PT_stamp', 24 | 'RENDER_PT_post_processing', 25 | 'RENDER_PT_simplify', 26 | 'RENDER_PT_freestyle', 27 | 'RENDER_PT_output', 28 | 'RENDER_PT_stereoscopy', 29 | 'RENDER_PT_time_stretching' 30 | } 31 | include_eevee_panels = { 32 | 'MATERIAL_PT_preview', 33 | 'EEVEE_MATERIAL_PT_context_material', 34 | 'EEVEE_MATERIAL_PT_surface', 35 | 'EEVEE_MATERIAL_PT_volume', 36 | 'EEVEE_MATERIAL_PT_settings', 37 | 'EEVEE_WORLD_PT_surface', 38 | } 39 | 40 | for panel_cls in bpy.types.Panel.__subclasses__(): 41 | if hasattr(panel_cls, 'COMPAT_ENGINES') and ( 42 | ('BLENDER_RENDER' in panel_cls.COMPAT_ENGINES and panel_cls.__name__ not in exclude_panels) or 43 | ('BLENDER_EEVEE' in panel_cls.COMPAT_ENGINES and panel_cls.__name__ in include_eevee_panels) 44 | ): 45 | yield panel_cls 46 | 47 | def register(): 48 | mfb_output.register() 49 | mfb_menus.register() 50 | mfb_node_menus.register() 51 | mfb_light.register() 52 | mfb_object.register() 53 | mfb_view_layer.register() 54 | mfb_render.register() 55 | 56 | for panel_cls in get_panels(): 57 | panel_cls.COMPAT_ENGINES.add(MoonRayRenderEngine.bl_idname) 58 | 59 | def unregister(): 60 | mfb_output.unregister() 61 | mfb_menus.unregister() 62 | mfb_node_menus.unregister() 63 | mfb_light.unregister() 64 | mfb_object.unregister() 65 | mfb_view_layer.unregister() 66 | mfb_render.unregister() 67 | 68 | for panel_cls in get_panels(): 69 | if MoonRayRenderEngine.bl_idname in panel_cls.COMPAT_ENGINES: 70 | panel_cls.COMPAT_ENGINES.remove(MoonRayRenderEngine.bl_idname) -------------------------------------------------------------------------------- /ui/mfb_light.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | 3 | from .mfb_panel import MOONRAY_PT_Panel 4 | 5 | class MOONRAY_LIGHT_PT_light(MOONRAY_PT_Panel): 6 | """Physical light sources""" 7 | bl_label = "Light" 8 | bl_context = 'data' 9 | 10 | @classmethod 11 | def poll(cls, context): 12 | return super().poll(context) and context.light 13 | 14 | def draw(self, context): 15 | layout = self.layout 16 | scene = context.scene 17 | 18 | moonray = scene.moonray 19 | 20 | light = context.light 21 | 22 | layout.prop(light.moonray, "type", expand=True) 23 | 24 | layout.use_property_split = True 25 | layout.use_property_decorate = False 26 | 27 | main_col = layout.column() 28 | 29 | main_col.prop(light, "color") 30 | main_col.prop(light.moonray, "texture") 31 | main_col.prop(light, "energy") 32 | main_col.separator() 33 | 34 | main_col.prop(light.moonray, "visible") 35 | main_col.prop(light.moonray, "motion_blur") 36 | 37 | layout.prop_search(light.moonray, "lightfilter_set", moonray.lightfilter_sets, "items", text="Light Filter Set", results_are_suggestions=True) 38 | layout.prop(light.moonray, "light_set_input", text="Light Sets") 39 | layout.prop(light.moonray, "shadow_set_input", text="Shadow Sets") 40 | 41 | 42 | classes = [MOONRAY_LIGHT_PT_light] 43 | 44 | def register(): 45 | for cls in classes: 46 | bpy.utils.register_class(cls) 47 | 48 | def unregister(): 49 | for cls in reversed(classes): 50 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /ui/mfb_menus.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from ..operators.io import MOONRAY_OT_ExportRDL 3 | 4 | # Function to append the export operator to the file menu 5 | def menu_func_export(self, context): 6 | self.layout.operator(MOONRAY_OT_ExportRDL.bl_idname) 7 | 8 | def register(): 9 | bpy.types.TOPBAR_MT_file_export.append(menu_func_export) 10 | 11 | def unregister(): 12 | bpy.types.TOPBAR_MT_file_export.remove(menu_func_export) -------------------------------------------------------------------------------- /ui/mfb_node_menus.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | 3 | from ..engine import MoonRayRenderEngine 4 | 5 | class MoonRayShaderNodeMenu(bpy.types.Menu): 6 | bl_idname = "NODE_MT_shader_node_add_moonray" 7 | bl_label = "Add MoonRay Node" 8 | 9 | def draw(self, context): 10 | layout = self.layout 11 | layout.menu("NODE_MT_shader_node_add_moonray_shader", text="Shader") 12 | layout.menu("NODE_MT_shader_node_add_moonray_map", text="Map") 13 | layout.menu("NODE_MT_shader_node_add_moonray_output", text="Output") 14 | layout.menu("NODE_MT_shader_node_add_moonray_normal", text="Normal") 15 | layout.menu("NODE_MT_shader_node_add_moonray_disp", text="Displacement") 16 | 17 | class MoonRayShaderNodeMenu_Shader(bpy.types.Menu): 18 | bl_idname = "NODE_MT_shader_node_add_moonray_shader" 19 | bl_label = "Add MoonRay Node" 20 | 21 | def draw(self, context): 22 | layout = self.layout 23 | layout.operator("node.add_moonray_node", text="Axf").type = 'MoonRayShaderNode_Axf' 24 | layout.operator("node.add_moonray_node", text="Measured").type = 'MoonRayShaderNode_Measured' 25 | layout.operator("node.add_moonray_node", text="Ray Switch").type = 'MoonRayShaderNode_RaySwitch' 26 | layout.operator("node.add_moonray_node", text="Switch").type = 'MoonRayShaderNode_Switch' 27 | layout.operator("node.add_moonray_node", text="UsdPreviewSurface").type = 'MoonRayShaderNode_UsdPreviewSurface' 28 | layout.operator("node.add_moonray_node", text="DwaColorCorrect").type = 'MoonRayShaderNode_DwaColorCorrect' 29 | layout.operator("node.add_moonray_node", text="DwaLayer").type = 'MoonRayShaderNode_DwaLayer' 30 | layout.operator("node.add_moonray_node", text="DwaRefractive").type = 'MoonRayShaderNode_DwaRefractive' 31 | layout.operator("node.add_moonray_node", text="DwaSwitch").type = 'MoonRayShaderNode_DwaSwitch' 32 | layout.operator("node.add_moonray_node", text="GlitterFlake").type = 'MoonRayShaderNode_GlitterFlake' 33 | layout.operator("node.add_moonray_node", text="HairDiffuse").type = 'MoonRayShaderNode_HairDiffuse' 34 | layout.operator("node.add_moonray_node", text="Toon").type = 'MoonRayShaderNode_Toon' 35 | layout.operator("node.add_moonray_node", text="HairToon").type = 'MoonRayShaderNode_HairToon' 36 | layout.operator("node.add_moonray_node", text="DwaAdjust").type = 'MoonRayShaderNode_DwaAdjust' 37 | layout.operator("node.add_moonray_node", text="DwaEmissive").type = 'MoonRayShaderNode_DwaEmissive' 38 | layout.operator("node.add_moonray_node", text="DwaMetal").type = 'MoonRayShaderNode_DwaMetal' 39 | layout.operator("node.add_moonray_node", text="DwaSkin").type = 'MoonRayShaderNode_DwaSkin' 40 | layout.operator("node.add_moonray_node", text="DwaTwoSided").type = 'MoonRayShaderNode_DwaTwoSided' 41 | layout.operator("node.add_moonray_node", text="Hair").type = 'MoonRayShaderNode_Hair' 42 | layout.operator("node.add_moonray_node", text="HairLayer").type = 'MoonRayShaderNode_HairLayer' 43 | layout.operator("node.add_moonray_node", text="DwaBase").type = 'MoonRayShaderNode_DwaBase' 44 | layout.operator("node.add_moonray_node", text="DwaFabric").type = 'MoonRayShaderNode_DwaFabric' 45 | layout.operator("node.add_moonray_node", text="DwaMix").type = 'MoonRayShaderNode_DwaMix' 46 | layout.operator("node.add_moonray_node", text="DwaSolidDielectric").type = 'MoonRayShaderNode_DwaSolidDielectric' 47 | layout.operator("node.add_moonray_node", text="DwaVelvet").type = 'MoonRayShaderNode_DwaVelvet' 48 | layout.operator("node.add_moonray_node", text="HairColorCorrect").type = 'MoonRayShaderNode_HairColorCorrect' 49 | layout.operator("node.add_moonray_node", text="MacroFlake").type = 'MoonRayShaderNode_MacroFlake' 50 | 51 | class MoonRayShaderNodeMenu_Map(bpy.types.Menu): 52 | bl_idname = "NODE_MT_shader_node_add_moonray_map" 53 | bl_label = "Add MoonRay Node" 54 | 55 | def draw(self, context): 56 | layout = self.layout 57 | layout.menu("NODE_MT_shader_node_add_moonray_map_usd", text="Usd") 58 | layout.menu("NODE_MT_shader_node_add_moonray_map_color", text="Color") 59 | layout.operator("node.add_moonray_node", text="Attribute").type = 'MoonRayShaderNode_Map_Attribute' 60 | layout.operator("node.add_moonray_node", text="Debug").type = 'MoonRayShaderNode_Map_Debug' 61 | layout.operator("node.add_moonray_node", text="List").type = 'MoonRayShaderNode_Map_List' 62 | layout.operator("node.add_moonray_node", text="Checkerboard").type = 'MoonRayShaderNode_Map_Checkerboard' 63 | layout.operator("node.add_moonray_node", text="ExtraAov").type = 'MoonRayShaderNode_Map_ExtraAov' 64 | layout.operator("node.add_moonray_node", text="OpenVdb").type = 'MoonRayShaderNode_Map_OpenVdb' 65 | layout.operator("node.add_moonray_node", text="Image").type = 'MoonRayShaderNode_Map_Image' 66 | layout.operator("node.add_moonray_node", text="UsdTransform2d").type = 'MoonRayShaderNode_Map_UsdTransform2d' 67 | layout.operator("node.add_moonray_node", text="AxisAngle").type = 'MoonRayShaderNode_Map_AxisAngle' 68 | layout.operator("node.add_moonray_node", text="ColorCorrectLegacy").type = 'MoonRayShaderNode_Map_ColorCorrectLegacy' 69 | layout.operator("node.add_moonray_node", text="Directional").type = 'MoonRayShaderNode_Map_Directional' 70 | layout.operator("node.add_moonray_node", text="LOD").type = 'MoonRayShaderNode_Map_LOD' 71 | layout.operator("node.add_moonray_node", text="ProjectSpherical").type = 'MoonRayShaderNode_Map_ProjectSpherical' 72 | layout.operator("node.add_moonray_node", text="SwitchColor").type = 'MoonRayShaderNode_Map_SwitchColor' 73 | layout.operator("node.add_moonray_node", text="Blend").type = 'MoonRayShaderNode_Map_Blend' 74 | layout.operator("node.add_moonray_node", text="ColorCorrect").type = 'MoonRayShaderNode_Map_ColorCorrect' 75 | layout.operator("node.add_moonray_node", text="FloatToRgb").type = 'MoonRayShaderNode_Map_FloatToRgb' 76 | layout.operator("node.add_moonray_node", text="Noise").type = 'MoonRayShaderNode_Map_Noise' 77 | layout.operator("node.add_moonray_node", text="ProjectTriplanar").type = 'MoonRayShaderNode_Map_ProjectTriplanar' 78 | layout.operator("node.add_moonray_node", text="SwitchFloat").type = 'MoonRayShaderNode_Map_SwitchFloat' 79 | layout.operator("node.add_moonray_node", text="Clamp").type = 'MoonRayShaderNode_Map_Clamp' 80 | layout.operator("node.add_moonray_node", text="ColorCorrectNuke").type = 'MoonRayShaderNode_Map_ColorCorrectNuke' 81 | layout.operator("node.add_moonray_node", text="Gradient").type = 'MoonRayShaderNode_Map_Gradient' 82 | layout.operator("node.add_moonray_node", text="NoiseWorley").type = 'MoonRayShaderNode_Map_NoiseWorley' 83 | layout.operator("node.add_moonray_node", text="ProjectTriplanarUdim").type = 'MoonRayShaderNode_Map_ProjectTriplanarUdim' 84 | layout.operator("node.add_moonray_node", text="Template").type = 'MoonRayShaderNode_Map_Template' 85 | layout.operator("node.add_moonray_node", text="ColorCorrectSaturation").type = 'MoonRayShaderNode_Map_ColorCorrectSaturation' 86 | layout.operator("node.add_moonray_node", text="HairColorPresets").type = 'MoonRayShaderNode_Map_HairColorPresets' 87 | layout.operator("node.add_moonray_node", text="NormalToRgb").type = 'MoonRayShaderNode_Map_NormalToRgb' 88 | layout.operator("node.add_moonray_node", text="Ramp").type = 'MoonRayShaderNode_Map_Ramp' 89 | layout.operator("node.add_moonray_node", text="Toon").type = 'MoonRayShaderNode_Map_Toon' 90 | layout.operator("node.add_moonray_node", text="ColorCorrectContrast").type = 'MoonRayShaderNode_Map_ColorCorrectContrast' 91 | layout.operator("node.add_moonray_node", text="ColorCorrectTMI").type = 'MoonRayShaderNode_Map_ColorCorrectTMI' 92 | layout.operator("node.add_moonray_node", text="HairColumn").type = 'MoonRayShaderNode_Map_HairColumn' 93 | layout.operator("node.add_moonray_node", text="Op").type = 'MoonRayShaderNode_Map_Op' 94 | layout.operator("node.add_moonray_node", text="Random").type = 'MoonRayShaderNode_Map_Random' 95 | layout.operator("node.add_moonray_node", text="TransformNormal").type = 'MoonRayShaderNode_Map_TransformNormal' 96 | layout.operator("node.add_moonray_node", text="ColorCorrectGainOffset").type = 'MoonRayShaderNode_Map_ColorCorrectGainOffset' 97 | layout.operator("node.add_moonray_node", text="ConstantColor").type = 'MoonRayShaderNode_Map_ConstantColor' 98 | layout.operator("node.add_moonray_node", text="Hair").type = 'MoonRayShaderNode_Map_Hair' 99 | layout.operator("node.add_moonray_node", text="OpSqrt").type = 'MoonRayShaderNode_Map_OpSqrt' 100 | layout.operator("node.add_moonray_node", text="Remap").type = 'MoonRayShaderNode_Map_Remap' 101 | layout.operator("node.add_moonray_node", text="TransformSpace").type = 'MoonRayShaderNode_Map_TransformSpace' 102 | layout.operator("node.add_moonray_node", text="ColorCorrectGamma").type = 'MoonRayShaderNode_Map_ColorCorrectGamma' 103 | layout.operator("node.add_moonray_node", text="ConstantScalar").type = 'MoonRayShaderNode_Map_ConstantScalar' 104 | layout.operator("node.add_moonray_node", text="HsvToRgb").type = 'MoonRayShaderNode_Map_HsvToRgb' 105 | layout.operator("node.add_moonray_node", text="ProjectCamera").type = 'MoonRayShaderNode_Map_ProjectCamera' 106 | layout.operator("node.add_moonray_node", text="RgbToFloat").type = 'MoonRayShaderNode_Map_RgbToFloat' 107 | layout.operator("node.add_moonray_node", text="UVTransform").type = 'MoonRayShaderNode_Map_UVTransform' 108 | layout.operator("node.add_moonray_node", text="ColorCorrectHsv").type = 'MoonRayShaderNode_Map_ColorCorrectHsv' 109 | layout.operator("node.add_moonray_node", text="Curvature").type = 'MoonRayShaderNode_Map_Curvature' 110 | layout.operator("node.add_moonray_node", text="Layer").type = 'MoonRayShaderNode_Map_Layer' 111 | layout.operator("node.add_moonray_node", text="ProjectCylindrical").type = 'MoonRayShaderNode_Map_ProjectCylindrical' 112 | layout.operator("node.add_moonray_node", text="RgbToHsv").type = 'MoonRayShaderNode_Map_RgbToHsv' 113 | layout.operator("node.add_moonray_node", text="Wireframe").type = 'MoonRayShaderNode_Map_Wireframe' 114 | layout.operator("node.add_moonray_node", text="ColorCorrectHueShift").type = 'MoonRayShaderNode_Map_ColorCorrectHueShift' 115 | layout.operator("node.add_moonray_node", text="Deformation").type = 'MoonRayShaderNode_Map_Deformation' 116 | layout.operator("node.add_moonray_node", text="LcToRgb").type = 'MoonRayShaderNode_Map_LcToRgb' 117 | layout.operator("node.add_moonray_node", text="ProjectPlanar").type = 'MoonRayShaderNode_Map_ProjectPlanar' 118 | layout.operator("node.add_moonray_node", text="RgbToLab").type = 'MoonRayShaderNode_Map_RgbToLab' 119 | 120 | class MoonRayShaderNodeMenu_Map_USD(bpy.types.Menu): 121 | bl_idname = "NODE_MT_shader_node_add_moonray_map_usd" 122 | bl_label = "Add MoonRay Node" 123 | 124 | def draw(self, context): 125 | layout = self.layout 126 | layout.operator("node.add_moonray_node", text="UsdPrimvarReader_float2").type = 'MoonRayShaderNode_Map_UsdPrimvarReader_float2' 127 | layout.operator("node.add_moonray_node", text="UsdPrimvarReader_point").type = 'MoonRayShaderNode_Map_UsdPrimvarReader_point' 128 | layout.operator("node.add_moonray_node", text="UsdUVTexture").type = 'MoonRayShaderNode_Map_UsdUVTexture' 129 | layout.operator("node.add_moonray_node", text="UsdPrimvarReader_float3").type = 'MoonRayShaderNode_Map_UsdPrimvarReader_float3' 130 | layout.operator("node.add_moonray_node", text="UsdPrimvarReader_vector").type = 'MoonRayShaderNode_Map_UsdPrimvarReader_vector' 131 | 132 | class MoonRayShaderNodeMenu_Map_Color(bpy.types.Menu): 133 | bl_idname = "NODE_MT_shader_node_add_moonray_map_color" 134 | bl_label = "Add MoonRay Node" 135 | 136 | def draw(self, context): 137 | layout = self.layout 138 | 139 | 140 | 141 | class MoonRayShaderNodeMenu_Displacement(bpy.types.Menu): 142 | bl_idname = "NODE_MT_shader_node_add_moonray_disp" 143 | bl_label = "Add MoonRay Node" 144 | 145 | def draw(self, context): 146 | layout = self.layout 147 | layout.operator("node.add_moonray_node", text="Combine Displacement").type = 'MoonRayShaderNode_CombineDisplacement' 148 | layout.operator("node.add_moonray_node", text="Normal Displacement").type = 'MoonRayShaderNode_NormalDisplacement' 149 | layout.operator("node.add_moonray_node", text="Switch Displacement").type = 'MoonRayShaderNode_SwitchDisplacement' 150 | layout.operator("node.add_moonray_node", text="Vector Displacement").type = 'MoonRayShaderNode_VectorDisplacement' 151 | 152 | class MoonRayShaderNodeMenu_Normal(bpy.types.Menu): 153 | bl_idname = "NODE_MT_shader_node_add_moonray_normal" 154 | bl_label = "Add MoonRay Node" 155 | 156 | def draw(self, context): 157 | layout = self.layout 158 | layout.operator("node.add_moonray_node", text="Combine Normal Map").type = 'MoonRayShaderNode_CombineNormalMap' 159 | layout.operator("node.add_moonray_node", text="Distort Normal Map").type = 'MoonRayShaderNode_DistortNormalMap' 160 | layout.operator("node.add_moonray_node", text="Image Normal Map").type = 'MoonRayShaderNode_ImageNormalMap' 161 | layout.operator("node.add_moonray_node", text="Project Camera Normal Map").type = 'MoonRayShaderNode_ProjectCameraNormalMap' 162 | layout.operator("node.add_moonray_node", text="Project Planar Normal Map").type = 'MoonRayShaderNode_ProjectPlanarNormalMap' 163 | layout.operator("node.add_moonray_node", text="Project Triplanar Normal Map").type = 'MoonRayShaderNode_ProjectTriplanarNormalMap' 164 | layout.operator("node.add_moonray_node", text="Project Triplanar Normal Map (v2)").type = 'MoonRayShaderNode_ProjectTriplanarNormalMap_v2' 165 | layout.operator("node.add_moonray_node", text="Random Normal Map").type = 'MoonRayShaderNode_RandomNormalMap' 166 | layout.operator("node.add_moonray_node", text="Rgb to Normal Map").type = 'MoonRayShaderNode_RgbToNormalMap' 167 | layout.operator("node.add_moonray_node", text="Switch Normal Map").type = 'MoonRayShaderNode_SwitchNormalMap' 168 | layout.operator("node.add_moonray_node", text="Transform Normal Map").type = 'MoonRayShaderNode_TransformNormalMap' 169 | 170 | 171 | class MoonRayShaderNodeMenu_Output(bpy.types.Menu): 172 | bl_idname = "NODE_MT_shader_node_add_moonray_output" 173 | bl_label = "Add MoonRay Node" 174 | 175 | def draw(self, context): 176 | layout = self.layout 177 | layout.operator("node.add_moonray_node", text="MoonRay Output").type = 'MoonRayShaderNode_Output' 178 | layout.operator("node.add_moonray_node", text="Bake Camera").type = 'MoonRayShaderNode_BakeCamera' 179 | 180 | 181 | 182 | # Light Nodes 183 | class MoonRayLightShaderNodeMenu(bpy.types.Menu): 184 | bl_idname = "NODE_MT_lightshader_node_add_moonray" 185 | bl_label = "Add MoonRay Node" 186 | 187 | def draw(self, context): 188 | layout = self.layout 189 | layout.menu("NODE_MT_lightshader_node_add_moonray_lightfilter", text="Light Filter") 190 | layout.menu("NODE_MT_lightshader_node_add_moonray_output", text="Output") 191 | 192 | class MoonRayLightShaderNodeMenu_LightFilter(bpy.types.Menu): 193 | bl_idname = "NODE_MT_lightshader_node_add_moonray_lightfilter" 194 | bl_label = "Add MoonRay Node" 195 | 196 | def draw(self, context): 197 | layout = self.layout 198 | layout.operator("node.add_moonray_node", text="Barndoor Light Filter").type = 'MoonRayLightShaderNode_BarnDoorLightFilter' 199 | layout.operator("node.add_moonray_node", text="Color Ramp Light Filter").type = 'MoonRayLightShaderNode_ColorRampLightFilter' 200 | layout.operator("node.add_moonray_node", text="Combine Light Filter").type = 'MoonRayLightShaderNode_CombineLightFilter' 201 | layout.operator("node.add_moonray_node", text="Cookie Light Filter").type = 'MoonRayLightShaderNode_CookieLightFilter' 202 | layout.operator("node.add_moonray_node", text="Cookie Light Filter (v2)").type = 'MoonRayLightShaderNode_CookieLightFilter_v2' 203 | layout.operator("node.add_moonray_node", text="Decay Light Filter").type = 'MoonRayLightShaderNode_DecayLightFilter' 204 | layout.operator("node.add_moonray_node", text="Intensity Light Filter").type = 'MoonRayLightShaderNode_IntensityLightFilter' 205 | layout.operator("node.add_moonray_node", text="Rod Light Filter").type = 'MoonRayLightShaderNode_RodLightFilter' 206 | layout.operator("node.add_moonray_node", text="Vdb Light Filter").type = 'MoonRayLightShaderNode_VdbLightFilter' 207 | 208 | class MoonRayLightShaderNodeMenu_Output(bpy.types.Menu): 209 | bl_idname = "NODE_MT_lightshader_node_add_moonray_output" 210 | bl_label = "Add MoonRay Node" 211 | 212 | def draw(self, context): 213 | layout = self.layout 214 | layout.operator("node.add_moonray_node", text="MoonRay Light Output").type = 'MoonRayLightShaderNode_Output' 215 | 216 | # World Nodes 217 | class MoonRayWorldShaderNodeMenu(bpy.types.Menu): 218 | bl_idname = "NODE_MT_worldshader_node_add_moonray" 219 | bl_label = "Add MoonRay Node" 220 | 221 | def draw(self, context): 222 | layout = self.layout 223 | layout.menu("NODE_MT_worldshader_node_add_moonray_light", text="Light") 224 | layout.menu("NODE_MT_worldshader_node_add_moonray_output", text="Output") 225 | 226 | class MoonRayWorldShaderNodeMenu_Light(bpy.types.Menu): 227 | bl_idname = "NODE_MT_worldshader_node_add_moonray_output" 228 | bl_label = "Add MoonRay Node" 229 | 230 | def draw(self, context): 231 | layout = self.layout 232 | layout.operator("node.add_moonray_node", text="MoonRay World Output").type = 'MoonRayWorldShaderNode_Output' 233 | 234 | class MoonRayWorldShaderNodeMenu_Output(bpy.types.Menu): 235 | bl_idname = "NODE_MT_worldshader_node_add_moonray_output" 236 | bl_label = "Add MoonRay Node" 237 | 238 | def draw(self, context): 239 | layout = self.layout 240 | layout.operator("node.add_moonray_node", text="MoonRay World Output").type = 'MoonRayWorldShaderNode_Output' 241 | 242 | # Compositor Nodes 243 | 244 | class MoonRayCompNodeMenu(bpy.types.Menu): 245 | bl_idname = "NODE_MT_comp_node_add_moonray" 246 | bl_label = "MoonRay" 247 | 248 | def draw(self, context): 249 | layout = self.layout 250 | layout.menu("NODE_MT_comp_node_add_moonray_displayfilter", text="Display Filter") 251 | 252 | class MoonRayCompNodeMenu_DisplayFilter(bpy.types.Menu): 253 | bl_idname = "NODE_MT_comp_node_add_moonray_displayfilter" 254 | bl_label = "Display Filter" 255 | 256 | def draw(self, context): 257 | layout = self.layout 258 | layout.operator("node.add_moonray_node", text="Blend Display Filter").type = 'MoonRayCompNode_BlendDisplayFilter' 259 | layout.operator("node.add_moonray_node", text="Clamp Display Filter").type = 'MoonRayCompNode_ClampDisplayFilter' 260 | layout.operator("node.add_moonray_node", text="Color Correct Display Filter").type = 'MoonRayCompNode_ColorCorrectDisplayFilter' 261 | layout.operator("node.add_moonray_node", text="Constant Display Filter").type = 'MoonRayCompNode_ConstantDisplayFilter' 262 | layout.operator("node.add_moonray_node", text="Convolution Display Filter").type = 'MoonRayCompNode_ConvolutionDisplayFilter' 263 | layout.operator("node.add_moonray_node", text="Discretize Display Filter").type = 'MoonRayCompNode_DiscretizeDisplayFilter' 264 | layout.operator("node.add_moonray_node", text="Dof Display Filter").type = 'MoonRayCompNode_DofDisplayFilter' 265 | layout.operator("node.add_moonray_node", text="Halftone Display Filter").type = 'MoonRayCompNode_HalftoneDisplayFilter' 266 | layout.operator("node.add_moonray_node", text="Image Display Filter").type = 'MoonRayCompNode_ImageDisplayFilter' 267 | layout.operator("node.add_moonray_node", text="Op Display Filter").type = 'MoonRayCompNode_OpDisplayFilter' 268 | layout.operator("node.add_moonray_node", text="Over Display Filter").type = 'MoonRayCompNode_OverDisplayFilter' 269 | layout.operator("node.add_moonray_node", text="Ramp Display Filter").type = 'MoonRayCompNode_RampDisplayFilter' 270 | layout.operator("node.add_moonray_node", text="Remap Display Filter").type = 'MoonRayCompNode_RemapDisplayFilter' 271 | layout.operator("node.add_moonray_node", text="RgbToFloat Display Filter").type = 'MoonRayCompNode_RgbToFloatDisplayFilter' 272 | layout.operator("node.add_moonray_node", text="RgbToHsv Display Filter").type = 'MoonRayCompNode_RgbToHsvDisplayFilter' 273 | layout.operator("node.add_moonray_node", text="Shadow Display Filter").type = 'MoonRayCompNode_ShadowDisplayFilter' 274 | layout.operator("node.add_moonray_node", text="TangentSpace Display Filter").type = 'MoonRayCompNode_TangentSpaceDisplayFilter' 275 | layout.operator("node.add_moonray_node", text="Toon Display Filter").type = 'MoonRayCompNode_ToonDisplayFilter' 276 | 277 | 278 | classes = [MoonRayShaderNodeMenu_Shader, MoonRayShaderNodeMenu_Map, MoonRayShaderNodeMenu_Map_USD, MoonRayShaderNodeMenu_Map_Color, 279 | MoonRayShaderNodeMenu_Output, MoonRayShaderNodeMenu_Displacement, MoonRayShaderNodeMenu_Normal, MoonRayShaderNodeMenu, 280 | MoonRayCompNodeMenu, MoonRayCompNodeMenu_DisplayFilter, MoonRayLightShaderNodeMenu, MoonRayLightShaderNodeMenu_LightFilter, MoonRayLightShaderNodeMenu_Output, 281 | MoonRayWorldShaderNodeMenu, MoonRayWorldShaderNodeMenu_Output 282 | ] 283 | 284 | def shader_menu_draw(self, context): 285 | if context.scene.render.engine == MoonRayRenderEngine.bl_idname: 286 | layout = self.layout 287 | space = context.space_data 288 | 289 | if space.type == 'NODE_EDITOR': 290 | if space.tree_type == 'ShaderNodeTree': 291 | if context.active_object and context.active_object.type == 'LIGHT': 292 | layout.menu("NODE_MT_lightshader_node_add_moonray", text="MoonRay") 293 | else: 294 | layout.menu("NODE_MT_shader_node_add_moonray", text="MoonRay") 295 | elif space.tree_type == 'WorldNodeTree': 296 | layout.menu("NODE_MT_world_node_add_moonray", text="MoonRay") 297 | 298 | def comp_menu_draw(self, context): 299 | if context.scene.render.engine == MoonRayRenderEngine.bl_idname: 300 | layout = self.layout 301 | layout.menu("NODE_MT_comp_node_add_moonray", text="MoonRay") 302 | 303 | # Register the custom shader node 304 | def register(): 305 | for cls in classes: 306 | bpy.utils.register_class(cls) 307 | 308 | bpy.types.NODE_MT_shader_node_add_all.append(shader_menu_draw) 309 | bpy.types.NODE_MT_compositor_node_add_all.append(comp_menu_draw) 310 | 311 | def unregister(): 312 | bpy.types.NODE_MT_shader_node_add_all.remove(shader_menu_draw) 313 | bpy.types.NODE_MT_compositor_node_add_all.remove(comp_menu_draw) 314 | 315 | for cls in reversed(classes): 316 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /ui/mfb_object.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from bpy.props import * 3 | 4 | from .mfb_panel import MOONRAY_PT_Panel 5 | 6 | class MOONRAY_PT_ObjectPanel(MOONRAY_PT_Panel): 7 | bl_label = "MoonRay" 8 | bl_idname = "MOONRAY_PT_ObjectPanel" 9 | bl_space_type = 'PROPERTIES' 10 | bl_region_type = 'WINDOW' 11 | bl_context = "object" 12 | 13 | @classmethod 14 | def poll(cls, context): 15 | return super().poll(context) and context.object and context.object.type != 'LIGHT' 16 | 17 | def draw(self, context): 18 | layout = self.layout 19 | obj = context.object 20 | scene = context.scene 21 | moonray = scene.moonray 22 | 23 | layout.prop(obj.moonray, "is_light") 24 | 25 | layout.prop_search(obj.moonray, "light_set", moonray.light_sets, "items", text="Light Set", results_are_suggestions=True) 26 | layout.prop_search(obj.moonray, "shadow_set", moonray.shadow_sets, "items", text="Shadow Set", results_are_suggestions=True) 27 | layout.prop_search(obj.moonray, "shadowreceiver_set", moonray.shadowreceiver_sets, "items", text="Shadow Receiver Set", results_are_suggestions=True) 28 | layout.prop(obj.moonray, "shadowreceiver_set_input", text="Shadow Receiver Sets") 29 | layout.prop(obj.moonray, "trace_set_input", text="Trace Sets") 30 | 31 | 32 | 33 | class MOONRAY_PT_Object_UserDataPanel(MOONRAY_PT_Panel): 34 | bl_label = "User Data" 35 | bl_idname = "MOONRAY_PT_UserDataPanel" 36 | bl_space_type = 'PROPERTIES' 37 | bl_region_type = 'WINDOW' 38 | bl_context = "object" 39 | bl_parent_id = "MOONRAY_PT_ObjectPanel" 40 | 41 | def draw(self, context): 42 | layout = self.layout 43 | obj = context.object 44 | user_data = obj.moonray.user_data 45 | 46 | row = layout.row() 47 | row.label(text="Add User Data:") 48 | row.operator("moonray.add_userdata", text="", icon='ADD') 49 | 50 | for prop in user_data: 51 | row = layout.row(align=True) 52 | row.prop(prop, "name", text="") 53 | if prop.type == 'BOOL': 54 | row.prop(prop, "value_bool", text="Value") 55 | elif prop.type == 'COLOR': 56 | row.prop(prop, "value_color", text="Value") 57 | elif prop.type == 'FLOAT': 58 | row.prop(prop, "value_float", text="Value") 59 | elif prop.type == 'INTEGER': 60 | row.prop(prop, "value_int", text="Value") 61 | elif prop.type == 'MAT4F': 62 | row.prop(prop, "value_mat4f", text="Value") 63 | elif prop.type == 'STRING': 64 | row.prop(prop, "value_string", text="Value") 65 | elif prop.type == 'VEC2F': 66 | row.prop(prop, "value_vec2f", text="Value") 67 | elif prop.type == 'VEC3F': 68 | row.prop(prop, "value_vec3f", text="Value") 69 | 70 | row.operator("moonray.remove_userdata", text="", icon='X').index = user_data[:].index(prop) 71 | 72 | 73 | 74 | classes = [MOONRAY_PT_ObjectPanel, MOONRAY_PT_Object_UserDataPanel] 75 | 76 | def register(): 77 | for cls in classes: 78 | bpy.utils.register_class(cls) 79 | 80 | def unregister(): 81 | for cls in reversed(classes): 82 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /ui/mfb_output.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | 3 | from .mfb_panel import MOONRAY_PT_Panel 4 | 5 | class MOONRAY_PT_OutputPanel(MOONRAY_PT_Panel): 6 | bl_label = "Output" 7 | bl_idname = "MOONRAY_PT_OutputPanel" 8 | bl_space_type = 'PROPERTIES' 9 | bl_region_type = 'WINDOW' 10 | bl_context = "output" 11 | 12 | def draw(self, context): 13 | layout = self.layout 14 | scene = context.scene 15 | moonray = scene.moonray 16 | 17 | layout.use_property_split = True 18 | layout.use_property_decorate = False 19 | 20 | layout.prop(moonray.output, "channel_format") 21 | layout.prop(moonray.output, "channel_name") 22 | layout.prop(moonray.output, "channel_suffix_mode") 23 | layout.prop(moonray.checkpoint, "checkpoint_active") 24 | 25 | if (moonray.checkpoint.checkpoint_active): 26 | layout.prop(moonray.output, "checkpoint_file_name") 27 | layout.prop(moonray.checkpoint, "checkpoint_bg_write") 28 | layout.prop(moonray.checkpoint, "checkpoint_interval") 29 | layout.prop(moonray.checkpoint, "checkpoint_max_bgcache") 30 | layout.prop(moonray.checkpoint, "checkpoint_max_snapshot_overhead") 31 | layout.prop(moonray.checkpoint, "checkpoint_mode") 32 | layout.prop(moonray.checkpoint, "checkpoint_overwrite") 33 | layout.prop(moonray.checkpoint, "checkpoint_post_script") 34 | layout.prop(moonray.checkpoint, "checkpoint_quality_steps") 35 | layout.prop(moonray.checkpoint, "checkpoint_checkpoint_sample_cap") 36 | layout.prop(moonray.checkpoint, "checkpoint_snapshot_interval") 37 | layout.prop(moonray.checkpoint, "checkpoint_start_sample") 38 | layout.prop(moonray.checkpoint, "checkpoint_time_cap") 39 | layout.prop(moonray.checkpoint, "checkpoint_total_files") 40 | layout.prop(moonray.output, "checkpoint_multi_version_file_name") 41 | 42 | layout.prop(moonray.output, "compression") 43 | layout.prop(moonray.output, "exr_dwa_compression_level") 44 | layout.prop(moonray.output, "exr_header_attributes") 45 | 46 | layout.prop(moonray.output, "file_name") 47 | layout.prop(moonray.output, "file_part") 48 | layout.prop(moonray.output, "lpe") 49 | layout.prop(moonray.output, "material_aov") 50 | layout.prop(moonray.output, "math_filter") 51 | layout.prop(moonray.output, "output_type") 52 | 53 | layout.prop(moonray.output, "primitive_attribute") 54 | layout.prop(moonray.output, "primitive_attribute_type") 55 | 56 | layout.prop(moonray.output, "result") 57 | layout.prop(moonray.output, "resume_file_name") 58 | 59 | layout.prop(moonray.output, "state_variable") 60 | layout.prop(moonray.output, "visibility_aov") 61 | 62 | 63 | 64 | 65 | classes = [MOONRAY_PT_OutputPanel] 66 | 67 | def register(): 68 | for cls in classes: 69 | bpy.utils.register_class(cls) 70 | 71 | def unregister(): 72 | for cls in reversed(classes): 73 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /ui/mfb_panel.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from ..engine import MoonRayRenderEngine 3 | 4 | class MOONRAY_PT_Panel(bpy.types.Panel): 5 | bl_space_type = 'PROPERTIES' 6 | bl_region_type = 'WINDOW' 7 | bl_context = 'render' 8 | COMPAT_ENGINES = {MoonRayRenderEngine.bl_idname} 9 | 10 | @classmethod 11 | def poll(cls, context): 12 | return context.engine in cls.COMPAT_ENGINES 13 | -------------------------------------------------------------------------------- /ui/mfb_render.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | 3 | from .mfb_panel import MOONRAY_PT_Panel 4 | from ..engine import MoonRayRenderEngine 5 | 6 | class MOONRAY_PT_RenderPanel(MOONRAY_PT_Panel): 7 | bl_label = "MoonRay" 8 | bl_idname = "MOONRAY_PT_RenderPanel" 9 | bl_space_type = 'PROPERTIES' 10 | bl_region_type = 'WINDOW' 11 | bl_context = "render" 12 | 13 | def draw(self, context): 14 | layout = self.layout 15 | 16 | class MOONRAY_PT_RenderSettingsPanel(MOONRAY_PT_Panel): 17 | bl_label = "Render Settings" 18 | bl_idname = "MOONRAY_PT_RenderSettingsPanel" 19 | bl_space_type = 'PROPERTIES' 20 | bl_region_type = 'WINDOW' 21 | bl_context = "render" 22 | bl_parent_id = "MOONRAY_PT_RenderPanel" 23 | 24 | def draw(self, context): 25 | layout = self.layout 26 | scene = context.scene 27 | moonray = scene.moonray 28 | 29 | layout.prop(moonray.path_guide, "path_guide_enable") 30 | 31 | class MOONRAY_PT_RenderGlobalsPanel(MOONRAY_PT_Panel): 32 | bl_label = "Render Globals" 33 | bl_idname = "MOONRAY_PT_RenderGlobalsPanel" 34 | bl_space_type = 'PROPERTIES' 35 | bl_region_type = 'WINDOW' 36 | bl_context = "render" 37 | bl_parent_id = "MOONRAY_PT_RenderSettingsPanel" 38 | 39 | def draw(self, context): 40 | layout = self.layout 41 | scene = context.scene 42 | moonray = scene.moonray 43 | 44 | layout.prop(moonray.global_toggles, "enable_displacement") 45 | layout.prop(moonray.global_toggles, "enable_dof") 46 | layout.prop(moonray.global_toggles, "enable_max_geometry_resolution") 47 | layout.prop(moonray.global_toggles, "enable_motion_blur") 48 | layout.prop(moonray.global_toggles, "enable_presence_shadows") 49 | layout.prop(moonray.global_toggles, "enable_shadowing") 50 | layout.prop(moonray.global_toggles, "enable_subsurface_scattering") 51 | layout.prop(moonray.global_toggles, "lights_visible_in_camera") 52 | layout.prop(moonray.global_toggles, "max_geometry_resolution") 53 | layout.prop(moonray.global_toggles, "propagate_visibility_bounce_type") 54 | layout.prop(moonray.global_toggles, "shadow_terminator_fix") 55 | 56 | 57 | class MOONRAY_PT_RenderSamplesPanel(MOONRAY_PT_Panel): 58 | bl_label = "Render Samples" 59 | bl_idname = "MOONRAY_PT_RenderSamplesPanel" 60 | bl_space_type = 'PROPERTIES' 61 | bl_region_type = 'WINDOW' 62 | bl_context = "render" 63 | bl_parent_id = "MOONRAY_PT_RenderSettingsPanel" 64 | 65 | def draw(self, context): 66 | layout = self.layout 67 | scene = context.scene 68 | moonray = scene.moonray 69 | 70 | layout.use_property_split = True 71 | layout.use_property_decorate = False 72 | 73 | layout.prop(moonray.sampling, "bsdf_samples") 74 | layout.prop(moonray.sampling, "bssrdf_samples") 75 | layout.prop(moonray.sampling, "disable_optimized_hair_sampling") 76 | layout.prop(moonray.sampling, "light_samples") 77 | layout.prop(moonray.sampling, "lock_frame_noise") 78 | layout.prop(moonray.sampling, "max_depth") 79 | layout.prop(moonray.sampling, "max_diffuse_depth") 80 | layout.prop(moonray.sampling, "max_glossy_depth") 81 | layout.prop(moonray.sampling, "max_hair_depth") 82 | layout.prop(moonray.sampling, "max_presence_depth") 83 | layout.prop(moonray.sampling, "max_subsurface_per_path") 84 | layout.prop(moonray.sampling, "pixel_samples") 85 | layout.prop(moonray.sampling, "presence_threshold") 86 | layout.prop(moonray.sampling, "russian_roulette_threshold") 87 | layout.prop(moonray.sampling, "transparency_threshold") 88 | 89 | class MOONRAY_PT_RenderVolumePanel(MOONRAY_PT_Panel): 90 | bl_label = "Volume" 91 | bl_idname = "MOONRAY_PT_RenderVolumePanel" 92 | bl_space_type = 'PROPERTIES' 93 | bl_region_type = 'WINDOW' 94 | bl_context = "render" 95 | bl_parent_id = "MOONRAY_PT_RenderSamplesPanel" 96 | 97 | def draw(self, context): 98 | layout = self.layout 99 | scene = context.scene 100 | moonray = scene.moonray 101 | 102 | layout.use_property_split = True 103 | layout.use_property_decorate = False 104 | 105 | layout.prop(moonray.volumes, "max_volume_depth") 106 | layout.prop(moonray.volumes, "volume_attenuation_factor") 107 | layout.prop(moonray.volumes, "volume_contribution_factor") 108 | layout.prop(moonray.volumes, "volume_illumination_samples") 109 | layout.prop(moonray.volumes, "volume_opacity_threshold") 110 | layout.prop(moonray.volumes, "volume_overlap_mode") 111 | layout.prop(moonray.volumes, "volume_phase_attenuation_factor") 112 | layout.prop(moonray.volumes, "volume_quality") 113 | layout.prop(moonray.volumes, "volume_shadow_quality") 114 | 115 | class MOONRAY_PT_RenderFilteringPanel(MOONRAY_PT_Panel): 116 | bl_label = "Filtering" 117 | bl_idname = "MOONRAY_PT_RenderFilteringPanel" 118 | bl_space_type = 'PROPERTIES' 119 | bl_region_type = 'WINDOW' 120 | bl_context = "render" 121 | bl_parent_id = "MOONRAY_PT_RenderSamplesPanel" 122 | 123 | def draw(self, context): 124 | layout = self.layout 125 | scene = context.scene 126 | moonray = scene.moonray 127 | 128 | layout.use_property_split = True 129 | layout.use_property_decorate = False 130 | 131 | layout.prop(moonray.fireflies_removal, "roughness_clamping_factor") 132 | layout.prop(moonray.fireflies_removal, "sample_clamping_depth") 133 | layout.prop(moonray.fireflies_removal, "sample_clamping_value") 134 | 135 | layout.prop(moonray.filtering, "pixel_filter") 136 | layout.prop(moonray.filtering, "pixel_filter_width") 137 | layout.prop(moonray.filtering, "texture_blur") 138 | 139 | 140 | classes = [MOONRAY_PT_RenderPanel, MOONRAY_PT_RenderSettingsPanel, MOONRAY_PT_RenderGlobalsPanel, MOONRAY_PT_RenderSamplesPanel, MOONRAY_PT_RenderVolumePanel, MOONRAY_PT_RenderFilteringPanel] 141 | 142 | 143 | 144 | 145 | def render_header_draw(self, context): 146 | if context.scene.render.engine == MoonRayRenderEngine.bl_idname: 147 | layout = self.layout 148 | scene = context.scene 149 | moonray = scene.moonray 150 | 151 | self.layout.prop(moonray.mfb, "execution_mode") 152 | 153 | def register(): 154 | bpy.types.RENDER_PT_context.append(render_header_draw) 155 | 156 | for cls in classes: 157 | bpy.utils.register_class(cls) 158 | 159 | def unregister(): 160 | bpy.types.RENDER_PT_context.remove(render_header_draw) 161 | 162 | for cls in reversed(classes): 163 | bpy.utils.unregister_class(cls) -------------------------------------------------------------------------------- /ui/mfb_view_layer.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | from bpy.props import * 3 | 4 | from .mfb_panel import MOONRAY_PT_Panel 5 | 6 | 7 | class MOONRAY_UL_SetList(bpy.types.UIList): 8 | def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): 9 | self.use_filter_show = True 10 | if self.layout_type in {'DEFAULT', 'COMPACT'}: 11 | layout.prop(item, "name", text="", emboss=False, icon_value=icon) 12 | elif self.layout_type in {'GRID'}: 13 | layout.alignment = 'CENTER' 14 | layout.label(text="", icon_value=icon) 15 | 16 | class MOONRAY_PT_ViewLayerPanel(MOONRAY_PT_Panel): 17 | bl_label = "MoonRay" 18 | bl_idname = "MOONRAY_PT_ViewLayerPanel" 19 | bl_space_type = 'PROPERTIES' 20 | bl_region_type = 'WINDOW' 21 | bl_context = "view_layer" 22 | 23 | def draw(self, context): 24 | layout = self.layout 25 | scene = context.scene 26 | moonray = scene.moonray 27 | 28 | layout.use_property_split = True 29 | layout.use_property_decorate = False 30 | 31 | layout.prop(moonray.output, "denoise") 32 | layout.prop(moonray.output, "denoiser_input") 33 | layout.prop(moonray.output, "display_filter") 34 | 35 | class MOONRAY_MT_ViewLayer_SetsPanel(MOONRAY_PT_Panel): 36 | bl_label = "Sets" 37 | bl_idname = "MOONRAY_PT_ViewLayer_SetsPanel" 38 | bl_space_type = 'PROPERTIES' 39 | bl_region_type = 'WINDOW' 40 | bl_context = "view_layer" 41 | bl_parent_id = "MOONRAY_PT_ViewLayerPanel" 42 | 43 | def draw(self, context): 44 | layout = self.layout 45 | layout.use_property_split = True 46 | layout.use_property_decorate = False 47 | 48 | class MOONRAY_MT_ViewLayer_CryptomattePanel(MOONRAY_PT_Panel): 49 | bl_label = "Cryptomattes" 50 | bl_idname = "MOONRAY_PT_ViewLayer_CryptomattePanel" 51 | bl_space_type = 'PROPERTIES' 52 | bl_region_type = 'WINDOW' 53 | bl_context = "view_layer" 54 | bl_parent_id = "MOONRAY_PT_ViewLayerPanel" 55 | 56 | def draw(self, context): 57 | layout = self.layout 58 | scene = context.scene 59 | moonray = scene.moonray 60 | 61 | layout.use_property_split = True 62 | layout.use_property_decorate = False 63 | 64 | layout.prop(moonray.output, "cryptomatte_depth") 65 | layout.prop(moonray.output, "cryptomatte_enable_refract") 66 | layout.prop(moonray.output, "cryptomatte_output_beauty") 67 | layout.prop(moonray.output, "cryptomatte_output_normals") 68 | layout.prop(moonray.output, "cryptomatte_output_p0") 69 | layout.prop(moonray.output, "cryptomatte_output_positions") 70 | layout.prop(moonray.output, "cryptomatte_output_refn") 71 | layout.prop(moonray.output, "cryptomatte_output_refp") 72 | layout.prop(moonray.output, "cryptomatte_output_uv") 73 | layout.prop(moonray.output, "cryptomatte_support_resume_render") 74 | 75 | class MOONRAY_MT_ViewLayer_LightFilterPanel(MOONRAY_PT_Panel): 76 | bl_label = "Light Filters" 77 | bl_idname = "MOONRAY_PT_ViewLayer_LightFilterPanel" 78 | bl_space_type = 'PROPERTIES' 79 | bl_region_type = 'WINDOW' 80 | bl_context = "view_layer" 81 | bl_parent_id = "MOONRAY_PT_ViewLayerPanel" 82 | 83 | def draw(self, context): 84 | layout = self.layout 85 | scene = context.scene 86 | moonray = scene.moonray 87 | 88 | layout.use_property_split = True 89 | layout.use_property_decorate = False 90 | 91 | 92 | 93 | class MOONRAY_MT_ViewLayer_LightSetsPanel(MOONRAY_PT_Panel): 94 | bl_label = "Lights" 95 | bl_idname = "MOONRAY_PT_ViewLayer_LightSetsPanel" 96 | bl_space_type = 'PROPERTIES' 97 | bl_region_type = 'WINDOW' 98 | bl_context = "view_layer" 99 | bl_parent_id = "MOONRAY_PT_ViewLayer_SetsPanel" 100 | 101 | def draw(self, context): 102 | layout = self.layout 103 | layout.use_property_split = True 104 | layout.use_property_decorate = False 105 | 106 | 107 | light_sets = context.scene.moonray.light_sets 108 | lightfilter_sets = context.scene.moonray.lightfilter_sets 109 | 110 | layout.label(text="Light Sets") 111 | row = layout.row() 112 | col = row.column() 113 | col.template_list("MOONRAY_UL_SetList", "light_sets", light_sets, 114 | "items", light_sets, "index", rows=3) 115 | 116 | col = row.column() 117 | sub = col.column(align=True) 118 | sub.operator("moonray.add_light_set", icon='ADD', text="") 119 | sub.operator("moonray.remove_light_set", icon='REMOVE', text="") 120 | sub.separator() 121 | 122 | # Light Filter Sets 123 | layout.label(text="Light Filter Sets") 124 | row = layout.row() 125 | col = row.column() 126 | col.template_list("MOONRAY_UL_SetList", "lightfilter_sets", lightfilter_sets, 127 | "items", lightfilter_sets, "index", rows=3) 128 | 129 | col = row.column() 130 | sub = col.column(align=True) 131 | sub.operator("moonray.add_lightfilter_set", icon='ADD', text="") 132 | sub.operator("moonray.remove_lightfilter_set", icon='REMOVE', text="") 133 | sub.separator() 134 | 135 | class MOONRAY_MT_ViewLayer_ShadowSetsPanel(MOONRAY_PT_Panel): 136 | bl_label = "Shadows" 137 | bl_idname = "MOONRAY_PT_ViewLayer_ShadowSetsPanel" 138 | bl_space_type = 'PROPERTIES' 139 | bl_region_type = 'WINDOW' 140 | bl_context = "view_layer" 141 | bl_parent_id = "MOONRAY_PT_ViewLayer_SetsPanel" 142 | 143 | def draw(self, context): 144 | layout = self.layout 145 | layout.use_property_split = True 146 | layout.use_property_decorate = False 147 | 148 | shadow_sets = context.scene.moonray.shadow_sets 149 | shadowreceiver_sets = context.scene.moonray.shadowreceiver_sets 150 | # Shadow Set 151 | 152 | layout.label(text="Shadow Sets") 153 | row = layout.row() 154 | col = row.column() 155 | col.template_list("MOONRAY_UL_SetList", "shadow_sets", shadow_sets, 156 | "items", shadow_sets, "index", rows=3) 157 | 158 | col = row.column() 159 | sub = col.column(align=True) 160 | sub.operator("moonray.add_shadow_set", icon='ADD', text="") 161 | sub.operator("moonray.remove_shadow_set", icon='REMOVE', text="") 162 | sub.separator() 163 | 164 | # Shadow Receiver Set 165 | 166 | layout.label(text="Shadow Receiver Sets") 167 | row = layout.row() 168 | col = row.column() 169 | col.template_list("MOONRAY_UL_SetList", "shadowreceiver_sets", shadowreceiver_sets, 170 | "items", shadowreceiver_sets, "index", rows=3) 171 | 172 | col = row.column() 173 | sub = col.column(align=True) 174 | sub.operator("moonray.add_shadowreceiver_set", icon='ADD', text="") 175 | sub.operator("moonray.remove_shadowreceiver_set", icon='REMOVE', text="") 176 | sub.separator() 177 | 178 | class MOONRAY_MT_ViewLayer_TraceSetsPanel(MOONRAY_PT_Panel): 179 | bl_label = "Trace" 180 | bl_idname = "MOONRAY_PT_ViewLayer_TraceSetsPanel" 181 | bl_space_type = 'PROPERTIES' 182 | bl_region_type = 'WINDOW' 183 | bl_context = "view_layer" 184 | bl_parent_id = "MOONRAY_PT_ViewLayer_SetsPanel" 185 | 186 | def draw(self, context): 187 | layout = self.layout 188 | layout.use_property_split = True 189 | layout.use_property_decorate = False 190 | 191 | trace_sets = context.scene.moonray.trace_sets 192 | 193 | layout.label(text="Trace Sets") 194 | row = layout.row() 195 | col = row.column() 196 | col.template_list("MOONRAY_UL_SetList", "trace_sets", trace_sets, 197 | "items", trace_sets, "index", rows=3) 198 | 199 | col = row.column() 200 | sub = col.column(align=True) 201 | sub.operator("moonray.add_trace_set", icon='ADD', text="") 202 | sub.operator("moonray.remove_trace_set", icon='REMOVE', text="") 203 | sub.separator() 204 | 205 | 206 | classes = [MOONRAY_UL_SetList, MOONRAY_PT_ViewLayerPanel, MOONRAY_MT_ViewLayer_SetsPanel, MOONRAY_MT_ViewLayer_LightSetsPanel, MOONRAY_MT_ViewLayer_ShadowSetsPanel, MOONRAY_MT_ViewLayer_TraceSetsPanel, MOONRAY_MT_ViewLayer_CryptomattePanel, MOONRAY_MT_ViewLayer_LightFilterPanel] 207 | 208 | def register(): 209 | for cls in classes: 210 | bpy.utils.register_class(cls) 211 | 212 | def unregister(): 213 | for cls in reversed(classes): 214 | bpy.utils.unregister_class(cls) --------------------------------------------------------------------------------