first of all hi to everyone first post ! I've recently (10 days ago) started to learn Python specifically for Blender. Obviously I got eager to try something out and I cant (for obvious reason) find a solution to this problem. I am an absolute beginner in programming and I don't have the right jargon so please be patient with me if I said something wrong :).
What I want to achieve is having a custom panel for some extra settings under the Render Tab. I was able to do so and convert it to an Add-on (so I can have it loaded at startup) but my custom operator (that contains 2 actions) doesn't load up together with the Add-on.. I have to manually run the script but in this way I have to do it every time I log in.
I am super sure the problem is with my custom operator since in order to make this script I've basically just dug around other people/template scripts to see how they work.. without knowledge of what I am doing (I just go too excited)
all the help will be highly appreciated
bl_info = {
"name": "HTML Render Combo",
"author": "Virgil Sisoe",
"version": (1, 0),
"blender": (2, 79, 0),
"location": "Properties > Render",
"description": "Quick panel to export Documen HTML",
"warning": "",
"wiki_url": "",
"category": "Render",
}
import bpy
#DEFINE CUSTOM OPERATOR FOR HTML EXPORT
def main(context):
# WANT IM TRYING IS TO HAVE A SINGLE BUTTON DOING RENDER AND EXPORT DOCUMEN
bpy.ops.render.render()
#DOCUMEN HTML IS AN ADDON I HAVE
bpy.ops.scene.export_documen_html()
#CREATING CLASS
class SimpleOperator(bpy.types.Operator):
"""Export HTML"""
bl_idname = "object.simple_operator"
bl_label = "Simple Object Operator"
# JUST COPIED AND PASTED FROM ANOTHER RENDER SOURCE IT IS COMPLETLY WRONG
@classmethod
def poll(cls, context):
scene = context.scene
return scene
def draw(self, context):
layout = self.layout
return {'FINISHED'}
def register():
bpy.utils.register_class(SimpleOperator)
def unregister():
bpy.utils.unregister_class(SimpleOperator)
if __name__ == "__main__":
register()
# test call
bpy.ops.object.simple_operator()
#DEFINE CUSTOM PANEL FOR EXPORT
def draw(self, context):
layout = self.layout
# ROW COLUMN LAYOUT
row = layout.row()
col = row.column(align = True)
col.scale_y = 3
row.operator("object.simple_operator", text="Render + HTML", icon='RENDER_STILL')
#EXTERNAL ADDON (DOCUMEN)
row.operator("scene.export_documen_html", text="HTML", icon='FILE')
# LAYOUT EXPORT PATH
scene = context.scene
box = layout.box()
row = box.row()
row.prop(scene, "documen_folderpath", text="Export Path")
row.prop(scene, "buttons.directory_browse")
#render tab path
def register():
bpy.types.RENDER_PT_render.append(draw)
def unregister():
bpy.types.RENDER_PT_render.re.remove(draw)
if __name__ == "__main__":
register()
Ive added the .py file