1
$\begingroup$

I trying to see if this is possible. I want to have the ability to choose which frames to re-render with checkboxes.

First issue I am having is that the checkboxes active and de-active together. I build the checkboxes with a for statement. How to create unique checkboxes?

lastly, is it possible to obtain a list of active checkboxes? I want to use this to render specific frames.

The Print Operator is to test the Checkbox list before I attempt to the render Operator

import bpy
import os 
from bpy.props import (StringProperty, BoolProperty, IntProperty, FloatProperty, FloatVectorProperty, EnumProperty, PointerProperty,)
from bpy.types import (Panel, Menu, Operator, PropertyGroup,)

###########     Scene Properties         ###########
class BoolProperties(PropertyGroup):

    frame_bool: BoolProperty(
        name= "checkbox name",
        description="A bool property",
        default = True,
        
        )

###########     Test Operator - Print    ###########
class PRINT_OT_Check(bpy.types.Operator):
    bl_idname = "print.checkboxes"
    bl_label = "Print Checkboxes"
    bl_description = "Print Active Checkboxes"
    
    def execute(self, context):
        
        return {'FINISHED'}
    
###########     Test Operator - Render   ###########
class PRINT_OT_Check(bpy.types.Operator):
    bl_idname = "render.checkboxes"
    bl_label = "Render Checkboxes"
    bl_description = "Render Active Checkboxes"
    
    def execute(self, context):
        
        return {'FINISHED'}
    
###########     Panel in Active Tool     ###########
class FANCY_PT_Panel(Panel):
    bl_label = "Checkbox Panel"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_category = 'Tool'

    @classmethod
    def poll(self,context):
        return context.object is not None
        
    def draw(self, context):
        layout = self.layout
        col = layout.column(align=True)
        
        colortool = bpy.context.scene.color_tool
        
        fstart = bpy.context.scene.frame_start
        fend = bpy.context.scene.frame_end + 1
        if fend > 21:
            fend = 21
        collection = list(range(fstart, fend))
          
        layout.label(text="Colorway Render Selection:")
        row = layout.row()
        row.operator('render.checkboxes', text="Render Active Checkboxes")
        row = layout.row()
        row.operator('print.checkboxes', text="Print Active Checkboxes")
        row = layout.row()
###Checkbox generator###
        for y in range(len(collection)):
            checkname = str(y + 1)
            row.prop(colortool, "frame_bool", text = checkname, icon = 'MATCLOTH')

###########     Registration             ###########
def register():
    bpy.utils.register_class(BoolProperties)
    bpy.utils.register_class(PRINT_OT_Check)
    bpy.utils.register_class(FANCY_PT_Panel)
    
    bpy.types.Scene.color_tool = PointerProperty(type=BoolProperties)

def unregister():
    bpy.utils.unregister_class(BoolProperties)
    bpy.utils.unregister_class(PRINT_OT_Check)
    bpy.utils.unregister_class(FANCY_PT_Panel)
    

if __name__ == "__main__":
    register()
```
$\endgroup$
2
  • $\begingroup$ Short answer, yes it is possible, before going down that route Consider how a print dialog does this via a string property, eg 1, 2, 3, 8-14, 17 ie print pages 1. 2. 3. 8 to 14 and 17. $\endgroup$
    – batFINGER
    Jul 30 '20 at 13:43
  • $\begingroup$ You realize your print and render classes have the same name? You only have one stored boolean for all the checkboxes. See blender.stackexchange.com/questions/6975/… Finally, I agree with @batFINGER, there are too many checkboxes in a row on that panel $\endgroup$
    – Ron Jensen
    Jul 30 '20 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.