@@ -95,7 +95,18 @@ def execute(self, context):
9595 cb = get_callback (self .callback_handle )
9696 cb (context )
9797 return {'FINISHED' }
98-
98+
99+ class OBJECT_OT_LilyClipboardSurfaceScrapper (PopupOperator , CallbackProps ):
100+ """Same as lily_surface_import except that it gets the URL from clipboard."""
101+ bl_idname = "object.lily_surface_import_from_clipboard"
102+ bl_label = "Import from clipboard"
103+
104+ def invoke (self , context , event ):
105+ return self .execute (context )
106+
107+ def execute (self , context ):
108+ bpy .ops .object .lily_surface_import ('EXEC_DEFAULT' , url = bpy .context .window_manager .clipboard )
109+ return {'FINISHED' }
99110
100111def list_variant_enum (self , context ):
101112 """Callback filling enum items for OBJECT_OT_LilySurfacePromptVariant"""
@@ -202,6 +213,17 @@ def execute(self, context):
202213 cb (context )
203214 return {'FINISHED' }
204215
216+ class OBJECT_OT_LilyClipboardWorldScrapper (PopupOperator , CallbackProps ):
217+ """Same as lily_world_import except that it gets the URL from clipboard."""
218+ bl_idname = "object.lily_world_import_from_clipboard"
219+ bl_label = "Import from clipboard"
220+
221+ def invoke (self , context , event ):
222+ return self .execute (context )
223+
224+ def execute (self , context ):
225+ bpy .ops .object .lily_world_import ('EXEC_DEFAULT' , url = bpy .context .window_manager .clipboard )
226+ return {'FINISHED' }
205227
206228def list_variant_enum (self , context ):
207229 """Callback filling enum items for OBJECT_OT_LilySurfacePromptVariant"""
@@ -271,6 +293,7 @@ def draw(self, context):
271293 layout .label (text = "You must save the file to use Lily Surface Scrapper" )
272294 else :
273295 layout .operator ("object.lily_surface_import" )
296+ layout .operator ("object.lily_surface_import_from_clipboard" )
274297 layout .label (text = "Available sources:" )
275298 for S in ScrappersManager .getScrappersList ():
276299 if 'MATERIAL' in S .scrapped_type :
@@ -290,6 +313,7 @@ def draw(self, context):
290313 layout .label (text = "You must save the file to use Lily Surface Scrapper" )
291314 else :
292315 layout .operator ("object.lily_world_import" )
316+ layout .operator ("object.lily_world_import_from_clipboard" )
293317 layout .label (text = "Available sources:" )
294318 for S in ScrappersManager .getScrappersList ():
295319 if 'WORLD' in S .scrapped_type :
@@ -299,16 +323,20 @@ def draw(self, context):
299323
300324def register ():
301325 bpy .utils .register_class (OBJECT_OT_LilySurfaceScrapper )
326+ bpy .utils .register_class (OBJECT_OT_LilyClipboardSurfaceScrapper )
302327 bpy .utils .register_class (OBJECT_OT_LilySurfacePromptVariant )
303328 bpy .utils .register_class (OBJECT_OT_LilyWorldScrapper )
329+ bpy .utils .register_class (OBJECT_OT_LilyClipboardWorldScrapper )
304330 bpy .utils .register_class (OBJECT_OT_LilyWorldPromptVariant )
305331 bpy .utils .register_class (MATERIAL_PT_LilySurfaceScrapper )
306332 bpy .utils .register_class (WORLD_PT_LilySurfaceScrapper )
307333
308334def unregister ():
309335 bpy .utils .unregister_class (OBJECT_OT_LilySurfaceScrapper )
336+ bpy .utils .unregister_class (OBJECT_OT_LilyClipboardSurfaceScrapper )
310337 bpy .utils .unregister_class (OBJECT_OT_LilySurfacePromptVariant )
311338 bpy .utils .unregister_class (OBJECT_OT_LilyWorldScrapper )
339+ bpy .utils .unregister_class (OBJECT_OT_LilyClipboardWorldScrapper )
312340 bpy .utils .unregister_class (OBJECT_OT_LilyWorldPromptVariant )
313341 bpy .utils .unregister_class (MATERIAL_PT_LilySurfaceScrapper )
314342 bpy .utils .unregister_class (WORLD_PT_LilySurfaceScrapper )
0 commit comments