@@ -351,7 +351,6 @@ def add_class(cursor, macros):
351351 child_cursors = [i for i in child_cursors if gdclass_macro .extent .start .offset != i .extent .start .offset ]
352352
353353 group , subgroup = '' , ''
354- bind_methods_append , bind_methods_prepend = '' , ''
355354 start , end = cursor .extent .start .offset , cursor .extent .end .offset
356355 class_macros = sorted ([m for m in keyword_macros if start < m .extent .start .offset < end ] + child_cursors , key = lambda x : x .extent .start .offset )
357356
@@ -481,10 +480,10 @@ def process_macros(item, macros, properties, is_ignored=False):
481480 is_ignored = True
482481
483482 case 'GBIND_METHODS_APPEND' :
484- bind_methods_append += get_macro_body (filecontent , macro )
483+ class_defs [ ' bind_methods_append' ] += get_macro_body (filecontent , macro )
485484
486485 case 'GBIND_METHODS_PREPEND' :
487- bind_methods_prepend += get_macro_body (filecontent , macro )
486+ class_defs [ ' bind_methods_prepend' ] += get_macro_body (filecontent , macro )
488487
489488
490489 return not is_ignored
@@ -641,6 +640,8 @@ def write_header(file, defs, env):
641640 header_rpc_config = 'void {}::_rpc_config() {{{}}}\n ' .format (
642641 class_name_full , '\n ' + header_rpc_config if header_rpc_config != '' else '' )
643642 header_bind_methods = '\n \n ' .join (i for i in [Hmethod , Hvirtual_method , Hstatic_method , Hvaragr_method , Hprop , Hsignal , Henum , Hbitfield , Hconst ] if i != '' )
643+ header_bind_methods = content ['bind_methods_append' ] + header_bind_methods + content ['bind_methods_prepend' ]
644+
644645 header_defs += [f'// { class_name_full } : { content ["base" ]} \n ' ,
645646 'void {}::_bind_methods() {{{}}}\n ' .format (
646647 class_name_full , '\n ' + header_bind_methods if header_bind_methods != '' else '' ),
0 commit comments