13 Commits

Author SHA1 Message Date
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