diff options
author | meta-androcto <meta.androcto1@gmail.com> | 2016-08-12 10:26:04 +0300 |
---|---|---|
committer | meta-androcto <meta.androcto1@gmail.com> | 2016-08-12 10:26:04 +0300 |
commit | 840f04f1addce56c0449451091df1c90f6bbbaef (patch) | |
tree | b2bfc416422764b113ce82180b81b2837016d3f3 | |
parent | a04af35e720b10c776f2e0ea94a09c08cd14a842 (diff) |
update oscurart tools: clean up & restore functions thanks lijenstina, oscurart
-rw-r--r-- | oscurart_tools/__init__.py | 218 | ||||
-rw-r--r-- | oscurart_tools/oscurart_animation.py | 21 | ||||
-rw-r--r-- | oscurart_tools/oscurart_files.py | 54 | ||||
-rw-r--r-- | oscurart_tools/oscurart_meshes.py | 50 | ||||
-rw-r--r-- | oscurart_tools/oscurart_objects.py | 33 | ||||
-rw-r--r-- | oscurart_tools/oscurart_overrides.py | 294 | ||||
-rw-r--r-- | oscurart_tools/oscurart_render.py | 280 |
7 files changed, 814 insertions, 136 deletions
diff --git a/oscurart_tools/__init__.py b/oscurart_tools/__init__.py index 7c64b462..07beb3fc 100644 --- a/oscurart_tools/__init__.py +++ b/oscurart_tools/__init__.py @@ -20,18 +20,29 @@ bl_info = { "name": "Oscurart Tools", - "author": "Oscurart, CodemanX, Meta-Androcto", - "version": (3, 2), + "author": "Oscurart, CodemanX", + "version": (3, 2, 1), "blender": (2, 77, 0), "location": "View3D > Tools > Oscurart Tools", "description": "Tools for objects, render, shapes, and files.", "warning": "", "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/3D_interaction/Oscurart_Tools", + "tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/", "category": "Object", } import bpy + +from . import oscurart_files +from . import oscurart_meshes +from . import oscurart_objects +from . import oscurart_shapes +from . import oscurart_render +from . import oscurart_overrides +from . import oscurart_animation + +import bpy from bpy.types import ( AddonPreferences, Panel, @@ -44,62 +55,26 @@ from bpy.props import ( IntProperty, ) -from . import oscurart_files -from . import oscurart_meshes -from . import oscurart_objects -from . import oscurart_shapes -from . import oscurart_render -from . import oscurart_animation - - class View3DOscPanel(PropertyGroup): + bl_space_type = 'VIEW_3D' + bl_region_type = 'TOOLS' + # CREA PANELES EN TOOLS - osc_object_tools = BoolProperty(default=True) - osc_mesh_tools = BoolProperty(default=True) - osc_shapes_tools = BoolProperty(default=True) - osc_render_tools = BoolProperty(default=True) - osc_files_tools = BoolProperty(default=True) - osc_animation_tools = BoolProperty(default=True) - - quick_animation_in = IntProperty( - default=1 - ) - quick_animation_out = IntProperty( - default=250 - ) - # SETEO VARIABLE DE ENTORNO - SearchAndSelectOt = StringProperty( - default="Object name initials" - ) - # RENDER CROP - rcPARTS = IntProperty( - default=1, - min=2, - max=50, - step=1 - ) - RenameObjectOt = StringProperty( - default="Type here" - ) - - -class VarColArchivos(PropertyGroup): - filename = bpy.props.StringProperty( - name="", - default="" - ) - value = bpy.props.IntProperty( - name="", - default=10 - ) - fullpath = bpy.props.StringProperty( - name="", - default="" - ) - checkbox = bpy.props.BoolProperty( - name="", - default=True - ) + osc_object_tools = BoolProperty(default=False) + osc_mesh_tools = BoolProperty(default=False) + osc_shapes_tools = BoolProperty(default=False) + osc_render_tools = BoolProperty(default=False) + osc_files_tools = BoolProperty(default=False) + osc_overrides_tools = BoolProperty(default=False) + osc_animation_tools = BoolProperty(default=False) + + # PARA ESCENAS NUEVAS + overrides = bpy.props.StringProperty(default="[]") + + +class OscOverridesProp(PropertyGroup): + matoverride = bpy.props.StringProperty() + grooverride = bpy.props.StringProperty() # PANELES @@ -123,6 +98,7 @@ class OscPanelControl(Panel): col.prop(oscurart, "osc_animation_tools", text="Animation", icon="POSE_DATA") col.prop(oscurart, "osc_render_tools", text="Render", icon="SCENE") col.prop(oscurart, "osc_files_tools", text="Files", icon="IMASEL") + col.prop(oscurart, "osc_overrides_tools", text="Overrides", icon="GREASEPENCIL") class OscPanelObject(Panel): @@ -149,10 +125,10 @@ class OscPanelObject(Panel): colrow = col.row(align=1) colrow.operator("object.objects_to_groups", icon="GROUP") colrow = col.row(align=1) - colrow.prop(bpy.context.scene.oscurart, "SearchAndSelectOt", text="") + colrow.prop(bpy.context.scene, "SearchAndSelectOt", text="") colrow.operator("object.search_and_select_osc", icon="ZOOM_SELECTED") colrow = col.row(align=1) - colrow.prop(bpy.context.scene.oscurart, "RenameObjectOt", text="") + colrow.prop(bpy.context.scene, "RenameObjectOt", text="") colrow.operator("object.rename_objects_osc", icon="SHORTDISPLAY") col.operator( "object.distribute_osc", @@ -267,6 +243,14 @@ class OscPanelRender(Panel): "render.copy_render_settings_osc", icon="LIBRARY_DATA_DIRECT", text="Copy Cycles Settings").mode = "cycles" + col.operator( + "file.create_batch_maker_osc", + icon="LINENUMBERS_ON", + text="Make Render Batch") + col.operator( + "file.create_batch_python", + icon="LINENUMBERS_ON", + text="Make Python Batch") colrow = col.row(align=1) colrow.operator( "render.render_all_scenes_osc", @@ -286,7 +270,7 @@ class OscPanelRender(Panel): colrow = col.row(align=1) colrow.operator("render.render_crop_osc", icon="RENDER_REGION") - colrow.prop(bpy.context.scene.oscurart, "rcPARTS", text="Parts") + colrow.prop(bpy.context.scene, "rcPARTS", text="Parts") boxcol = layout.box().column(align=1) colrow = boxcol.row(align=1) @@ -296,7 +280,7 @@ class OscPanelRender(Panel): text="Selected Scenes").frametype = False colrow.operator( "render.render_selected_scenes_osc", - text="> Frame").frametype = True + text="> Fame").frametype = True for sc in bpy.data.scenes[:]: boxcol.prop(sc, "use_render_scene", text=sc.name) @@ -317,8 +301,58 @@ class OscPanelFiles(Panel): def draw(self, context): layout = self.layout col = layout.column(align=1) + col.operator("file.save_incremental_osc", icon="NEW") col.operator("image.reload_images_osc", icon="IMAGE_COL") col.operator("file.sync_missing_groups", icon="LINK_AREA") + col = layout.column(align=1) + colrow = col.row(align=1) + colrow.prop(bpy.context.scene, "oscSearchText", text="") + colrow.prop(bpy.context.scene, "oscReplaceText", text="") + col.operator("file.replace_file_path_osc", icon="SHORTDISPLAY") + + +class OscPanelOverrides(Panel): + bl_idname = "Oscurart Overrides" + bl_label = "Overrides Tools" + bl_category = "Oscurart Tools" + bl_space_type = 'VIEW_3D' + bl_region_type = 'TOOLS' + bl_options = {'DEFAULT_CLOSED'} + + @classmethod + def poll(cls, context): + return context.scene.oscurart.osc_overrides_tools + + def draw(self, context): + layout = self.layout + box = layout.box() + col = box.column(align=1) + + # col.operator("render.overrides_set_list", text="Create Override + # List", icon="GREASEPENCIL") + col.label(text="Active Scene: " + bpy.context.scene.name) + col.label(text="Example: [[Group,Material]]") + col.prop(bpy.context.scene.oscurart, "overrides", text="") + col.operator( + "render.check_overrides", + text="Check List", + icon="ZOOM_ALL") + col.operator("render.overrides_on", text="On / Off", icon="QUIT") + col.label( + text=str("OVERRIDES: ON" if bpy.use_overrides else "OVERRIDES: OFF")) + + box = layout.box() + boxcol = box.column(align=1) + boxcol.label(text="Danger Zone") + boxcolrow = boxcol.row(align=1) + boxcolrow.operator( + "render.apply_overrides", + text="Apply Overrides", + icon="ERROR") + boxcolrow.operator( + "render.restore_overrides", + text="Restore Overrides", + icon="ERROR") class OscPanelAnimation(Panel): @@ -340,8 +374,43 @@ class OscPanelAnimation(Panel): col.operator("anim.quick_parent_osc", icon="OUTLINER_DATA_POSE") row = col.row(align=1) - row.prop(bpy.context.scene.oscurart, "quick_animation_in", text="") - row.prop(bpy.context.scene.oscurart, "quick_animation_out", text="") + row.prop(bpy.context.scene, "quick_animation_in", text="") + row.prop(bpy.context.scene, "quick_animation_out", text="") + + +# Addons Preferences Update Panel + +def update_panel(self, context): + try: + bpy.utils.unregister_class(OscPanelControl) + bpy.utils.unregister_class(OscPanelObject) + bpy.utils.unregister_class(OscPanelMesh) + bpy.utils.unregister_class(OscPanelShapes) + bpy.utils.unregister_class(OscPanelRender) + bpy.utils.unregister_class(OscPanelFiles) + bpy.utils.unregister_class(OscPanelOverrides) + bpy.utils.unregister_class(OscPanelAnimation) + except: + pass + + addon_prefs = context.user_preferences.addons[__name__].preferences + + OscPanelControl.bl_category = addon_prefs.category + bpy.utils.register_class(OscPanelControl) + OscPanelObject.bl_category = addon_prefs.category + bpy.utils.register_class(OscPanelObject) + OscPanelMesh.bl_category = addon_prefs.category + bpy.utils.register_class(OscPanelMesh) + OscPanelShapes.bl_category = addon_prefs.category + bpy.utils.register_class(OscPanelShapes) + OscPanelRender.bl_category = addon_prefs.category + bpy.utils.register_class(OscPanelRender) + OscPanelFiles.bl_category = addon_prefs.category + bpy.utils.register_class(OscPanelFiles) + OscPanelOverrides.bl_category = addon_prefs.category + bpy.utils.register_class(OscPanelOverrides) + OscPanelAnimation.bl_category = addon_prefs.category + bpy.utils.register_class(OscPanelAnimation) class OscurartToolsAddonPreferences(bpy.types.AddonPreferences): @@ -349,13 +418,15 @@ class OscurartToolsAddonPreferences(bpy.types.AddonPreferences): # when defining this in a submodule of a python package. bl_idname = __name__ - category = StringProperty( + category = bpy.props.StringProperty( name="Category", description="Choose a name for the category of the panel", default="Oscurart Tools", + update=update_panel, ) def draw(self, context): + layout = self.layout row = layout.row() col = row.column() @@ -368,20 +439,23 @@ class OscurartToolsAddonPreferences(bpy.types.AddonPreferences): def register(): bpy.utils.register_module(__name__) - bpy.types.Scene.oscurart = bpy.props.PointerProperty( - type=View3DOscPanel - ) - bpy.types.Scene.use_render_scene = bpy.props.BoolProperty() + bpy.types.Scene.oscurart = bpy.props.PointerProperty(type=View3DOscPanel) + + bpy.types.Scene.ovlist = bpy.props.CollectionProperty(type=OscOverridesProp) - bpy.types.Scene.broken_files = bpy.props.CollectionProperty( - type=VarColArchivos - ) + bpy.types.Scene.quick_animation_in = bpy.props.IntProperty(default=1) + bpy.types.Scene.quick_animation_out = bpy.props.IntProperty(default=250) + + # SETEO VARIABLE DE ENTORNO + bpy.types.Scene.SearchAndSelectOt = bpy.props.StringProperty( + default="Object name initials") def unregister(): del bpy.types.Scene.oscurart - del bpy.types.Scene.use_render_scene - del bpy.types.Scene.broken_files + del bpy.types.Scene.quick_animation_in + del bpy.types.Scene.quick_animation_out + del bpy.types.Scene.SearchAndSelectOt bpy.utils.unregister_module(__name__) diff --git a/oscurart_tools/oscurart_animation.py b/oscurart_tools/oscurart_animation.py index 8a3e552a..bf2095b8 100644 --- a/oscurart_tools/oscurart_animation.py +++ b/oscurart_tools/oscurart_animation.py @@ -21,16 +21,16 @@ import bpy from mathutils import Matrix -# -------------------------QUICK PARENT------------------ +# ---------------------------QUICK PARENT------------------ def DefQuickParent(inf, out): if bpy.context.object.type == "ARMATURE": ob = bpy.context.object target = [object for object in bpy.context.selected_objects if object != ob][0] - ob = (bpy.context.active_pose_bone if bpy.context.object.type == 'ARMATURE' else bpy.context.object) + ob = bpy.context.active_pose_bone if bpy.context.object.type == 'ARMATURE' else bpy.context.object target.select = False - bpy.context.scene.frame_set(frame=bpy.context.scene.oscurart.quick_animation_in) + bpy.context.scene.frame_set(frame=bpy.context.scene.quick_animation_in) a = Matrix(target.matrix_world) a.invert() i = Matrix(ob.matrix) @@ -41,9 +41,9 @@ def DefQuickParent(inf, out): else: ob = bpy.context.object target = [object for object in bpy.context.selected_objects if object != ob][0] - ob = (bpy.context.active_pose_bone if bpy.context.object.type == 'ARMATURE' else bpy.context.object) + ob = bpy.context.active_pose_bone if bpy.context.object.type == 'ARMATURE' else bpy.context.object target.select = False - bpy.context.scene.frame_set(frame=bpy.context.scene.oscurart.quick_animation_in) + bpy.context.scene.frame_set(frame=bpy.context.scene.quick_animation_in) a = Matrix(target.matrix_world) a.invert() i = Matrix(ob.matrix_world) @@ -53,18 +53,13 @@ def DefQuickParent(inf, out): bpy.ops.anim.keyframe_insert(type="LocRotScale") -class QuickParent(bpy.types.Operator): +class QuickParent (bpy.types.Operator): bl_idname = "anim.quick_parent_osc" bl_label = "Quick Parent" bl_options = {"REGISTER", "UNDO"} - @classmethod - def poll(cls, context): - return (context.active_object is not None and - len(context.selected_objects) > 1) - def execute(self, context): DefQuickParent( - bpy.context.scene.oscurart.quick_animation_in, - bpy.context.scene.oscurart.quick_animation_out) + bpy.context.scene.quick_animation_in, + bpy.context.scene.quick_animation_out) return {'FINISHED'} diff --git a/oscurart_tools/oscurart_files.py b/oscurart_tools/oscurart_files.py index c3a82d7f..b829e8d9 100644 --- a/oscurart_tools/oscurart_files.py +++ b/oscurart_tools/oscurart_files.py @@ -22,9 +22,10 @@ import bpy from bpy.types import Operator -# ---------------------RELOAD IMAGES------------------ +# ---------------------------RELOAD IMAGES------------------ -class reloadImages(Operator): + +class reloadImages (Operator): bl_idname = "image.reload_images_osc" bl_label = "Reload Images" bl_options = {"REGISTER", "UNDO"} @@ -35,7 +36,54 @@ class reloadImages(Operator): return {'FINISHED'} -# --------------- SYNC MISSING GROUPS ----------------- +# ------------------------ SAVE INCREMENTAL ------------------------ + +class saveIncremental(Operator): + bl_idname = "file.save_incremental_osc" + bl_label = "Save Incremental File" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + filepath = bpy.data.filepath + if filepath.count("_v"): + strnum = filepath.rpartition("_v")[-1].rpartition(".blend")[0] + intnum = int(strnum) + modnum = strnum.replace(str(intnum), str(intnum + 1)) + output = filepath.replace(strnum, modnum) + basename = os.path.basename(filepath) + bpy.ops.wm.save_as_mainfile( + filepath=os.path.join(os.path.dirname(filepath), "%s_v%s.blend" % + (basename.rpartition("_v")[0], str(modnum)))) + + else: + output = filepath.rpartition(".blend")[0] + "_v01" + bpy.ops.wm.save_as_mainfile(filepath=output) + + return {'FINISHED'} + +# ------------------------ REPLACE FILE PATHS ------------------------ + +bpy.types.Scene.oscSearchText = bpy.props.StringProperty(default="Search Text") +bpy.types.Scene.oscReplaceText = bpy.props.StringProperty( + default="Replace Text") + + +class replaceFilePath(Operator): + bl_idname = "file.replace_file_path_osc" + bl_label = "Replace File Path" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + TEXTSEARCH = bpy.context.scene.oscSearchText + TEXTREPLACE = bpy.context.scene.oscReplaceText + + for image in bpy.data.images: + image.filepath = image.filepath.replace(TEXTSEARCH, TEXTREPLACE) + + return {'FINISHED'} + + +# ---------------------- SYNC MISSING GROUPS -------------------------- class reFreshMissingGroups(Operator): bl_idname = "file.sync_missing_groups" diff --git a/oscurart_tools/oscurart_meshes.py b/oscurart_tools/oscurart_meshes.py index 99116a08..4269e6a8 100644 --- a/oscurart_tools/oscurart_meshes.py +++ b/oscurart_tools/oscurart_meshes.py @@ -32,9 +32,12 @@ import time import blf from bpy_extras.view3d_utils import location_3d_to_region_2d +C = bpy.context +D = bpy.data # -----------------------------RECONST--------------------------- + def defReconst(self, OFFSET): bpy.ops.object.mode_set(mode='EDIT', toggle=False) bpy.context.tool_settings.mesh_select_mode = (True, True, True) @@ -73,7 +76,7 @@ def defReconst(self, OFFSET): use_subsurf_data=0) -class reConst(Operator): +class reConst (Operator): bl_idname = "mesh.reconst_osc" bl_label = "ReConst Mesh" bl_options = {"REGISTER", "UNDO"} @@ -93,9 +96,9 @@ class reConst(Operator): defReconst(self, self.OFFSET) return {'FINISHED'} - # -----------------------------------SELECT LEFT--------------------- + def side(self, nombre, offset): bpy.ops.object.mode_set(mode="EDIT", toggle=0) @@ -144,15 +147,15 @@ class SelectMenor (Operator): # -------------------------RESYM VG---------------------------------- -class resymVertexGroups(Operator): + +class resymVertexGroups (Operator): bl_idname = "mesh.resym_vertex_weights_osc" bl_label = "Resym Vertex Weights" bl_options = {"REGISTER", "UNDO"} @classmethod def poll(cls, context): - return (context.active_object is not None and - context.active_object.type == 'MESH') + return context.active_object is not None def execute(self, context): @@ -175,15 +178,14 @@ class resymVertexGroups(Operator): # ------------------------IMPORT EXPORT GROUPS-------------------- -class OscExportVG(Operator): +class OscExportVG (Operator): bl_idname = "file.export_groups_osc" bl_label = "Export Groups" bl_options = {"REGISTER", "UNDO"} @classmethod def poll(cls, context): - return (context.active_object is not None and - context.active_object.type == 'MESH') + return context.active_object is not None def execute(self, context): @@ -201,15 +203,14 @@ class OscExportVG(Operator): return {'FINISHED'} -class OscImportVG(Operator): +class OscImportVG (Operator): bl_idname = "file.import_groups_osc" bl_label = "Import Groups" bl_options = {"REGISTER", "UNDO"} @classmethod def poll(cls, context): - return (context.active_object is not None and - context.active_object.type == 'MESH') + return context.active_object is not None def execute(self, context): @@ -233,6 +234,7 @@ class OscImportVG(Operator): # ------------------------------------ RESYM MESH------------------------- + def reSymSave(self, quality): bpy.ops.object.mode_set(mode='OBJECT') @@ -302,7 +304,7 @@ def reSymMesh(self, SELECTED, SIDE): MEMA(SYMAP) -class OscResymSave(Operator): +class OscResymSave (Operator): bl_idname = "mesh.resym_save_map" bl_label = "Resym save XML Map" bl_options = {"REGISTER", "UNDO"} @@ -322,15 +324,14 @@ class OscResymSave(Operator): return {'FINISHED'} -class OscResymMesh(Operator): +class OscResymMesh (Operator): bl_idname = "mesh.resym_mesh" bl_label = "Resym save Apply XML" bl_options = {"REGISTER", "UNDO"} @classmethod def poll(cls, context): - return (context.active_object is not None and - context.active_object.type == 'MESH') + return context.active_object is not None selected = BoolProperty( default=False, @@ -364,9 +365,12 @@ def DefOscObjectToMesh(): class OscObjectToMesh(Operator): bl_idname = "mesh.object_to_mesh_osc" + bl_idname = "mesh.object_to_mesh_osc" + bl_label = "Object To Mesh" bl_label = "Object To Mesh" bl_description = "Works on Meshes, Meta objects, Curves and Surfaces" + @classmethod def poll(cls, context): return (context.active_object is not None and @@ -374,13 +378,14 @@ class OscObjectToMesh(Operator): {'MESH', 'META', 'CURVE', 'SURFACE'}) def execute(self, context): - print("Active type object is", context.object.type) - DefOscObjectToMesh() - return {'FINISHED'} + print("Active type object is", context.object.type) + DefOscObjectToMesh() + return {'FINISHED'} # ----------------------------- OVERLAP UV ------------------------------- + def DefOscOverlapUv(valpresicion): inicio = time.time() mode = bpy.context.object.mode @@ -423,7 +428,7 @@ def DefOscOverlapUv(valpresicion): for lloop in lif[l]: for rloop in lif[r]: if (verteqind[vertexvert[lloop]] == vertexvert[rloop] and - ob.data.uv_layers.active.data[rloop].select): + ob.data.uv_layers.active.data[rloop].select): ob.data.uv_layers.active.data[ lloop].uv = ob.data.uv_layers.active.data[ @@ -455,9 +460,9 @@ class OscOverlapUv(Operator): DefOscOverlapUv(self.presicion) return {'FINISHED'} - # ------------------------------- IO VERTEX COLORS -------------------- + def DefOscExportVC(): with open(os.path.join(os.path.dirname(bpy.data.filepath), bpy.context.object.name) + ".vc", mode="w") as file: ob = bpy.context.object @@ -474,7 +479,7 @@ def DefOscImportVC(): loopind].color = di[loopind] -class OscExportVC(Operator): +class OscExportVC (Operator): bl_idname = "mesh.export_vertex_colors" bl_label = "Export Vertex Colors" bl_options = {"REGISTER", "UNDO"} @@ -489,7 +494,7 @@ class OscExportVC(Operator): return {'FINISHED'} -class OscImportVC(Operator): +class OscImportVC (Operator): bl_idname = "mesh.import_vertex_colors" bl_label = "Import Vertex Colors" bl_options = {"REGISTER", "UNDO"} @@ -506,6 +511,7 @@ class OscImportVC(Operator): # ------------------ PRINT VERTICES ---------------------- + def dibuja_callback(self, context): font_id = 0 bm = bmesh.from_edit_mesh(bpy.context.object.data) diff --git a/oscurart_tools/oscurart_objects.py b/oscurart_tools/oscurart_objects.py index ffae4aae..01d4e0d3 100644 --- a/oscurart_tools/oscurart_objects.py +++ b/oscurart_tools/oscurart_objects.py @@ -19,18 +19,17 @@ # <pep8 compliant> import bpy +import os from bpy.types import Operator from bpy.props import BoolProperty -import os from bpy_extras.object_utils import world_to_camera_view - # ------------------------ SEARCH AND SELECT ------------------------ -class SearchAndSelectOt(Operator): + +class SearchAndSelectOt(bpy.types.Operator): bl_idname = "object.search_and_select_osc" bl_label = "Search And Select" - bl_description = "Selection based upon object names in the scene" bl_options = {"REGISTER", "UNDO"} start = BoolProperty(name="Start With", default=True) @@ -39,7 +38,7 @@ class SearchAndSelectOt(Operator): def execute(self, context): for objeto in bpy.context.scene.objects: - variableNombre = bpy.context.scene.oscurart.SearchAndSelectOt + variableNombre = bpy.context.scene.SearchAndSelectOt if self.start: if objeto.name.startswith(variableNombre): objeto.select = True @@ -54,6 +53,10 @@ class SearchAndSelectOt(Operator): # -------------------------RENAME OBJECTS---------------------------------- +# CREO VARIABLE +bpy.types.Scene.RenameObjectOt = bpy.props.StringProperty(default="Type here") + + class renameObjectsOt (Operator): bl_idname = "object.rename_objects_osc" bl_label = "Rename Objects" @@ -62,7 +65,7 @@ class renameObjectsOt (Operator): def execute(self, context): listaObj = bpy.context.selected_objects[:] for objeto in listaObj: - objeto.name = bpy.context.scene.oscurart.RenameObjectOt + objeto.name = bpy.context.scene.RenameObjectOt return {'FINISHED'} @@ -71,7 +74,6 @@ class renameObjectsOt (Operator): class oscRemModifiers (Operator): bl_idname = "object.modifiers_remove_osc" bl_label = "Remove modifiers" - bl_description = "Removes all modifiers on all selected objects" bl_options = {"REGISTER", "UNDO"} def execute(self, context): @@ -86,8 +88,6 @@ class oscRemModifiers (Operator): class oscApplyModifiers (Operator): bl_idname = "object.modifiers_apply_osc" bl_label = "Apply modifiers" - bl_description = ("Applies all modifiers on all selected objects \n" - "Warning: Make single user will be applied on Linked Object data") bl_options = {"REGISTER", "UNDO"} def execute(self, context): @@ -117,14 +117,17 @@ class oscApplyModifiers (Operator): # ------------------------------------ RELINK OBJECTS--------------------- + def relinkObjects(self): + LISTSCENE = [] if bpy.selection_osc: for SCENE in bpy.data.scenes[:]: if SCENE.objects: if bpy.selection_osc[-1] in SCENE.objects[:]: LISTSCENE.append(SCENE) + if LISTSCENE: OBJECTS = bpy.selection_osc[:-1] @@ -135,6 +138,7 @@ def relinkObjects(self): bpy.ops.object.select_all(action='DESELECT') + for OBJETO in OBJECTS: if OBJETO.users != len(bpy.data.scenes): print(OBJETO.name) @@ -150,7 +154,7 @@ def relinkObjects(self): self.report({'INFO'}, message="Scenes are empty") -class OscRelinkObjectsBetween(Operator): +class OscRelinkObjectsBetween (Operator): bl_idname = "object.relink_objects_between_scenes" bl_label = "Relink Objects Between Scenes" bl_options = {"REGISTER", "UNDO"} @@ -162,9 +166,11 @@ class OscRelinkObjectsBetween(Operator): # ------------------------------------ COPY GROUPS AND LAYERS------------- + def CopyObjectGroupsAndLayers(self): OBSEL = bpy.selection_osc[:] + if OBSEL: GLOBALLAYERS = list(OBSEL[-1].layers[:]) ACTSCENE = bpy.context.scene @@ -247,9 +253,9 @@ class OscSelection(bpy.types.Header): row.label("Sels: "+str(len(bpy.selection_osc))) """ - # =============== DISTRIBUTE ====================== + def ObjectDistributeOscurart(self, X, Y, Z): if len(bpy.selection_osc[:]) > 1: # VARIABLES @@ -295,6 +301,7 @@ class DialogDistributeOsc(Operator): # ======================== SET LAYERS TO OTHER SCENES ==================== + def DefSetLayersToOtherScenes(): actsc = bpy.context.screen.scene for object in bpy.context.selected_objects[:]: @@ -489,7 +496,7 @@ def duplicateSymmetrical(self, disconect): bpy.context.active_object.driver_remove("scale") -class oscDuplicateSymmetricalOp(Operator): +class oscDuplicateSymmetricalOp (Operator): bl_idname = "object.duplicate_object_symmetry_osc" bl_label = "Oscurart Duplicate Symmetrical" bl_options = {"REGISTER", "UNDO"} @@ -516,7 +523,7 @@ def DefObjectToGroups(): scgr.objects.link(ob) -class ObjectsToGroups(Operator): +class ObjectsToGroups (Operator): bl_idname = "object.objects_to_groups" bl_label = "Objects to Groups" bl_options = {"REGISTER", "UNDO"} diff --git a/oscurart_tools/oscurart_overrides.py b/oscurart_tools/oscurart_overrides.py new file mode 100644 index 00000000..994b766a --- /dev/null +++ b/oscurart_tools/oscurart_overrides.py @@ -0,0 +1,294 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# <pep8 compliant> + +import bpy +from bpy.types import Operator, Panel +import os + + +# ------------------APPLY AND RESTORE OVERRIDES ------------------ + +def DefOscApplyOverrides(self): + types = {'MESH', 'META', 'CURVE'} + for ob in bpy.data.objects: + if ob.type in types: + if not len(ob.material_slots): + ob.data.materials.append(None) + slotlist = {ob: [sl.material for sl in ob.material_slots] + for ob in bpy.data.objects if ob.type in types if len(ob.material_slots)} + with open("%s_override.txt" % (os.path.join(os.path.dirname(bpy.data.filepath), + bpy.context.scene.name)), mode="w") as file: + file.write(str(slotlist)) + scene = bpy.context.scene + proptolist = list(eval(scene.oscurart.overrides)) + for group, material in proptolist: + for object in bpy.data.groups[group].objects: + lenslots = len(object.material_slots) + if object.type in types: + if len(object.data.materials): + object.data.materials.clear() + for newslot in range(lenslots): + object.data.materials.append( + bpy.data.materials[material]) + + +def DefOscRestoreOverrides(self): + with open("%s_override.txt" % (os.path.join(os.path.dirname(bpy.data.filepath), + bpy.context.scene.name)), mode="r") as file: + slotlist = eval(file.read()) + for ob, slots in slotlist.items(): + ob.data.materials.clear() + for slot in slots: + ob.data.materials.append(slot) + + +# HAND OPERATOR + +class OscApplyOverrides(Operator): + bl_idname = "render.apply_overrides" + bl_label = "Apply Overrides in this Scene" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + DefOscApplyOverrides(self) + return {'FINISHED'} + + +class OscRestoreOverrides(Operator): + bl_idname = "render.restore_overrides" + bl_label = "Restore Overrides in this Scene" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + DefOscRestoreOverrides(self) + return {'FINISHED'} + +bpy.use_overrides = False + + +class OscOverridesOn(Operator): + bl_idname = "render.overrides_on" + bl_label = "Turn On Overrides" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + if bpy.use_overrides is False: + bpy.app.handlers.render_pre.append(DefOscApplyOverrides) + bpy.app.handlers.render_post.append(DefOscRestoreOverrides) + bpy.use_overrides = True + print("Overrides on!") + else: + bpy.app.handlers.render_pre.remove(DefOscApplyOverrides) + bpy.app.handlers.render_post.remove(DefOscRestoreOverrides) + bpy.use_overrides = False + print("Overrides off!") + return {'FINISHED'} + + +# -------------------- CHECK OVERRIDES ------------------- + +class OscCheckOverrides(Operator): + bl_idname = "render.check_overrides" + bl_label = "Check Overrides" + bl_options = {"REGISTER", "UNDO"} + + def execute(self, context): + GROUPI = False + GLOBAL = 0 + GLOBALERROR = 0 + + print("==== STARTING CHECKING ====") + print("") + + for SCENE in bpy.data.scenes[:]: + MATLIST = [] + MATI = False + + for MATERIAL in bpy.data.materials[:]: + MATLIST.append(MATERIAL.name) + + GROUPLIST = [] + for GROUP in bpy.data.groups[:]: + if GROUP.users > 0: + GROUPLIST.append(GROUP.name) + + print(" %s Scene is checking" % (SCENE.name)) + + for OVERRIDE in list(eval(SCENE.oscurart.overrides)): + # REVISO OVERRIDES EN GRUPOS + if OVERRIDE[0] in GROUPLIST: + pass + else: + print("** %s group are in conflict." % (OVERRIDE[0])) + GROUPI = True + GLOBALERROR += 1 + # REVISO OVERRIDES EN GRUPOS + if OVERRIDE[1] in MATLIST: + pass + else: + print("** %s material are in conflict." % (OVERRIDE[1])) + MATI = True + GLOBALERROR += 1 + + if MATI is False: + print("-- Materials are ok.") + else: + GLOBAL += 1 + if GROUPI is False: + print("-- Groups are ok.") + else: + GLOBAL += 1 + + if GLOBAL < 1: + self.report({'INFO'}, "Materials And Groups are Ok") + if GLOBALERROR > 0: + self.report({'WARNING'}, "Override Error: Look in the Console") + print("") + + return {'FINISHED'} + +# --------------------------------- OVERRIDES PANEL ---------------------- + + +class OscOverridesGUI(Panel): + bl_label = "Oscurart Material Overrides" + bl_idname = "Oscurart Overrides List" + bl_space_type = "PROPERTIES" + bl_region_type = "WINDOW" + bl_context = "render" + + def draw(self, context): + + layout = self.layout + col = layout.column(align=1) + colrow = col.row(align=1) + colrow.operator("render.overrides_add_slot", icon="ZOOMIN") + colrow.operator("render.overrides_remove_slot", icon="ZOOMOUT") + col.operator("render.overrides_transfer", icon="SHORTDISPLAY") + + for i, m in enumerate(bpy.context.scene.ovlist): + colrow = col.row(align=1) + colrow.prop_search(m, "grooverride", bpy.data, "groups", text="") + colrow.prop_search( + m, + "matoverride", + bpy.data, + "materials", + text="") + if i != len(bpy.context.scene.ovlist) - 1: + pa = colrow.operator( + "ovlist.move_down", + text="", + icon="TRIA_DOWN") + pa.index = i + if i > 0: + p = colrow.operator("ovlist.move_up", text="", icon="TRIA_UP") + p.index = i + pb = colrow.operator("ovlist.kill", text="", icon="X") + pb.index = i + + +class OscOverridesUp(Operator): + bl_idname = 'ovlist.move_up' + bl_label = 'Move Override up' + bl_options = {'INTERNAL'} + + index = bpy.props.IntProperty(min=0) + + @classmethod + def poll(self, context): + return len(context.scene.ovlist) + + def execute(self, context): + ovlist = context.scene.ovlist + ovlist.move(self.index, self.index - 1) + + return {'FINISHED'} + + +class OscOverridesDown(Operator): + bl_idname = 'ovlist.move_down' + bl_label = 'Move Override down' + bl_options = {'INTERNAL'} + + index = bpy.props.IntProperty(min=0) + + @classmethod + def poll(self, context): + return len(context.scene.ovlist) + + def execute(self, context): + ovlist = context.scene.ovlist + ovlist.move(self.index, self.index + 1) + return {'FINISHED'} + + +class OscOverridesKill(Operator): + bl_idname = 'ovlist.kill' + bl_label = 'Kill Override' + bl_options = {'INTERNAL'} + + index = bpy.props.IntProperty(min=0) + + @classmethod + def poll(self, context): + return len(context.scene.ovlist) + + def execute(self, context): + ovlist = context.scene.ovlist + ovlist.remove(self.index) + return {'FINISHED'} + + +class OscTransferOverrides(Operator): + """Tooltip""" + bl_idname = "render.overrides_transfer" + bl_label = "Transfer Overrides" + + def execute(self, context): + # CREO LISTA + OSCOV = [[OVERRIDE.grooverride, OVERRIDE.matoverride] + for OVERRIDE in bpy.context.scene.ovlist[:] + if OVERRIDE.matoverride != "" and OVERRIDE.grooverride != ""] + + bpy.context.scene.oscurart.overrides = str(OSCOV) + return {'FINISHED'} + + +class OscAddOverridesSlot(Operator): + """Tooltip""" + bl_idname = "render.overrides_add_slot" + bl_label = "Add Override Slot" + + def execute(self, context): + prop = bpy.context.scene.ovlist.add() + prop.matoverride = "" + prop.grooverride = "" + return {'FINISHED'} + + +class OscRemoveOverridesSlot(Operator): + """Tooltip""" + bl_idname = "render.overrides_remove_slot" + bl_label = "Remove Override Slot" + + def execute(self, context): + context.scene.ovlist.remove(len(bpy.context.scene.ovlist) - 1) + return {'FINISHED'} diff --git a/oscurart_tools/oscurart_render.py b/oscurart_tools/oscurart_render.py index a20aafee..8e7fc05f 100644 --- a/oscurart_tools/oscurart_render.py +++ b/oscurart_tools/oscurart_render.py @@ -25,7 +25,6 @@ from bpy.types import ( ) import os - # -------------------------------- RENDER ALL SCENES --------------------- def defRenderAll(frametype, scenes): @@ -46,6 +45,7 @@ def defRenderAll(frametype, scenes): for ob in bpy.data.objects if ob.type in types if len(ob.material_slots)} for scene in scenes: + proptolist = list(eval(scene.oscurart.overrides)) renpath = scene.render.filepath if frametype: @@ -54,6 +54,15 @@ def defRenderAll(frametype, scenes): scene.frame_end = FC scene.frame_start = FC + for group, material in proptolist: + for object in bpy.data.groups[group].objects: + lenslots = len(object.material_slots) + if object.type in types: + if len(object.data.materials): + object.data.materials.clear() + for newslot in range(lenslots): + object.data.materials.append( + bpy.data.materials[material]) filename = os.path.basename(bpy.data.filepath.rpartition(".")[0]) uselayers = {layer: layer.use for layer in scene.render.layers} for layer, usado in uselayers.items(): @@ -63,6 +72,7 @@ def defRenderAll(frametype, scenes): layer.use = 1 print("SCENE: %s" % scene.name) print("LAYER: %s" % layer.name) + print("OVERRIDE: %s" % str(proptolist)) scene.render.filepath = os.path.join( os.path.dirname(renpath), filename, scene.name, layer.name, "%s_%s_%s" % (filename, scene.name, layer.name)) @@ -103,6 +113,9 @@ class renderAll (Operator): # --------------------------------RENDER SELECTED SCENES------------------ +bpy.types.Scene.use_render_scene = bpy.props.BoolProperty() + + class renderSelected (Operator): bl_idname = "render.render_selected_scenes_osc" bl_label = "Render Selected Scenes" @@ -112,12 +125,12 @@ class renderSelected (Operator): def execute(self, context): defRenderAll( self.frametype, - [sc for sc in bpy.data.scenes if sc.oscurart.use_render_scene]) + [sc for sc in bpy.data.scenes if sc.use_render_scene]) return {'FINISHED'} - # --------------------------------RENDER CURRENT SCENE-------------------- + class renderCurrent (Operator): bl_idname = "render.render_current_scene_osc" bl_label = "Render Current Scene" @@ -132,13 +145,14 @@ class renderCurrent (Operator): # --------------------------RENDER CROP---------------------- +bpy.types.Scene.rcPARTS = bpy.props.IntProperty( + default=0, min=2, max=50, step=1) + def OscRenderCropFunc(): SCENENAME = os.path.split(bpy.data.filepath)[-1].partition(".")[0] - rcParts = bpy.context.scene.oscurart.rcPARTS - # don't divide by zero - PARTS = (rcParts if rcParts and rcParts > 0 else 1) + PARTS = bpy.context.scene.rcPARTS CHUNKYSIZE = 1 / PARTS FILEPATH = bpy.context.scene.render.filepath bpy.context.scene.render.use_border = True @@ -148,12 +162,11 @@ def OscRenderCropFunc(): bpy.context.scene.render.border_max_y = ( PART * CHUNKYSIZE) + CHUNKYSIZE bpy.context.scene.render.filepath = "%s_part%s" % ( - os.path.join(FILEPATH, - SCENENAME, - bpy.context.scene.name, - SCENENAME), - PART - ) + os.path.join(FILEPATH, + SCENENAME, + bpy.context.scene.name, + SCENENAME), + PART) bpy.ops.render.render(animation=False, write_still=True) bpy.context.scene.render.filepath = FILEPATH @@ -167,9 +180,231 @@ class renderCrop (Operator): OscRenderCropFunc() return {'FINISHED'} +# ---------------------------BATCH MAKER------------------ + + +def defoscBatchMaker(TYPE, BIN): + + if os.name == "nt": + print("PLATFORM: WINDOWS") + SYSBAR = os.sep + EXTSYS = ".bat" + QUOTES = '"' + else: + print("PLATFORM:LINUX") + SYSBAR = os.sep + EXTSYS = ".sh" + QUOTES = '' + + FILENAME = bpy.data.filepath.rpartition(SYSBAR)[-1].rpartition(".")[0] + BINDIR = bpy.app[4] + SHFILE = os.path.join( + bpy.data.filepath.rpartition(SYSBAR)[0], + FILENAME + EXTSYS) + + with open(SHFILE, "w") as FILE: + # assign permission in linux + if EXTSYS == ".sh": + try: + os.chmod(SHFILE, stat.S_IRWXU) + except: + print( + "** Oscurart Batch maker can not modify the permissions.") + if not BIN: + FILE.writelines("%s%s%s -b %s -x 1 -o %s -P %s%s.py -s %s -e %s -a" % + (QUOTES, BINDIR, QUOTES, bpy.data.filepath, bpy.context.scene.render.filepath, + bpy.data.filepath.rpartition(SYSBAR)[0] + SYSBAR, TYPE, + str(bpy.context.scene.frame_start), str(bpy.context.scene.frame_end))) + else: + FILE.writelines("%s -b %s -x 1 -o %s -P %s%s.py -s %s -e %s -a" % + ("blender", bpy.data.filepath, bpy.context.scene.render.filepath, + bpy.data.filepath.rpartition(SYSBAR)[0] + SYSBAR, TYPE, + str(bpy.context.scene.frame_start), str(bpy.context.scene.frame_end))) + + RLATFILE = "%s%sosRlat.py" % ( + bpy.data.filepath.rpartition(SYSBAR)[0], + SYSBAR) + if not os.path.isfile(RLATFILE): + with open(RLATFILE, "w") as file: + if EXTSYS == ".sh": + try: + os.chmod(RLATFILE, stat.S_IRWXU) + except: + print( + "** Oscurart Batch maker can not modify the permissions.") + file.writelines( + "import bpy \nbpy.ops.render.render_all_scenes_osc()\nbpy.ops.wm.quit_blender()") + + else: + print("The All Python files Skips: Already exist!") + + RSLATFILE = "%s%sosRSlat.py" % ( + bpy.data.filepath.rpartition(SYSBAR)[0], + SYSBAR) + if not os.path.isfile(RSLATFILE): + with open(RSLATFILE, "w") as file: + if EXTSYS == ".sh": + try: + os.chmod(RSLATFILE, stat.S_IRWXU) + except: + print( + "** Oscurart Batch maker can not modify the permissions.") + file.writelines( + "import bpy \nbpy.ops.render.render_selected_scenes_osc()\nbpy.ops.wm.quit_blender()") + else: + print("The Selected Python files Skips: Already exist!") + + +class oscBatchMaker (Operator): + bl_idname = "file.create_batch_maker_osc" + bl_label = "Make render batch" + bl_options = {'REGISTER', 'UNDO'} + + type = bpy.props.EnumProperty( + name="Render Mode", + description="Select Render Mode", + items=(('osRlat', "All Scenes", "Render All Layers At Time"), + ('osRSlat', "Selected Scenes", "Render Only The Selected Scenes")), + default='osRlat', + ) + + bin = bpy.props.BoolProperty( + default=False, + name="Use Environment Variable") + + def execute(self, context): + defoscBatchMaker(self.type, self.bin) + return {'FINISHED'} + +# --------------------------------------PYTHON BATCH---------------------- + + +def defoscPythonBatchMaker(BATCHTYPE, SIZE): + + # REVISO SISTEMA + if os.name == "nt": + print("PLATFORM: WINDOWS") + SYSBAR = "\\" + EXTSYS = ".bat" + QUOTES = '"' + else: + print("PLATFORM:LINUX") + SYSBAR = "/" + EXTSYS = ".sh" + QUOTES = '' + + # CREO VARIABLES + FILENAME = bpy.data.filepath.rpartition(SYSBAR)[-1].rpartition(".")[0] + SHFILE = "%s%s%s_PythonSecureBatch.py" % ( + bpy.data.filepath.rpartition(SYSBAR)[0], + SYSBAR, + FILENAME) + BATCHLOCATION = "%s%s%s%s" % ( + bpy.data.filepath.rpartition(SYSBAR)[0], + SYSBAR, + FILENAME, + EXTSYS) + + with open(SHFILE, "w") as FILEBATCH: + + if EXTSYS == ".bat": + BATCHLOCATION = BATCHLOCATION.replace("\\", "/") + + # SI EL OUTPUT TIENE DOBLE BARRA LA REEMPLAZO + FRO = bpy.context.scene.render.filepath + if bpy.context.scene.render.filepath.count("//"): + FRO = bpy.context.scene.render.filepath.replace( + "//", + bpy.data.filepath.rpartition(SYSBAR)[0] + SYSBAR) + if EXTSYS == ".bat": + FRO = FRO.replace("\\", "/") + + # CREO BATCH + bpy.ops.file.create_batch_maker_osc(type=BATCHTYPE) + + SCRIPT = (''' +import os +REPITE= True +BAT= '%s' +SCENENAME ='%s' +DIR='%s%s' +def RENDER(): + os.system(BAT) +def CLEAN(): + global REPITE + FILES = [root+'/'+FILE for root, dirs, files in os.walk(os.getcwd()) if + len(files) > 0 for FILE in files if FILE.count('~') == False] + RESPUESTA=False + for FILE in FILES: + if os.path.getsize(FILE) < %s: + os.remove(FILE) + RESPUESTA= True + if RESPUESTA: + REPITE=True + else: + REPITE=False +REPITE=True +while REPITE: + REPITE=False + RENDER() + os.chdir(DIR) + CLEAN() +''' % (BATCHLOCATION, FILENAME, FRO, FILENAME, SIZE)) + + # DEFINO ARCHIVO DE BATCH + FILEBATCH.writelines(SCRIPT) + + # ARCHIVO CALL + CALLFILENAME = bpy.data.filepath.rpartition(SYSBAR)[-1].rpartition(".")[0] + CALLFILE = "%s%s%s_CallPythonSecureBatch%s" % ( + bpy.data.filepath.rpartition(SYSBAR)[0], + SYSBAR, + CALLFILENAME, + EXTSYS) + + with open(CALLFILE, "w") as CALLFILEBATCH: + + SCRIPT = "python %s" % (SHFILE) + CALLFILEBATCH.writelines(SCRIPT) + + if EXTSYS == ".sh": + try: + os.chmod(CALLFILE, stat.S_IRWXU) + os.chmod(SHFILE, stat.S_IRWXU) + except: + print("** Oscurart Batch maker can not modify the permissions.") + + +class oscPythonBatchMaker (Operator): + bl_idname = "file.create_batch_python" + bl_label = "Make Batch Python" + bl_options = {'REGISTER', 'UNDO'} + + size = bpy.props.IntProperty(name="Size in Bytes", default=10, min=0) + + type = bpy.props.EnumProperty( + name="Render Mode", + description="Select Render Mode", + items=(('osRlat', "All Scenes", "Render All Layers At Time"), + ('osRSlat', "Selected Scenes", "Render Only The Selected Scenes")), + default='osRlat', + ) + + def execute(self, context): + defoscPythonBatchMaker(self.type, self.size) + return {'FINISHED'} + # ---------------------------------- BROKEN FRAMES --------------------- +class VarColArchivos (bpy.types.PropertyGroup): + filename = bpy.props.StringProperty(name="", default="") + value = bpy.props.IntProperty(name="", default=10) + fullpath = bpy.props.StringProperty(name="", default="") + checkbox = bpy.props.BoolProperty(name="", default=True) +bpy.utils.register_class(VarColArchivos) + + class SumaFile(Operator): bl_idname = "object.add_broken_file" bl_label = "Add Broken Files" @@ -213,7 +448,11 @@ class DeleteFiles(Operator): return {'FINISHED'} -class BrokenFramesPanel(Panel): +bpy.types.Scene.broken_files = bpy.props.CollectionProperty( + type=VarColArchivos) + + +class BrokenFramesPanel (Panel): bl_label = "Oscurart Broken Render Files" bl_idname = "OBJECT_PT_osc_broken_files" bl_space_type = 'PROPERTIES' @@ -285,6 +524,7 @@ def defCopyRenderSettings(mode): 'keying_sets_all', 'sequence_editor', '__doc__', + 'ovlist', 'file_extension', 'users', 'node_tree', @@ -309,6 +549,7 @@ def defCopyRenderSettings(mode): '__weakref__', 'string', 'double', + 'overrides', 'use_render_scene', 'engine', 'use_nodes', @@ -342,6 +583,13 @@ def defCopyRenderSettings(mode): except: print("%s does not exist." % (prop)) + """ + scenerenderdict = {prop: getattr(bpy.context.scene.render, prop) for prop in dir(bpy.context.scene.render)} + scenedict = {prop: getattr(bpy.context.scene, prop) for prop in dir(bpy.context.scene) if prop not in excludes} + sceneimagesettingdict = {prop: getattr(bpy.context.scene.render.image_settings, prop) + for prop in dir(bpy.context.scene.render.image_settings)} + """ + # render for escena in sceneslist: for prop, value in scenerenderdict.items(): @@ -350,6 +598,7 @@ def defCopyRenderSettings(mode): except: print("%s was not copied!" % (prop)) pass + # scene for escena in sceneslist: for prop, value in scenedict.items(): @@ -376,6 +625,10 @@ def defCopyRenderSettings(mode): bpy.context.scene.cycles, prop) except: print("%s does not exist." % (prop)) + + """ + scenecyclesdict = {prop: getattr(bpy.context.scene.cycles, prop) for prop in dir(bpy.context.scene.cycles)} + """ # cycles for escena in sceneslist: for prop, value in scenecyclesdict.items(): @@ -389,6 +642,7 @@ def defCopyRenderSettings(mode): class copyRenderSettings(Operator): bl_idname = "render.copy_render_settings_osc" bl_label = "Copy Render Settings" + # bl_options = {'REGISTER', 'UNDO'} mode = bpy.props.StringProperty(default="") |