WIP: MaterialX addon #104594

Closed
Bogdan Nagirniak wants to merge 34 commits from BogdanNagirniak/blender-addons:materialx-addon into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

34 Commits

Author SHA1 Message Date
98f3666ca6 Merge branch 'main' into materialx-addon 2023-09-13 13:52:41 +03:00
7bb38d8687 Merge branch 'main' into materialx-addon 2023-08-28 15:58:22 +03:00
37f156349b Need to improve Normal Maps Quality
### Purpose
Need to improve Normal Maps Quality

### Technical steps
Improved warning message (as it turned out it's `HdStorm` issue)

Pull Request BogdanNagirniak/blender-addons#25
2023-07-28 16:24:30 +02:00
5103b7f446 Caching generated image leads to infinite loop in preview render
### Purpose
Fix infinite loop in preview render when generated image cached.

### Technical steps
Caching images moved from python to C++ part so caching no more triggers Depsgraph updates;

Co-authored-by: Bogdan Nagirniak <bodyan@gmail.com>
Pull Request BogdanNagirniak/blender-addons#15
2023-06-13 18:51:39 +02:00
24186fe54c MaterialX Realtime results update in viewport render
### Purpose
Update after property changes.

### Technical steps
Implemented update_prop using self.socket_value_update (from blender docs: "Update after property changes").
Passed update_prop to "update" argument while generating the node's properties.
Made adjustments to generate_node_classes.py.

### NOTE
Previously generated nodes should be deleted
c:\Users\ ...\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\materialx_data\materialx_nodes\

Pull Request BogdanNagirniak/blender-addons#10
2023-05-18 08:22:00 +02:00
5a9ceb92dc Transmission color doesn't affect the render result
### Purpose
Transmission color doesn't affect the render result.

### Technical steps
Used base_color for specular_color, transmission_color, sheen_color, and coat_color instead of DEFAULT_WHITE_COLOR.
The difference between standard_surface and Principled BSDF is that the latter shares `base color` between diffuse reflection and refraction components.
Removes redundant code.

Pull Request BogdanNagirniak/blender-addons#11
2023-05-16 20:16:21 +02:00
3f7a4984e3 Removed alglib .mtlx as not needed
### Purpose
`alglib` .mtlx files are not needed, it can be removed.

### Technical steps
- Removed `libraries` folder
- Removed `alglib_defs.mtlx` from node code generation.

Pull Request BogdanNagirniak/blender-addons#9
2023-05-10 18:14:15 +02:00
1bfb4ef94f Extend list of supported formats due to enable OIIO for USD.
### Purpose
Extend list of supported formats due to enable OIIO for USD.

### Techical steps
Extend SUPPORTED_FORMATS with `".exr", ".open_exr", ".tif", ".tiff", ".zfile", ".tx"`

Pull Request BogdanNagirniak/blender-addons#8
2023-04-28 17:50:42 +02:00
Bogdan Nagirniak
1423d21450 Merge branch 'main' into materialx-addon 2023-04-11 18:53:50 +03:00
c218b6543d Adjust generating node classes and searching of mtlx files
### Purpose
Folder `materialx` with mtlx files moved to blender.shared in Windows.

### Technical steps
Make FILE_PATH in generated node classes to be local for MX_LIBS_DIR and MX_ADDON_LIBS_DIR.
Added blender.shared to BL_DATA_DIR for Windows.

Pull Request BogdanNagirniak/blender-addons#7
2023-04-11 17:50:43 +02:00
bcc93b0452 BLEN-358: Error in console after closing Blender
**TECHNICAL STEPS**
Added check for input types and warnings if input has inappropriate type. This check added for `Mix` and `Add` nodes for now.

Pull Request BogdanNagirniak/blender-addons#4
2023-04-11 17:16:29 +02:00
61dd62cb6d BLEN-350: Fix error with Add shader node
* Fixed generation of MaterialX nodes
* Fixed nodes `add` and `mix`
* Adjust code for other nodes to fit new requirements

**NOTE FOR REVIEWERS**
You need to regenerate MaterialX nodes for this PR

Pull Request #3
2023-03-17 14:45:33 +01:00
Bogdan Nagirniak
166cd20e89 Merge branch 'main' into materialx-addon 2023-02-16 13:03:28 +02:00
Bogdan Nagirniak
7e65e8a969 Merge branch 'master' into materialx-addon 2023-02-06 17:05:44 +02:00
Bogdan Nagirniak
ba72037bb5
Fixed to use materialx folder in blender (#18) 2023-02-06 17:04:13 +02:00
Bogdan Nagirniak
641fdcd5d4
BLEN-294: Assign MaterialX materials (#17)
BLEN-321: Fix export to mtlx with dependencies
Fixed code in utils.export_to_file() (renamed from export_mx_to_file()).
Made code cleanups/improvements.
2023-01-23 17:47:28 +02:00
Georgiy Markelov
7913e6fbae
Refactoring (#16)
Changed description of addon and moved preference's register/unregister functions to preferences.py

Co-authored-by: markyandex@gmail.com <markyandex@gmail.com>
2022-12-02 01:24:57 +02:00
Georgiy Markelov
dfa1db9e31
BLEN-233: Support MaterialX 1.38.5 (#15)
Added caching of MaterialX Document
Changes:
    getOutput -> getActiveOutput
    getOutputs-> getActiveOutputs
    getInput -> getActiveInput
    getInputs-> getActiveInputs

Co-authored-by: markyandex@gmail.com <markyandex@gmail.com>
2022-12-02 01:22:10 +02:00
Georgiy Markelov
e9826b3008
BLEN-264: Basic integration MaterialX nodes into Blender shader nodetree (#14)
All MaterialX nodes moved to Blender shader node tree.
MaterialX nodes and Blender nodes now work between each other.
It is possible to have MaterialX surfacematerial node or Blender Material Output node for material (both works).
Moved functions import, export, print to console to Blender shader node tree.
Removed: online MatX library, unused code, MatX properties
Moved materialx/ui.py -> ui.py. deleted folder "material". small improvements

Co-authored-by: markyandex@gmail.com <markyandex@gmail.com>
2022-12-01 15:33:45 +02:00
Bogdan Nagirniak
996764f666 Merge branch 'master' into materialx-addon 2022-11-06 18:03:07 +02:00
Georgiy Markelov
c5b73128df
BLEN-245: Fix assign materials: blender shader, materiax (#12) 2022-10-26 19:48:37 +03:00
Georgiy Markelov
abcd6a82d1
added clear_temp_dir on Blender exit (#13) 2022-10-26 19:47:34 +03:00
Vasyl Pidhirskyi
eaac854bd1
BLEN-235: Use MaterialX addon instead mx related code. (#11)
Added get_materialx_data method.
2022-10-25 12:32:53 +03:00
Bogdan Nagirniak
c4e887d5a6
BLEN-229: Adjust code to integrated MaterialX library (#10)
Removed default libraries files.
Fixed export Material editor and MaterialX editor to file.
2022-09-22 11:07:50 +03:00
Bogdan Nagirniak
2b3e80a3a2
BLEN-226: Finalizing MaterialX addon. (#9)
More fixes and cleanups.
Implemented showing MxNodeTree node editor when mx_node_tree is changed.
Fixed loading materialx from matlib.
2022-09-20 17:02:53 +03:00
Vasyl Pidhirskyi
3f18d03ae9
BLEN-222: Make node link invalid if connects different types (#8)
* BLEN-222: Mike node link invalid if connects different types.
Registered timer for update_links.

Co-authored-by: Bogdan Nagirniak <bnagirniak@luxoft.com>
2022-09-19 20:05:56 +03:00
Bogdan Nagirniak
cc589bc916
BLEN-221: Code cleanups, UI improvements (#7)
Made UI improvements: removed unused panels, fixed text, etc.
Made code cleanups and improvements, removed unused code.
Refactoring: moved NodeParser node classes to bl_nodes folder.
Fixed some TODOs.
2022-09-15 12:37:08 +03:00
Vasyl Pidhirskyi
8c3745c394
BLEN-219: Export blender nodes to MX nodes (#6)
* BLEN-219: Export blender nodes to MX nodes.
Added bl_node module.
Added bl_node.nodes module:
- color.py
- converter.py
- input.py
- output.py
- shader.py
- texture.py
- vector.py

Moved manager.URL to utils.MATLIB_URL.
Remove redundant code from material.ui.
Code cleanup.
2022-09-14 15:11:04 +03:00
Bogdan Nagirniak
c677f9dfe7
BLEN-218: Add some tools to preferences (#5)
Implemented AddonPreferences with log_level and dev_tools options.
Changed appdata folder name: materialx -> materiax_data
2022-09-13 16:23:20 +03:00
Georgiy Markelov
23bc2562fc
BLEN-217: MaterialX panel in material tab (#3)
Added drawing MaterialX Node Tree inside Material panel.

Co-authored-by: Bogdan Nagirniak <bnagirniak@luxoft.com>
2022-09-13 16:19:52 +03:00
Bogdan Nagirniak
d2fc8f497c
Code cleanups (#4)
Renamed ADDON_PREFIX to ADDON_ALIAS, made it to use in properties. Made code improvements.
2022-09-13 10:02:07 +03:00
Vasyl Pidhirskyi
a83e948bb8
BLEN-216: Matlib implementation (#2)
Added mathlib module, with ui.py and manager.py.
Added properties module.
Added class MaterialXProperties to be used as a parent for addon PropertyGroups. It sets "materialx" property as parent for addon properties (bpy.context.window_manager.materialx. ...) Added constant variables MATLIB_FOLDER, MATLIB_DIR, currently, it is set to save matlib to addon appdata folder.
2022-09-12 17:50:32 +03:00
Vasyl Pidhirskyi
e50fcd0df3
BLEN-215: Move node classes generation code to Appdata (#1)
Added constant variables ADDON_DATA_DIR, NODE_CLASSES_FOLDER, MX_LIBS_DIR.
Added generate_init_code function to create __init__.py for node_classes.
Small fixes.
2022-09-12 17:31:17 +03:00
Bogdan Nagirniak
c78738087b Create basic MaterialX addon:
- Created basic structure of MaterialX addon
- Added MxNode related classes, generate_node_classes.py, categories.py.
- Added preferences.py, node_tree.py
- Added basic UI for MX node tree
- Added materialx libraries
2022-09-09 14:23:39 +03:00