18 Commits

Author SHA1 Message Date
Philipp Oeser
711960b3c2 node_shader_utils: add possibility to override image colorspace
'is_data'

since the move from 'cycles_shader_compat' (2.79) to
'PrincipledBSDFWrapper' (2.8) we lost the ability to (automatically) set
this colorspace setting for imported textures. This was useful for e.g.
normalmaps to always assume 'Non-Color' data.

This adds the possibility to overide and uses this for normalmaps...

Fixes T66368

Reviewers: mont29, brecht

Maniphest Tasks: T66368

Differential Revision: https://developer.blender.org/D5176
2019-07-04 12:32:25 +02:00
andreas atteneder
28f472472b Fix typo pratially breaking node shader wrapper (used by IO add-ons).
Reported with patch as D5140 by andreas atteneder (@atti), thanks!
2019-06-26 17:57:07 +02:00
Bastien Montagne
f9784ea6af Py NodeShader wrapper helper: add support for new Alpha setting of Principled BSDF.
Now that we have real alpha in BSDF, it's much better option for
transparency, than previously used Transmission value.

Related to T64609.
2019-05-15 20:59:58 +02:00
Campbell Barton
7465a5db3b Cleanup: unused args/vars/imports in modules 2019-05-09 13:11:36 +10:00
Campbell Barton
69bf4e5e36 Cleanup: unused variables 2019-03-17 21:14:43 +11:00
Jacques Lucke
1ceaca7f64 Fix T61017: node_shader_utils did not handle diffuse_color correctly 2019-01-30 14:37:09 +01:00
Campbell Barton
7894d6c6f1 Cleanup: line length 2019-01-30 09:06:44 +11:00
Bastien Montagne
2589263b6e Fix related to T57851: broken normalmap handling in py shader wrapper.
Pretty stupid mistake...
2018-11-16 14:59:30 +01:00
Philipp Oeser
cfb6f14616 Fix node_shader_utils: "Specular Tint" is a float (not a color) 2018-11-15 17:52:40 +01:00
Bastien Montagne
65ea9ec948 node_shader_utils: Proper fix for node_normalmap accessor returning ellipsis value.
Ellipsis value is internal ingredient only, to tag hidden _node_normalmap
'real' property as not yet initialized. Public node_normalmap accessor
should never ever have that value, it's either None or a valid node!
2018-10-17 20:18:40 +02:00
Bastien Montagne
5c038a6930 Revert "Fix error on FBX export after material changes"
This reverts commit ce4cfbe108d0641832d86a731ea32f596220b7c5.

Obviously wrong 'fix', please do not touch other dev’s code, especially
in active/WIP area, when you do not fully understand it.
2018-10-17 20:17:02 +02:00
Dalai Felinto
ce4cfbe108 Fix error on FBX export after material changes
Update the addons repository as well.
2018-10-17 17:12:17 +00:00
Bastien Montagne
fb550ca6b9 node_shader_utils: fix bad setting of use_nodes in readonly case.
Also added access to extension property in texture wrapper.
2018-10-16 19:58:50 +02:00
Bastien Montagne
dd6bf3f84a node_shader_utils: several fixes, improvements and cleanups.
Fix broken behavior in case of texcoords mapping (we do need texcoords
node in all cases, then, even for UV coords...).

Use nodes by default when generating new write-allowed wrapper around a
material.

Do not try to find nodes in existing tree all the time, do it only once,
even for lazy-initialized nodes (through accessors).

Fix ugly spacing in property accessors (since it looks like some people
do not like a single 'block' with both getters, setters and prop
definition, at least use one sep line everywhere (and two sep lines to
separate properties)...
2018-10-13 19:36:47 +02:00
Brecht Van Lommel
78390f7724 Python: change node_shader_utils diffuse RGBA to base_color RGB.
Best to give its actual name so it's clear that the Principled BSDF does
not have a diffuse color exactly, and does not have an alpha component.

Also image textures use UVs by default, so avoid creating a texture
coordinate node for that.
2018-10-12 15:55:09 +02:00
Campbell Barton
bda7a333a3 Cleanup: use tuple unpacking 2018-10-01 09:20:32 +10:00
Campbell Barton
0256d8b4e2 Cleanup: pep8, unused import 2018-10-01 09:20:32 +10:00
Bastien Montagne
6f42eb245b Python IO: Initial nodal shader support for import AND export.
That new bpy_extras' node_shader_utils module is remotely based on
existing addons' cycles_shader_compat module. It has some key
differences though:
 - It is based on Principled shader, instead of the noodle combination
   of half a dozen simpler shaders.
 - It does not do any value conversion (like e.g. clamping, which was
   only suited for FBX). Any conversion/adaptation is to be done
   by each IO add-on.
 - It extensively uses accessors to offer:
   - Easy read/write of values, hiding all the hairy noodly nodes
     (principled shader helps a lot here).
   - lazy creation of most nodes on accessing (when generating a
     material), which avoids getting unused nodes in final shader.
 - We only use Principled BSDF so far though, which means some features
   supported by previous system are not yet implemented in new one.

Note that, even though we support 'exporting' side of things, this will
only work for a very specific (and basic) kind of shader. This will have
to be clearly explained in end-user documentation.

Also, that code has had some basic testing, but most certainly needs a
lot more refinement.

As proof-of-concept, OBJ IO script will be updated to use that new
system after that commit.
2018-09-27 23:32:56 +02:00