complete first version

master
pullusb 2023-11-30 15:08:32 +01:00
parent 12e8ab523c
commit 0b76c96175
5 changed files with 103 additions and 7 deletions

37
__init__.py Normal file → Executable file
View File

@ -1,19 +1,42 @@
from gp_interpolate.interpolate_strokes import operators, properties bl_info = {
"name": "gp interpolate",
"author": "Christophe Seux, Samuel Bernou",
"version": (0, 1, 0),
"blender": (3, 6, 0),
"location": "",
"description": "Interpolate Grease pencil strokes",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "Animation"}
import sys
from pathlib import Path
import importlib
# Ensure the name of the module in python import
module_name = Path(__file__).parent.name
sys.modules.update({'gp_interpolate': importlib.import_module(module_name)})
from gp_interpolate import interpolate_strokes, ui
modules = ( modules = (
properties, interpolate_strokes,
operators, ui,
) )
if "bpy" in locals(): # if "bpy" in locals():
import importlib # import importlib
for mod in modules: # for mod in modules:
importlib.reload(mod) # importlib.reload(mod)
import bpy import bpy
def register(): def register():
print('Register gp_interpolate')
for mod in modules: for mod in modules:
mod.register() mod.register()

View File

@ -0,0 +1,22 @@
from gp_interpolate.interpolate_strokes import operators, properties
modules = (
properties,
operators,
)
if "bpy" in locals():
import importlib
for mod in modules:
importlib.reload(mod)
import bpy
def register():
for mod in modules:
mod.register()
def unregister():
for mod in reversed(modules):
mod.unregister()

51
ui.py Executable file
View File

@ -0,0 +1,51 @@
import bpy
class GP_PT_interpolate(bpy.types.Panel):
bl_label = "Interpolate"
bl_category = "Gpencil"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
@classmethod
def poll(cls, context):
return context.object and context.object.type == 'GPENCIL'
def draw(self, context):
settings = bpy.context.scene.gp_interpo_settings
layout = self.layout
col = layout.column(align=False)
if settings.mode == 'FRAME':
prev_icon, next_icon = 'FRAME_PREV', 'FRAME_NEXT'
else:
prev_icon, next_icon = 'PREV_KEYFRAME', 'NEXT_KEYFRAME'
row = col.row(align=True)
row.scale_x = 3
row.operator("gp.interpolate_stroke", text="", icon=prev_icon).next = False
row.operator("gp.interpolate_stroke", text="", icon=next_icon).next = True
# col.separator()
col.prop(settings, 'target_collection', text='Collection')
col.prop(settings, 'search_range')
col = layout.column(align=True)
row = col.row(align=True)
row.prop(settings, 'mode', expand=True)
if settings.mode == 'FRAME':
col.prop(settings, 'padding')
classes = (
GP_PT_interpolate,
)
def register():
for c in classes:
bpy.utils.register_class(c)
def unregister():
for c in reversed(classes) :
bpy.utils.unregister_class(c)