Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
5cd33cec
Commit
5cd33cec
authored
11 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
store cycles image nodes (needed for mapping support)
parent
75d99d9b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
io_scene_fbx/cycles_shader_compat.py
+29
-14
29 additions, 14 deletions
io_scene_fbx/cycles_shader_compat.py
with
29 additions
and
14 deletions
io_scene_fbx/cycles_shader_compat.py
+
29
−
14
View file @
5cd33cec
...
...
@@ -47,11 +47,19 @@ class CyclesShaderWrapper():
"
node_mix_color_alpha
"
,
"
node_mix_color_diff
"
,
"
node_mix_color_spec
"
,
"
node_mix_color_
spec_
hard
"
,
"
node_mix_color_hard
"
,
"
node_mix_color_refl
"
,
"
node_mix_color_bump
"
,
"
node_normal_map
"
,
"
node_image_alpha
"
,
"
node_image_diff
"
,
"
node_image_spec
"
,
"
node_image_hard
"
,
"
node_image_refl
"
,
"
node_image_bump
"
,
"
node_image_normalmap
"
,
)
_col_size
=
200
...
...
@@ -223,10 +231,10 @@ class CyclesShaderWrapper():
node
.
inputs
[
"
Fac
"
].
default_value
=
1.0
node
.
inputs
[
"
Color1
"
].
default_value
=
COLOR_WHITE
node
.
inputs
[
"
Color2
"
].
default_value
=
COLOR_BLACK
self
.
node_mix_color_
spec_
hard
=
node
self
.
node_mix_color_hard
=
node
del
node
# Link
links
.
new
(
self
.
node_mix_color_
spec_
hard
.
outputs
[
"
Color
"
],
links
.
new
(
self
.
node_mix_color_hard
.
outputs
[
"
Color
"
],
self
.
node_bsdf_spec
.
inputs
[
"
Roughness
"
])
# --------------------------------------------------------------------
...
...
@@ -293,7 +301,8 @@ class CyclesShaderWrapper():
def
diffuse_image_set
(
self
,
image
):
node
=
self
.
node_mix_color_diff
self
.
_image_create_helper
(
image
,
node
,
(
node
.
inputs
[
"
Color2
"
],))
(
self
.
node_image_diff
=
self
.
_image_create_helper
(
image
,
node
,
(
node
.
inputs
[
"
Color2
"
],)))
def
specular_color_set
(
self
,
color
):
self
.
node_bsdf_spec
.
mute
=
max
(
color
)
<=
0.0
...
...
@@ -301,15 +310,17 @@ class CyclesShaderWrapper():
def
specular_image_set
(
self
,
image
):
node
=
self
.
node_mix_color_spec
self
.
_image_create_helper
(
image
,
node
,
(
node
.
inputs
[
"
Color2
"
],))
(
self
.
node_image_spec
=
self
.
_image_create_helper
(
image
,
node
,
(
node
.
inputs
[
"
Color2
"
],)))
def
hardness_value_set
(
self
,
value
):
node
=
self
.
node_mix_color_
spec_
hard
node
=
self
.
node_mix_color_hard
node
.
inputs
[
"
Color1
"
].
default_value
=
(
value
,)
*
4
def
hardness_image_set
(
self
,
image
):
node
=
self
.
node_mix_color_spec_hard
self
.
_image_create_helper
(
image
,
node
,
(
node
.
inputs
[
"
Color2
"
],))
node
=
self
.
node_mix_color_hard
(
self
.
node_image_hard
=
self
.
_image_create_helper
(
image
,
node
,
(
node
.
inputs
[
"
Color2
"
],)))
def
reflect_color_set
(
self
,
color
):
node
=
self
.
node_mix_color_refl
...
...
@@ -324,7 +335,8 @@ class CyclesShaderWrapper():
def
reflect_image_set
(
self
,
image
):
self
.
node_bsdf_refl
.
mute
=
False
node
=
self
.
node_mix_color_refl
self
.
_image_create_helper
(
image
,
node
,
(
node
.
inputs
[
"
Color2
"
],))
(
self
.
node_image_refl
=
self
.
_image_create_helper
(
image
,
node
,
(
node
.
inputs
[
"
Color2
"
],)))
def
alpha_value_set
(
self
,
value
):
self
.
node_bsdf_alpha
.
mute
&=
(
value
>=
1.0
)
...
...
@@ -337,9 +349,11 @@ class CyclesShaderWrapper():
# note: use_alpha may need to be configurable
# its not always the case that alpha channels use the image alpha
# a greyscale image may also be used.
self
.
_image_create_helper
(
image
,
node
,
(
node
.
inputs
[
"
Color2
"
],),
use_alpha
=
True
)
(
self
.
node_image_alpha
=
self
.
_image_create_helper
(
image
,
node
,
(
node
.
inputs
[
"
Color2
"
],),
use_alpha
=
True
))
def
alpha_image_set_from_diffuse
(
self
):
# XXX, remove?
tree
=
self
.
node_mix_color_diff
.
id_data
links
=
tree
.
links
...
...
@@ -356,9 +370,9 @@ class CyclesShaderWrapper():
def
normal_image_set
(
self
,
image
):
self
.
node_normal_map
.
mute
=
False
node
=
self
.
node_normal_map
node_ima
=
self
.
_image_
create_helper
(
image
,
node
,
(
node
.
inputs
[
"
Color
"
],))
node_ima
.
color_space
=
'
NONE
'
(
self
.
node
_image_
normalmap
=
self
.
_image_create_helper
(
image
,
node
,
(
node
.
inputs
[
"
Color
"
],))
)
self
.
node_ima
ge_normalmap
.
color_space
=
'
NONE
'
def
bump_factor_set
(
self
,
value
):
node
=
self
.
node_mix_color_bump
...
...
@@ -367,4 +381,5 @@ class CyclesShaderWrapper():
def
bump_image_set
(
self
,
image
):
node
=
self
.
node_mix_color_bump
self
.
_image_create_helper
(
image
,
node
,
(
node
.
inputs
[
"
Color2
"
],))
(
self
.
node_image_bump
=
self
.
_image_create_helper
(
image
,
node
,
(
node
.
inputs
[
"
Color2
"
],)))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment