@@ -625,6 +625,29 @@ function render_path_paint_end() {
625625 context_raw . pdirty -- ;
626626}
627627
628+ let _render_path_paint_bake_type : bake_type_t ;
629+
630+ function _render_path_paint_final ( ) {
631+ context_raw . bake_type = _render_path_paint_bake_type ;
632+ make_material_parse_paint_material ( ) ;
633+ context_raw . pdirty = 1 ;
634+ render_path_paint_commands_paint ( ) ;
635+ context_raw . pdirty = 0 ;
636+ render_path_paint_baking = false ;
637+ }
638+
639+ function _render_path_paint_deriv ( ) {
640+ context_raw . bake_type = bake_type_t . HEIGHT ;
641+ make_material_parse_paint_material ( ) ;
642+ context_raw . pdirty = 1 ;
643+ render_path_paint_commands_paint ( ) ;
644+ context_raw . pdirty = 0 ;
645+ if ( render_path_paint_push_undo_last ) {
646+ history_paint ( ) ;
647+ }
648+ app_notify_on_init ( _render_path_paint_final ) ;
649+ }
650+
628651function render_path_paint_draw ( ) {
629652 if ( ! render_path_paint_paint_enabled ( ) ) {
630653 return ;
@@ -656,7 +679,7 @@ function render_path_paint_draw() {
656679 if ( context_raw . bake_type == bake_type_t . NORMAL || context_raw . bake_type == bake_type_t . HEIGHT || context_raw . bake_type == bake_type_t . DERIVATIVE ) {
657680 if ( ! render_path_paint_baking && context_raw . pdirty > 0 ) {
658681 render_path_paint_baking = true ;
659- let _bake_type : bake_type_t = context_raw . bake_type ;
682+ _render_path_paint_bake_type = context_raw . bake_type ;
660683 context_raw . bake_type = context_raw . bake_type == bake_type_t . NORMAL ? bake_type_t . NORMAL_OBJECT : bake_type_t . POSITION ; // Bake high poly data
661684 make_material_parse_paint_material ( ) ;
662685 let _paint_object : mesh_object_t = context_raw . paint_object ;
@@ -671,29 +694,12 @@ function render_path_paint_draw() {
671694 }
672695 context_select_paint_object ( _paint_object ) ;
673696
674- ////
675- // let _render_final: ()=>void = function () {
676- // context_raw.bake_type = _bake_type;
677- // make_material_parse_paint_material();
678- // context_raw.pdirty = 1;
679- // render_path_paint_commands_paint();
680- // context_raw.pdirty = 0;
681- // render_path_paint_baking = false;
682- // }
683- // let _render_deriv: ()=>void = function () {
684- // context_raw.bake_type = bake_type_t.HEIGHT;
685- // make_material_parse_paint_material();
686- // context_raw.pdirty = 1;
687- // render_path_paint_commands_paint();
688- // context_raw.pdirty = 0;
689- // if (render_path_paint_push_undo_last) {
690- // history_paint();
691- // }
692- // app_notify_on_init(_render_final);
693- // }
694- // // @ts -ignore
695- // app_notify_on_init(context_raw.bake_type == bake_type_t.DERIVATIVE ? _render_deriv : _render_final);
696- ////
697+ if ( context_raw . bake_type == bake_type_t . DERIVATIVE ) {
698+ app_notify_on_init ( _render_path_paint_deriv ) ;
699+ }
700+ else {
701+ app_notify_on_init ( _render_path_paint_final ) ;
702+ }
697703 }
698704 }
699705 else if ( context_raw . bake_type == bake_type_t . OBJECTID ) {
0 commit comments