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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons-contrib
Commits
ad8093dd
Commit
ad8093dd
authored
8 years ago
by
kostex
Browse files
Options
Downloads
Patches
Plain Diff
render_renderslot: wrong usage of class and added auto advance option
parent
dbd002fe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
render_renderslot.py
+58
-45
58 additions, 45 deletions
render_renderslot.py
with
58 additions
and
45 deletions
render_renderslot.py
+
58
−
45
View file @
ad8093dd
...
...
@@ -18,7 +18,7 @@
import
bpy
from
bpy.types
import
Operator
from
bpy.props
import
IntProperty
from
bpy.props
import
IntProperty
,
BoolProperty
from
sys
import
platform
from
bpy.app.handlers
import
persistent
...
...
@@ -26,7 +26,7 @@ from bpy.app.handlers import persistent
bl_info
=
{
"
name
"
:
"
KTX RenderSlot
"
,
"
author
"
:
"
Roel Koster, @koelooptiemanna, irc:kostex
"
,
"
version
"
:
(
1
,
2
,
1
),
"
version
"
:
(
1
,
2
,
5
),
"
blender
"
:
(
2
,
7
,
0
),
"
location
"
:
"
Properties Editor > Render > Render
"
,
"
category
"
:
"
Render
"
}
...
...
@@ -35,10 +35,23 @@ bl_info = {
nullpath
=
'
/nul
'
if
platform
==
'
win32
'
else
'
/dev/null
'
class
SlotBuffer
:
class
OccupiedSlots
:
data
=
'
00000000
'
class
KTX_Renderslot_Prefs
(
bpy
.
types
.
AddonPreferences
):
bl_idname
=
__name__
advanced_mode
=
bpy
.
props
.
BoolProperty
(
name
=
"
Advanced Mode
"
,
description
=
"
Gives the addon some advanced options
"
,
default
=
False
)
def
draw
(
self
,
context
):
layout
=
self
.
layout
layout
.
prop
(
self
,
"
advanced_mode
"
)
class
KTX_RenderSlot
(
Operator
):
bl_label
=
"
Select Render Slot
"
bl_idname
=
"
ktx.renderslot
"
...
...
@@ -54,66 +67,66 @@ class KTX_RenderSlot(Operator):
return
{
'
FINISHED
'
}
class
KTX_CheckSlots
(
Operator
):
bl_label
=
"
Check Render Slots
"
bl_idname
=
"
ktx.checkslots
"
bl_description
=
"
Check Render Slots Occupation
"
def
execute
(
self
,
context
):
img
=
bpy
.
data
.
images
[
'
Render Result
'
]
active
=
img
.
render_slots
.
active_index
slots
=
''
for
i
in
range
(
8
):
img
.
render_slots
.
active_index
=
i
try
:
img
.
save_render
(
nullpath
)
slots
=
slots
+
'
1
'
except
:
slots
=
slots
+
'
0
'
bpy
.
context
.
scene
.
ktx_occupied_render_slots
.
data
=
slots
img
.
render_slots
.
active_index
=
active
@persistent
def
checkslots
(
scene
):
img
=
bpy
.
data
.
images
[
'
Render Result
'
]
active
=
img
.
render_slots
.
active_index
slots
=
''
for
i
in
range
(
8
):
img
.
render_slots
.
active_index
=
i
try
:
img
.
save_render
(
nullpath
)
slots
=
slots
+
'
1
'
except
RuntimeError
:
slots
=
slots
+
'
0
'
return
{
'
FINISHED
'
}
scene
.
ktx_occupied_render_slots
.
data
=
slots
if
scene
.
ktx_auto_advance_slot
:
active
+=
1
if
active
==
8
:
active
=
0
img
.
render_slots
.
active_index
=
active
def
ui
(
self
,
context
):
layout
=
self
.
layout
scn
=
context
.
scene
layout
=
self
.
layout
row
=
layout
.
row
(
align
=
True
)
row
.
alignment
=
'
LEFT
'
try
:
active
=
bpy
.
data
.
images
[
'
Render Result
'
].
render_slots
.
active_index
if
bpy
.
context
.
user_preferences
.
addons
[
__name__
].
preferences
.
advanced_mode
:
row
.
prop
(
scn
,
'
ktx_auto_advance_slot
'
,
'
Auto Advance
'
)
row
=
layout
.
row
(
align
=
True
)
row
.
alignment
=
'
LEFT
'
try
:
active
=
bpy
.
data
.
images
[
'
Render Result
'
].
render_slots
.
active_index
row
=
layout
.
row
(
align
=
True
)
row
.
alignment
=
'
EXPAND
'
for
i
in
range
(
8
):
is_active
=
bool
(
i
==
active
)
test_active
=
bool
(
bpy
.
context
.
scene
.
ktx_occupied_render_slots
.
data
[
i
]
==
'
1
'
)
icons
=
"
LAYER_ACTIVE
"
if
test_active
else
"
BLANK1
"
label
=
"
[{}]
"
.
format
(
str
(
i
+
1
))
if
is_active
else
str
(
i
+
1
)
row
.
operator
(
'
ktx.renderslot
'
,
text
=
label
,
icon
=
icons
).
number
=
i
except
:
row
.
label
(
text
=
"
No Render Slots available yet
"
,
icon
=
"
INFO
"
)
@persistent
def
ktx_render_handler
(
scene
):
bpy
.
ops
.
ktx
.
checkslots
()
row
.
alignment
=
'
EXPAND
'
for
i
in
range
(
8
):
is_active
=
bool
(
i
==
active
)
test_active
=
bool
(
scn
.
ktx_occupied_render_slots
.
data
[
i
]
==
'
1
'
)
icons
=
"
LAYER_ACTIVE
"
if
test_active
else
"
BLANK1
"
label
=
"
[{}]
"
.
format
(
str
(
i
+
1
))
if
is_active
else
str
(
i
+
1
)
row
.
operator
(
'
ktx.renderslot
'
,
text
=
label
,
icon
=
icons
).
number
=
i
except
:
scn
.
ktx_occupied_render_slots
.
data
=
'
00000000
'
row
.
label
(
text
=
"
No Render Slots available yet
"
,
icon
=
"
INFO
"
)
def
register
():
bpy
.
utils
.
register_module
(
__name__
)
bpy
.
types
.
RENDER_PT_render
.
prepend
(
ui
)
bpy
.
types
.
Scene
.
ktx_occupied_render_slots
=
SlotBuffer
bpy
.
types
.
Scene
.
ktx_auto_advance_slot
=
BoolProperty
(
default
=
False
,
description
=
"
Auto Advance to Next Slot after a Render
"
)
bpy
.
types
.
Scene
.
ktx_occupied_render_slots
=
OccupiedSlots
bpy
.
app
.
handlers
.
render_post
.
append
(
ktx_render_handler
)
bpy
.
app
.
handlers
.
render_post
.
append
(
checkslots
)
def
unregister
():
bpy
.
utils
.
unregister_module
(
__name__
)
bpy
.
types
.
RENDER_PT_render
.
remove
(
ui
)
del
bpy
.
types
.
Scene
.
ktx_occupied_render_slots
del
bpy
.
types
.
Scene
.
ktx_auto_advance_slot
bpy
.
app
.
handlers
.
render_post
.
remove
(
ktx_render_handler
)
bpy
.
app
.
handlers
.
render_post
.
remove
(
checkslots
)
if
__name__
==
"
__main__
"
:
...
...
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