Skip to content

Commit

Permalink
moved modules into separate packages
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewPeelMV committed Jan 27, 2018
1 parent fb43fe7 commit aaf8c80
Show file tree
Hide file tree
Showing 21 changed files with 609 additions and 744 deletions.
8 changes: 1 addition & 7 deletions __init__.py
@@ -1,14 +1,8 @@
from . import ui_layer_manager
from . import space_view3d
from . import space_info
from . import object_properties_panel
# from . import object_library
from . import library

def register():
ui_layer_manager.register()
space_view3d.register()
space_info.register()
object_properties_panel.register()
library.register()
# object_library.register()
library.register()
4 changes: 4 additions & 0 deletions bp_lib/__init__.py
@@ -0,0 +1,4 @@
from . import assembly
from . import opengl
from . import unit
from . import utils
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion library/group_library.py
@@ -1,6 +1,6 @@
import bpy
import os
from .. import utils
from ..bp_lib import utils
from . import library_utils

OBJECT_FOLDER = os.path.join(library_utils.LIBRARY_FOLDER,"groups")
Expand Down
2 changes: 1 addition & 1 deletion library/material_library.py
@@ -1,6 +1,6 @@
import bpy
import os
from .. import utils
from ..bp_lib import utils
from . import library_utils

MATERIAL_FOLDER = os.path.join(library_utils.LIBRARY_FOLDER,"materials")
Expand Down
2 changes: 1 addition & 1 deletion library/object_library.py
@@ -1,6 +1,6 @@
import bpy
import os
from .. import utils
from ..bp_lib import utils
from . import library_utils

OBJECT_FOLDER = os.path.join(library_utils.LIBRARY_FOLDER,"objects")
Expand Down
6 changes: 6 additions & 0 deletions space_info/__init__.py
@@ -0,0 +1,6 @@
from . import info_ops
from . import info_ui

def register():
info_ops.register()
info_ui.register()
139 changes: 139 additions & 0 deletions space_info/info_ops.py
@@ -0,0 +1,139 @@
import bpy

class OPS_render_settings(bpy.types.Operator):
bl_idname = "info.render_settings"
bl_label = "Render Settings"

room_builder_tabs = bpy.props.EnumProperty(name="Room Builder Tabs",
items=[('MAIN',"Main Settings","Displays the Main Rendering Options"),
('LIGHTING',"Lighting","Library of Room Assets"),
('2D',"2D Views","Creates 2D Views For your Room")],
default='MAIN')

def execute(self, context):
return {'FINISHED'}

def check(self,context):
return True

def invoke(self,context,event):
wm = context.window_manager
return wm.invoke_props_dialog(self, width=400)

def draw(self, context):
layout = self.layout
scene = bpy.context.scene
rd = scene.render
cycles = scene.cycles
image_settings = rd.image_settings

rl = rd.layers.active
linestyle = rl.freestyle_settings.linesets[0].linestyle

box = layout.box()
row = box.row(align=True)
if rd.has_multiple_engines:
row.prop(rd, "engine", text="Rendering Engine")

row = box.row()
row.prop(cycles, "device", text="CPU")

row = box.row(align=True)
row.label(text="Render Size:",icon='STICKY_UVS_VERT')
row.prop(rd, "resolution_x", text="X")
row.prop(rd, "resolution_y", text="Y")
row = box.row(align=True)
row.label("Resolution Percentage:")
row.prop(rd, "resolution_percentage", text="")

row = box.row()
row.label(text="Rendering Quality:",icon='IMAGE_COL')
row.prop(scene.cycles,"samples",text='Passes')
row = box.row()
row.label(text="Image Format:",icon='IMAGE_DATA')
row.prop(image_settings,"file_format",text="")
row = box.row()
row.label(text="Display Mode:",icon='RENDER_RESULT')
row.prop(rd,"display_mode",text="")
row = box.row()
row.label(text="Use Transparent Film:",icon='SEQUENCE')
row.prop(scene.cycles,"film_transparent",text='')

row = box.row()
row.prop(rd, "use_freestyle", text="Use Freestyle")
if rd.use_freestyle:
row = box.row()
row.prop(linestyle, "color", text="Line Color")
row = box.row()
row.prop(bpy.data.worlds[0], "horizon_color", text="Background Color")

class OPS_change_interface(bpy.types.Operator):
bl_idname = "info.change_interface"
bl_label = "Change Interface"
bl_description = "Select to change active interface layout"

interface_name = bpy.props.StringProperty(name="Interface Name",default = "New Interface")

def execute(self, context):
context.window.screen = bpy.data.screens[self.interface_name]
return {'FINISHED'}

class OPS_duplicate_current_interface(bpy.types.Operator):
bl_idname = "info.copy_current_interface"
bl_label = "Duplicate Current Interface"
bl_description = "This will copy the active interface layout"

interface_name = bpy.props.StringProperty(name="Interface Name",default = "New Interface")

def execute(self, context):
bpy.ops.screen.new()
context.window.screen.name = self.interface_name
# screen.new() doesn't set screen to be active
# manually have to clean up blenders renaming
for screen in bpy.data.screens:
screen.name = screen.name.replace(".001","")
bpy.ops.info.change_interface(interface_name = self.interface_name)
return {'FINISHED'}

def check(self,context):
return True

def invoke(self,context,event):
wm = context.window_manager
return wm.invoke_props_dialog(self, width=400)

def draw(self, context):
layout = self.layout
layout.label("Enter a name for the new interface")
layout.prop(self,'interface_name')

class OPS_delete_current_interface(bpy.types.Operator):
bl_idname = "info.delete_current_interface"
bl_label = "Delete Current Interface"
bl_description = "This will delete the active interface layout"

def execute(self, context):
bpy.ops.screen.delete()
return {'FINISHED'}

def check(self,context):
return True

def invoke(self,context,event):
wm = context.window_manager
return wm.invoke_props_dialog(self, width=400)

def draw(self, context):
layout = self.layout
layout.label("Are you sure you want to delete the active interface layout")
layout.label("Active Interface Layout: " + context.window.screen.name)

def register():

bpy.utils.register_class(OPS_render_settings)
bpy.utils.register_class(OPS_change_interface)
bpy.utils.register_class(OPS_duplicate_current_interface)
bpy.utils.register_class(OPS_delete_current_interface)

def unregister():
pass
145 changes: 1 addition & 144 deletions space_info.py → space_info/info_ui.py
Expand Up @@ -16,8 +16,6 @@ def draw(self, context):
if window.screen.show_fullscreen:
layout.operator("screen.back_to_previous", icon='SCREEN_BACK', text="Back to Previous")
layout.separator()
# else:
# layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete")
layout.separator()
if context.active_object:
if context.active_object.mode == 'EDIT':
Expand All @@ -38,10 +36,7 @@ def draw(self, context):
props.use_scripts = True

row.operator("script.autoexec_warn_clear", text="Ignore")
return

# if rd.has_multiple_engines:
# row.prop(rd, "engine", text="")
return

row.label(text=scene.statistics(), translate=False)

Expand Down Expand Up @@ -115,10 +110,6 @@ def draw(self, context):

layout.menu("USERPREF_MT_app_templates", icon='FILE_BLEND')

layout.separator()

layout.menu("INFO_MT_addons", icon='PLUGIN')

layout.separator()

layout.menu("INFO_MT_file_external_data", icon='EXTERNAL_DATA')
Expand Down Expand Up @@ -167,137 +158,7 @@ def draw(self, context):
layout.separator()
layout.operator('info.copy_current_interface',icon='GHOST')
layout.operator('info.delete_current_interface',icon='X')

class OPS_render_settings(bpy.types.Operator):
bl_idname = "info.render_settings"
bl_label = "Render Settings"

room_builder_tabs = bpy.props.EnumProperty(name="Room Builder Tabs",
items=[('MAIN',"Main Settings","Displays the Main Rendering Options"),
('LIGHTING',"Lighting","Library of Room Assets"),
('2D',"2D Views","Creates 2D Views For your Room")],
default='MAIN')

def execute(self, context):
return {'FINISHED'}

def check(self,context):
return True

def invoke(self,context,event):
wm = context.window_manager
return wm.invoke_props_dialog(self, width=400)

def draw(self, context):
layout = self.layout
scene = bpy.context.scene
rd = scene.render
cycles = scene.cycles
image_settings = rd.image_settings
# ui = context.scene.mv.ui

