From f984d3bdc732a891ac44f51b8157ee1c479c6a8f Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Tue, 4 Nov 2025 11:17:29 +0100 Subject: [PATCH] Fix generation when returned class and function are in a namespace This is to fix js generation at HEAD with ximgproc. --- modules/js/generator/embindgen.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/js/generator/embindgen.py b/modules/js/generator/embindgen.py index e81ceb837a..430baf99ef 100644 --- a/modules/js/generator/embindgen.py +++ b/modules/js/generator/embindgen.py @@ -849,6 +849,10 @@ class JSWrapperGenerator(object): # Register the smart pointer base_class_name = variant.rettype base_class_name = base_class_name.replace("Ptr<","").replace(">","").strip() + if base_class_name not in self.classes: + new_base_class_name = '%s_%s' % (ns_id, base_class_name) + print(base_class_name, ' not found in classes for registering smart pointer using ', new_base_class_name, 'instead') + base_class_name = new_base_class_name self.classes[base_class_name].has_smart_ptr = True # Adds the external constructor