WIP: Blender Kitsu: Convention Checker #124

Closed
Nick Alberelli wants to merge 8 commits from (deleted):feature/convention-checker-draft into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
3 changed files with 72 additions and 0 deletions
Showing only changes of commit a99eee7873 - Show all commits

View File

@ -28,6 +28,7 @@ from blender_kitsu import (
bkglobals, bkglobals,
types, types,
cache, cache,
checker,
models, models,
playblast, playblast,
propsdata, propsdata,
@ -78,6 +79,7 @@ if _need_reload:
ui = importlib.reload(ui) ui = importlib.reload(ui)
sqe.reload() sqe.reload()
util = importlib.reload(util) util = importlib.reload(util)
checker = importlib.reload(checker)
generic.reload() generic.reload()
auth.reload() auth.reload()
context.reload() context.reload()
@ -89,6 +91,7 @@ def register():
lookdev.register() lookdev.register()
prefs.register() prefs.register()
cache.register() cache.register()
checker.register()
props.register() props.register()
sqe.register() sqe.register()
generic.register() generic.register()
@ -111,6 +114,7 @@ def unregister():
generic.unregister() generic.unregister()
sqe.unregister() sqe.unregister()
props.unregister() props.unregister()
checker.unregister()
cache.unregister() cache.unregister()
prefs.unregister() prefs.unregister()
lookdev.unregister() lookdev.unregister()

View File

@ -0,0 +1,19 @@
import importlib
from blender_kitsu.checker import ops
# ---------REGISTER ----------.
def reload():
global ops
ops = importlib.reload(ops)
def register():
ops.register()
def unregister():
ops.unregister()

View File

@ -0,0 +1,49 @@
import bpy
class KITSU_OT_test_op(bpy.types.Operator):
bl_idname = "kitsu.test_op"
bl_label = 'test'
text: bpy.props.StringProperty(name='test', default='')
def execute(self, context):
if self.text != "test":
self.report({'ERROR'}, "Failure")
return {'CANCELLED'}
self.report({'INFO'}, "Success")
return {'FINISHED'}
class KITSU_OT_convention_checker(bpy.types.Operator):
bl_idname = "kitsu.convention_checker"
bl_label = 'Convention Checker'
def execute(self, context):
# TODO read types out of json File
# TODO check operator exists before execution
# INFO python3 -m json.tool file.json to 'pretty print' json
try:
bpy.ops.kitsu.test_op()
except RuntimeError as ex:
ex
self.report({'INFO'}, "CONFIRMED FAILURE")
else:
self.report({'INFO'}, "CONFIRMED SUCCESS")
return {'FINISHED'}
classes = [
KITSU_OT_test_op,
KITSU_OT_convention_checker,
]
def register():
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
for cls in reversed(classes):
bpy.utils.unregister_class(cls)