rl = rd.layers.active
linestyle = rl.freestyle_settings.linesets[0].linestyle

box = layout.box()
row = box.row(align=True)
if rd.has_multiple_engines:
row.prop(rd, "engine", text="Rendering Engine")

row = box.row()
row.prop(cycles, "device", text="CPU")

row = box.row(align=True)
row.label(text="Render Size:",icon='STICKY_UVS_VERT')
row.prop(rd, "resolution_x", text="X")
row.prop(rd, "resolution_y", text="Y")
row = box.row(align=True)
row.label("Resolution Percentage:")
row.prop(rd, "resolution_percentage", text="")

# if ui.render_type_tabs == 'PRR':
row = box.row()
row.label(text="Rendering Quality:",icon='IMAGE_COL')
row.prop(scene.cycles,"samples",text='Passes')
row = box.row()
row.label(text="Image Format:",icon='IMAGE_DATA')
row.prop(image_settings,"file_format",text="")
row = box.row()
row.label(text="Display Mode:",icon='RENDER_RESULT')
row.prop(rd,"display_mode",text="")
row = box.row()
row.label(text="Use Transparent Film:",icon='SEQUENCE')
row.prop(scene.cycles,"film_transparent",text='')

row = box.row()
row.prop(rd, "use_freestyle", text="Use Freestyle")
if rd.use_freestyle:
row = box.row()
row.prop(linestyle, "color", text="Line Color")
row = box.row()
row.prop(bpy.data.worlds[0], "horizon_color", text="Background Color")

class OPS_change_interface(bpy.types.Operator):
bl_idname = "info.change_interface"
bl_label = "Change Interface"
bl_description = "Select to change active interface layout"

interface_name = bpy.props.StringProperty(name="Interface Name",default = "New Interface")

def execute(self, context):
context.window.screen = bpy.data.screens[self.interface_name]
return {'FINISHED'}

class OPS_duplicate_current_interface(bpy.types.Operator):
bl_idname = "info.copy_current_interface"
bl_label = "Duplicate Current Interface"
bl_description = "This will copy the active interface layout"

interface_name = bpy.props.StringProperty(name="Interface Name",default = "New Interface")

def execute(self, context):
bpy.ops.screen.new()
context.window.screen.name = self.interface_name
# screen.new() doesn't set screen to be active
# manually have to clean up blenders renaming
for screen in bpy.data.screens:
screen.name = screen.name.replace(".001","")
bpy.ops.info.change_interface(interface_name = self.interface_name)
return {'FINISHED'}

def check(self,context):
return True

def invoke(self,context,event):
wm = context.window_manager
return wm.invoke_props_dialog(self, width=400)

def draw(self, context):
layout = self.layout
layout.label("Enter a name for the new interface")
layout.prop(self,'interface_name')

class OPS_delete_current_interface(bpy.types.Operator):
bl_idname = "info.delete_current_interface"
bl_label = "Delete Current Interface"
bl_description = "This will delete the active interface layout"

def execute(self, context):
bpy.ops.screen.delete()
return {'FINISHED'}

def check(self,context):
return True

def invoke(self,context,event):
wm = context.window_manager
return wm.invoke_props_dialog(self, width=400)

def draw(self, context):
layout = self.layout
layout.label("Are you sure you want to delete the active interface layout")
layout.label("Active Interface Layout: " + context.window.screen.name)

def register():

bpy.utils.register_class(INFO_HT_header)
Expand All @@ -306,10 +167,6 @@ def register():
bpy.utils.register_class(INFO_MT_edit)
bpy.utils.register_class(INFO_MT_rendering)
bpy.utils.register_class(INFO_MT_interface)
bpy.utils.register_class(OPS_render_settings)
bpy.utils.register_class(OPS_change_interface)
bpy.utils.register_class(OPS_duplicate_current_interface)
bpy.utils.register_class(OPS_delete_current_interface)

def unregister():
pass
10 changes: 10 additions & 0 deletions space_view3d/__init__.py
@@ -0,0 +1,10 @@
from . import view3d_ui
from . import view3d_ops
from . import object_properties_panel
from . import ui_layer_manager

def register():
view3d_ui.register()
view3d_ops.register()
object_properties_panel.register()
ui_layer_manager.register()

0 comments on commit aaf8c80

Please sign in to comment.