Files
blender-portable-repo/extensions/user_default/cm_outputname/__init__.py
T
2026-03-17 14:30:01 -06:00

97 lines
2.8 KiB
Python

# 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 3 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
# MERCHANTIBILITY 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, see <http://www.gnu.org/licenses/>.
bl_info = {
"name" : "CM_Output-Name",
"author" : "Chris McAllister",
"description" : "",
"blender" : (4, 2, 0),
"version" : (1, 0, 0),
"location" : "",
"warning" : "",
"doc_url": "",
"tracker_url": "",
"category" : "3D View"
}
import bpy
import bpy.utils.previews
addon_keymaps = {}
_icons = None
class SNA_OT_Outputpath_07Ed3(bpy.types.Operator):
bl_idname = "sna.outputpath_07ed3"
bl_label = "output-path"
bl_description = ""
bl_options = {"REGISTER", "UNDO"}
@classmethod
def poll(cls, context):
if bpy.app.version >= (3, 0, 0) and True:
cls.poll_message_set('')
return not False
def execute(self, context):
# Get the current file name
fileName = bpy.path.basename(bpy.data.filepath).replace(".blend", "")
# Set the render output path
render_output_path = "//seq\\" + fileName + "\\" + fileName + "_"
bpy.context.scene.render.filepath = render_output_path
return {"FINISHED"}
def invoke(self, context, event):
return self.execute(context)
class SNA_PT_OUTPUT_PATH_B6DC9(bpy.types.Panel):
bl_label = 'Output path'
bl_idname = 'SNA_PT_OUTPUT_PATH_B6DC9'
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = 'output'
bl_order = 0
bl_parent_id = 'RENDER_PT_output'
bl_ui_units_x=0
@classmethod
def poll(cls, context):
return not (False)
def draw_header(self, context):
layout = self.layout
def draw(self, context):
layout = self.layout
op = layout.operator('sna.outputpath_07ed3', text='Set Output Path as File Name', icon_value=201, emboss=True, depress=False)
def register():
global _icons
_icons = bpy.utils.previews.new()
bpy.utils.register_class(SNA_OT_Outputpath_07Ed3)
bpy.utils.register_class(SNA_PT_OUTPUT_PATH_B6DC9)
def unregister():
global _icons
bpy.utils.previews.remove(_icons)
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
for km, kmi in addon_keymaps.values():
km.keymap_items.remove(kmi)
addon_keymaps.clear()
bpy.utils.unregister_class(SNA_OT_Outputpath_07Ed3)
bpy.utils.unregister_class(SNA_PT_OUTPUT_PATH_B6DC9)