Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons-contrib
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons-contrib
Commits
dbcad37b
Commit
dbcad37b
authored
Nov 25, 2010
by
Fabio Russo
Browse files
Options
Downloads
Patches
Plain Diff
== Clay Render ==
Bug: Memory Overload resolved Feature: When you disable addons the clay material is removed
parent
91fc6f07
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
render_clay.py
+50
-55
50 additions, 55 deletions
render_clay.py
with
50 additions
and
55 deletions
render_clay.py
+
50
−
55
View file @
dbcad37b
...
@@ -21,8 +21,9 @@
...
@@ -21,8 +21,9 @@
bl_addon_info
=
{
bl_addon_info
=
{
"
name
"
:
"
Clay Render
"
,
"
name
"
:
"
Clay Render
"
,
"
author
"
:
"
Fabio Russo <ruesp83@libero.it>
"
,
"
author
"
:
"
Fabio Russo <ruesp83@libero.it>
"
,
"
version
"
:
(
0
,
5
),
"
version
"
:
(
0
,
7
),
"
blender
"
:
(
2
,
5
,
5
),
"
blender
"
:
(
2
,
5
,
5
),
"
api
"
:
33112
,
"
location
"
:
"
Render > Clay Render
"
,
"
location
"
:
"
Render > Clay Render
"
,
"
description
"
:
"
This script, applies a temporary material to all objects
"
\
"
description
"
:
"
This script, applies a temporary material to all objects
"
\
"
of the scene.
"
,
"
of the scene.
"
,
...
@@ -33,31 +34,10 @@ bl_addon_info = {
...
@@ -33,31 +34,10 @@ bl_addon_info = {
"
category
"
:
"
Render
"
}
"
category
"
:
"
Render
"
}
import
bpy
import
bpy
from
bpy.props
import
BoolProperty
from
bpy.props
import
BoolProperty
bpy
.
types
.
Scene
.
Clay
=
BoolProperty
(
name
=
'
Clay Render
'
,
description
=
'
Use Clay Render
'
,
default
=
False
)
def
search
():
mats
=
bpy
.
data
.
materials
Find
=
False
id
=
None
for
m
in
mats
:
if
m
.
name
==
"
Clay_Render
"
:
id
=
m
Find
=
True
break
return
id
def
create_mat
():
def
create_mat
():
id
=
search
()
if
id
==
None
:
id
=
bpy
.
data
.
materials
.
new
(
"
Clay_Render
"
)
id
=
bpy
.
data
.
materials
.
new
(
"
Clay_Render
"
)
#diffuse
#diffuse
id
.
diffuse_shader
=
"
OREN_NAYAR
"
id
.
diffuse_shader
=
"
OREN_NAYAR
"
...
@@ -69,46 +49,61 @@ def create_mat():
...
@@ -69,46 +49,61 @@ def create_mat():
id
.
specular_color
=
1
,
1
,
1
id
.
specular_color
=
1
,
1
,
1
id
.
specular_hardness
=
10
id
.
specular_hardness
=
10
id
.
specular_intensity
=
0.115
id
.
specular_intensity
=
0.115
return
id
class
CheckClay
(
bpy
.
types
.
Operator
):
bl_idname
=
"
render.clay
"
bl_label
=
"
Clay Render
"
def
execute
(
self
,
context
):
global
im
if
bpy
.
types
.
Scene
.
Clay
:
context
.
scene
.
render
.
layers
.
active
.
material_override
=
im
bpy
.
types
.
Scene
.
Clay
=
False
else
:
context
.
scene
.
render
.
layers
.
active
.
material_override
=
None
bpy
.
types
.
Scene
.
Clay
=
True
return
{
'
FINISHED
'
}
def
draw_clay
(
self
,
context
):
def
draw_clay
(
self
,
context
):
layout
=
self
.
layout
global
im
sd
=
context
.
scene
ok_clay
=
not
bpy
.
types
.
Scene
.
Clay
rnd
=
context
.
scene
.
render
rnd
=
context
.
scene
.
render
rnl
=
rnd
.
layers
.
active
rnl
=
rnd
.
layers
.
active
if
im
==
None
:
im
=
create_mat
()
create_mat
()
split
=
self
.
layout
.
split
()
split
=
layout
.
split
()
col
=
split
.
column
()
col
=
split
.
column
()
col
.
operator
(
CheckClay
.
bl_idname
,
emboss
=
False
,
icon
=
'
CHECKBOX_HLT
'
\
col
.
prop
(
sd
,
"
Clay
"
,)
if
ok_clay
else
'
CHECKBOX_DEHLT
'
)
col
=
split
.
column
()
col
=
split
.
column
()
col
.
prop
(
im
,
"
diffuse_color
"
,
text
=
""
)
id
=
search
()
col
.
prop
(
id
,
"
diffuse_color
"
,
text
=
""
)
self
.
layout
.
separator
()
self
.
layout
.
separator
()
App_Clay
=
context
.
scene
.
Clay
if
App_Clay
:
rnl
.
material_override
=
id
col
.
active
=
True
else
:
rnl
.
material_override
=
None
col
.
active
=
False
def
register
():
def
register
():
global
im
bpy
.
types
.
Scene
.
Clay
=
BoolProperty
(
name
=
'
Clay Render
'
,
description
=
'
Use Clay Render
'
,
default
=
False
)
im
=
None
bpy
.
types
.
RENDER_PT_render
.
prepend
(
draw_clay
)
bpy
.
types
.
RENDER_PT_render
.
prepend
(
draw_clay
)
pass
def
unregister
():
def
unregister
():
global
im
rnd
=
bpy
.
context
.
scene
.
render
rnd
=
bpy
.
context
.
scene
.
render
rnl
=
rnd
.
layers
.
active
rnl
=
rnd
.
layers
.
active
rnl
.
material_override
=
None
rnl
.
material_override
=
None
bpy
.
data
.
materials
.
remove
(
im
)
del
bpy
.
types
.
Scene
.
Clay
bpy
.
types
.
RENDER_PT_render
.
remove
(
draw_clay
)
bpy
.
types
.
RENDER_PT_render
.
remove
(
draw_clay
)
pass
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
register
()
register
()
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
sign in
to comment