Adding project files to project template
This commit is contained in:
158
client.py
Normal file
158
client.py
Normal file
@@ -0,0 +1,158 @@
|
||||
import bpy
|
||||
|
||||
from bpy.types import Panel, Operator, PropertyGroup, UIList
|
||||
from bpy.props import (StringProperty,
|
||||
BoolProperty,
|
||||
IntProperty,
|
||||
FloatProperty,
|
||||
EnumProperty,
|
||||
PointerProperty,
|
||||
CollectionProperty
|
||||
)
|
||||
|
||||
|
||||
class PBPBlendFileProperty(PropertyGroup):
|
||||
path = StringProperty(subtype="FILE_PATH")
|
||||
filename = StringProperty(subtype="FILE_NAME")
|
||||
blending_enabled = BoolProperty(
|
||||
name="Enable or Disable",
|
||||
description="Enable blend file for blending",
|
||||
default=False)
|
||||
status = StringProperty(
|
||||
name="Status",
|
||||
description="Status of current file",
|
||||
default=""
|
||||
)
|
||||
|
||||
|
||||
class PBPWorkerProperty(PropertyGroup):
|
||||
hostname = StringProperty()
|
||||
port = StringProperty()
|
||||
remote_project_path = StringProperty()
|
||||
blending_enabled = BoolProperty(
|
||||
name="Enable or Disable",
|
||||
description="Enable farm for blending",
|
||||
default=False)
|
||||
status = StringProperty(
|
||||
name="Status",
|
||||
description="Status of current file",
|
||||
default=""
|
||||
)
|
||||
|
||||
|
||||
class PBPProperties(PropertyGroup):
|
||||
project_folder = StringProperty(
|
||||
name="Project folder",
|
||||
description="Path to project folder",
|
||||
default="//",
|
||||
subtype="DIR_PATH"
|
||||
)
|
||||
worker_list = CollectionProperty(type=PBPWorkerProperty)
|
||||
worker_list_index = IntProperty(name="Index for my_list", default=0)
|
||||
|
||||
blend_file_list = CollectionProperty(type=PBPBlendFileProperty)
|
||||
upload_status = StringProperty(
|
||||
name="Upload status",
|
||||
description="Status of current upload",
|
||||
default=""
|
||||
)
|
||||
|
||||
|
||||
class RENDER_UL_workers(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
layout.label(item.hostname)
|
||||
|
||||
|
||||
class PBPProjectPanel(Panel):
|
||||
bl_idname = "RENDER_PT_PBP_project_panel"
|
||||
bl_label = "PBP Workers Settings"
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "render"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
# layout.operator(ProjectManagerStartBlend.bl_idname)
|
||||
configuration = context.window_manager.push_blend_pull
|
||||
layout.label(text="Workers")
|
||||
|
||||
row = layout.row()
|
||||
col = row.column()
|
||||
col.template_list("RENDER_UL_workers", "", configuration, "worker_list", configuration, "worker_list_index", rows=2)
|
||||
|
||||
col = row.column()
|
||||
sub = col.column(align=True)
|
||||
sub.operator("render.pbp_add_worker", icon='ZOOMIN', text="")
|
||||
sub.operator("render.pbp_del_worker", icon='ZOOMOUT', text="")
|
||||
|
||||
|
||||
class PBPWorkersPanel(Panel):
|
||||
bl_idname = "RENDER_PT_PBP_workers_panel"
|
||||
bl_label = "PBP Workers Settings"
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "render"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
# layout.operator(ProjectManagerStartBlend.bl_idname)
|
||||
configuration = context.window_manager.push_blend_pull
|
||||
layout.label(text="Workers")
|
||||
|
||||
row = layout.row()
|
||||
col = row.column()
|
||||
col.template_list("RENDER_UL_workers", "", configuration, "worker_list", configuration, "worker_list_index", rows=2)
|
||||
|
||||
col = row.column()
|
||||
sub = col.column(align=True)
|
||||
sub.operator("render.pbp_add_worker", icon='ZOOMIN', text="")
|
||||
sub.operator("render.pbp_del_worker", icon='ZOOMOUT', text="")
|
||||
|
||||
|
||||
class PBPAddWorkerOperator(Operator):
|
||||
bl_idname = "render.pbp_add_worker"
|
||||
bl_label = "Add a worker"
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
wm = context.window_manager
|
||||
return wm.invoke_props_dialog(self, width=600)
|
||||
|
||||
def draw(self, context):
|
||||
configuration = context.window_manager.push_blend_pull
|
||||
new_worker = configuration.worker_list.add()
|
||||
layout = self.layout
|
||||
row = layout.row(align=True)
|
||||
row.prop(new_worker, "hostname")
|
||||
row.prop(new_worker, "port")
|
||||
row.prop(new_worker, "remote_project_path")
|
||||
row.prop(new_worker, "blending_enabled")
|
||||
|
||||
|
||||
class PBPDelWorkerOperator(Operator):
|
||||
bl_idname = "render.pbp_del_worker"
|
||||
bl_label = "Remove a worker"
|
||||
|
||||
def execute(self, context):
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def register():
|
||||
|
||||
bpy.utils.register_class(RENDER_UL_workers)
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.types.WindowManager.push_blend_pull = PointerProperty(type=PBPProperties)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
del bpy.types.WindowManager.push_blend_pull
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
Reference in New Issue
Block a user