text:
How to show to the user a progression in a script?
I'm making an python script which create a lot of object and this could take a lot of time. My question is how to show to the user of my script, the "progression" of the script?
For now I print an progress bar in the system console.
But you have to open the system console befor and (apparently) the system console only work with Windows.
Is there an other way to show the progression of my script with python like control the mouse percentage icon (the little icon that replace the mouse while baking) or another idea?

See How can I visualize progress in a panel? and Blender UI Multithreading Progressbar.

Currently the only (simple) way to do this is to show the progress with the mouse cursor.
import bpy
wm = bpy.context.window_manager

# progress from [0 - 1000]
tot = 1000
wm.progress_begin(0, tot)
for i in range(tot):
    wm.progress_update(i)
wm.progress_end()

Thank's for your answer. You say "the only (simple) way". Does this means that you know other (hard) ways to do it? And of course other than those indicated in other answer?

@lucblender with python a lot of hacks are possible, like calling into operating system specific progress bars which display in the window list, or writing a modal operator that draws text in the 3d view with a timer, its possible but way overkill in almost all cases.

FWIW, on Windows (tested with 2.83), if the script takes too long (about 5+ seconds), as the UI does not 'respond', the cursor is replaced by the standard Windows spinning cursor - thus hiding the progress info.

Progress of script can also be printed and updated with sys module to the console:
import sys
from time import sleep

sys.stdout.write("Some job description: ")
sys.stdout.flush()
some_list = [0] * 100
for idx, item in enumerate(some_list):
    msg = "item %i of %i" % (idx, len(some_list)-1)
    sys.stdout.write(msg + chr(8) * len(msg))
    sys.stdout.flush()
    sleep(0.02)

sys.stdout.write("DONE" + " "*len(msg)+"\n")
sys.stdout.flush()

This can look like this:

You can also copy paste this next function to display a progress bar:
import time, sys

def update_progress(job_title, progress):
    length = 20 # modify this to change the length
    block = int(round(length*progress))
    msg = "\r{0}: [{1}] {2}%".format(job_title, "#"*block + "-"*(length-block), round(progress*100, 2))
    if progress >= 1: msg += " DONE\r\n"
    sys.stdout.write(msg)
    sys.stdout.flush()

# Test
for i in range(100):
    time.sleep(0.1)
    update_progress("Some job", i/100.0)
update_progress("Some job", 1)

This results in:

Research over this subject :
I have this but it seems that working in modal do not update the gui correctly between the tasks and it might freeze the interface anyway
so this should work in theory, but in practice it seems that there's few flaws because on how blender handle the freezing process.
(that perhaps could be resolved by using bpy.app.timers ?)
This technique consist of segmenting your code into multiple function, that you store in a dictionary of operations, then a modal operator will loop over your operations while updating the progress bar depending on you steps achievement.
import bpy
import time

#Operation Dict
#operation will  need to be divided in multiple steps

sleep = 0

def _00():
    print("f00")
    time.sleep(sleep)

def _01():
    print("f01")
    time.sleep(sleep)

def _02():
    print("f02")
    time.sleep(sleep)

def _03():
    print("f03")
    time.sleep(sleep)

def _04():
    print("f04")
    time.sleep(sleep)

Operations = {
    0:_00,
    1:_01,
    2:_02,
    3:_03,
    4:_04,
}

#Modal Operator

class EXAMPLE_OT_modal_operator(bpy.types.Operator):

    bl_idname = "example.modal_operator"
    bl_label = "Modal Operator"

    step : bpy.props.IntProperty()

    def modal(self, context, event):

        global Operations
        max_step = len(Operations.keys())

        #Update Gui
        context.object.progress = self.step/max_step*100
        context.area.tag_redraw()
        context.area.tag_redraw()

        #Running Operations Steps In Order
        if self.step < max_step:
            print(f"Operations[{self.step}]()")
            Operations[self.step]()
            self.step += 1
            return {'RUNNING_MODAL'}

        #No More steps, Restore and Done
        print("Finished")
        self.step = 0
        context.object.progress = 0
        return {'FINISHED'}

    def invoke(self, context, event):
        print("Invoke")
        #self.execute(context)
        context.window_manager.modal_handler_add(self)
        return {'RUNNING_MODAL'}

#Panel

class EXAMPLE_PT_panel(bpy.types.Panel):

    bl_idname      = "EXAMPLE_PT_panel"
    bl_label       = "Example"
    bl_category    = "Example"
    bl_space_type  = "VIEW_3D"
    bl_region_type = "UI"
    bl_context     = "objectmode"

    def draw(self, context):
        layout = self.layout
        obj = context.object

        if obj.progress:
            layout.prop(bpy.context.object,"progress")
        else:
            ope = layout.row()
            ope.operator_context = "INVOKE_DEFAULT"
            ope.operator("example.modal_operator",text="Run Modal Operator")

        return

#Registering Stuff...

bpy.types.Object.progress = bpy.props.FloatProperty(
    name="Progress",
    subtype="PERCENTAGE",
    soft_min=0,
    soft_max=100,
    precision=0,
    )
bpy.utils.register_class(EXAMPLE_PT_panel)
bpy.utils.register_class(EXAMPLE_OT_modal_operator)

Here is another test, same principle but this time using delayed function hoping that the delay between the operations might be enough to let blender "breath" so we can get a glimpse of the interface. it seems that this attempt is also failing and that blender interface simply like to keep in freeze state even if is is not supposed to

note that this technique might be limiting as execution context within a delay function is highly limiting

Not sure if my research are of any help.
I'll try to explore more solutions sooner or later

import bpy
import time
import functools

#Operation Dict
#your operation work steps should divided into multiple function

sleep = 0

def _00():
    print("f00")
    time.sleep(sleep)

def _01():
    print("f01")
    time.sleep(sleep)

def _02():
    print("f02")
    time.sleep(sleep)

def _03():
    print("f03")
    time.sleep(sleep)

def _04():
    print("f04")
    time.sleep(sleep)

#then you store then all in a dict like this
Operations = {
    0:_00,
    1:_01,
    2:_02,
    3:_03,
    4:_04,
}

#We need a function that refresh all areas
#we need this because we can't access context.area from a timer function

def refresh_all_areas():
    for wm in bpy.data.window_managers:
        for w in wm.windows:
            for area in w.screen.areas:
                area.tag_redraw()

#Then we run all steps of our Operation Dict in this operator
#the goal of this operator is to run the function from timers
#We need to run these from timers otherwise the interface might be locked and freeze when calculating

class EXAMPLE_OT_timer_operator(bpy.types.Operator):

    bl_idname = "example.timer_operator"
    bl_label = "Timer Operator"

    interval : bpy.props.FloatProperty(default=0.1)

    def execute(self, context):

        global Operations
        max_step = len(Operations.keys())

        for i,(step,operation) in enumerate(Operations.items()):
            i+=1

            def generate_delay_fct(stp,):
                """fct factory needed otherwise same function for all timer"""

                def fct():
                    """delay is needed, so interface don't freeze and we have time to display progress bar"""

                    print("execute_op_with_delay ->"+str(stp))
                    Operations[stp]()

                    #Update Gui
                    bpy.context.object.progress = (stp/max_step)*100
                    refresh_all_areas()
                    return None
                return fct

            bpy.app.timers.register( generate_delay_fct(step,), first_interval=self.interval*i,)
            continue

        def last_step():
            """one last function is required in orter to restore the progress bar to 0 once all operations are done"""
            bpy.context.object.progress = 0
            refresh_all_areas()
            return None

        bpy.app.timers.register( last_step, first_interval=self.interval*(i+1),)

        return {'FINISHED'}

#Panel

class EXAMPLE_PT_panel(bpy.types.Panel):

    bl_idname      = "EXAMPLE_PT_panel"
    bl_label       = "Example"
    bl_category    = "Example"
    bl_space_type  = "VIEW_3D"
    bl_region_type = "UI"
    bl_context     = "objectmode"

    def draw(self, context):
        layout = self.layout
        obj = context.object

        if obj.progress:
            layout.prop(bpy.context.object,"progress")
        else:
            ope = layout.row()
            ope.operator_context = "INVOKE_DEFAULT"
            ope.operator("example.timer_operator",text="Run Timer Operator")

        return

#Registering Stuff...

bpy.types.Object.progress = bpy.props.FloatProperty(
    name="Progress",
    subtype="PERCENTAGE",
    soft_min=0,
    soft_max=100,
    precision=0,
    )

bpy.utils.register_class(EXAMPLE_PT_panel)
bpy.utils.register_class(EXAMPLE_OT_timer_operator)

Solution Found

It seems that the first prototype i did was ok, and the second idea of timers was a good lead, what i needed in the end is an hybrid solution between the two.
by using a timer such as event_timer_add(), we could check for this timer in our events, then have a guaranteed unfreeze at this moment. But that's not enough, we need to extend this timeframe by just a bit! that's why i added a counter timer_count that will ignore the first 10 modal loops
in the end this is working quite fine
import bpy
import time

#Operation Dict
#operation will  need to be divided in multiple steps

sleep = 1

def _00():
    print("f00")
    time.sleep(sleep)

def _01():
    print("f01")
    time.sleep(sleep)

def _02():
    print("f02")
    time.sleep(sleep)

def _03():
    print("f03")
    time.sleep(sleep)

def _04():
    print("f04")
    time.sleep(sleep)

Operations = {
    "First Step":_00,
    "Second Step":_01,
    "Running Stuff":_02,
    "Wait a minute":_03,
    "There's a problem":_04,
    "ah no it's ok":_04,
    "we are done":_04,
    }

#Modal Operator

class EXAMPLE_OT_modal_operator(bpy.types.Operator):

    bl_idname = "example.modal_operator"
    bl_label = "Modal Operator"

    def __init__(self):

        self.step = 0
        self.timer = None
        self.done = False
        self.max_step = None

        self.timer_count = 0 #timer count, need to let a little bit of space between updates otherwise gui will not have time to update

    def modal(self, context, event):

        global Operations

        #update progress bar
        if not self.done:
            print(f"Updating: {self.step+1}/{self.max_step}")
            #update progess bar
            context.object.progress = ((self.step+1)/(self.max_step))*100
            #update label
            context.object.progress_label = list(Operations.keys())[self.step]
            #send update signal
            context.area.tag_redraw()

        #by running a timer at the same time of our modal operator
        #we are guaranteed that update is done correctly in the interface

        if event.type == 'TIMER':

            #but wee need a little time off between timers to ensure that blender have time to breath, so we have updated inteface
            self.timer_count +=1
            if self.timer_count==10:
                self.timer_count=0

                if self.done:

                    print("Finished")
                    self.step = 0
                    context.object.progress = 0
                    context.window_manager.event_timer_remove(self.timer)
                    context.area.tag_redraw()

                    return {'FINISHED'}

                if self.step < self.max_step:

                    #run step function
                    list(Operations.values())[self.step]()

                    self.step += 1
                    if self.step==self.max_step:
                        self.done=True

                    return {'RUNNING_MODAL'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):

        print("")
        print("Invoke")

        #terermine max step
        global Operations
        if self.max_step == None:
            self.max_step = len(Operations.keys())

        context.window_manager.modal_handler_add(self)

        #run timer
        self.timer = context.window_manager.event_timer_add(0.1, window=context.window)

        return {'RUNNING_MODAL'}

#Panel

class EXAMPLE_PT_panel(bpy.types.Panel):

    bl_idname      = "EXAMPLE_PT_panel"
    bl_label       = "Example"
    bl_category    = "Example"
    bl_space_type  = "VIEW_3D"
    bl_region_type = "UI"
    bl_context     = "objectmode"

    def draw(self, context):
        layout = self.layout
        obj = context.object

        if obj.progress:
            progress_bar = layout.row()
            progress_bar.prop(bpy.context.object,"progress")
            progress_lbl = layout.row()
            progress_lbl.active = False
            progress_lbl.label(text=bpy.context.object.progress_label)
        else:
            ope = layout.row()
            ope.operator_context = "INVOKE_DEFAULT"
            ope.operator("example.modal_operator",text="Run Modal Operator")

        return

#Registering Stuff...

bpy.types.Object.progress = bpy.props.FloatProperty( name="Progress", subtype="PERCENTAGE",soft_min=0, soft_max=100, precision=0,)
bpy.types.Object.progress_label = bpy.props.StringProperty()

bpy.utils.register_class(EXAMPLE_PT_panel)
bpy.utils.register_class(EXAMPLE_OT_modal_operator)

Prop to sybren from the Grove3d, i did dig a little bit to discover his logic

Or via modal timer operator.  https://blender.stackexchange.com/a/47398/15543

Nice! Thanks for posting, i suggest to make it more obvious and posting it as a solution to this thread. I did a lot of research and never stumble over this solution

Blender 4.0 now has a built-in progress bar.

Docs: https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.progress
Usage:
layout.progress(factor=0.5)
layout.progress(factor=0.8, type="RING", text="Updating")

Currently type can be "RING" or "BAR"
Factor is from 0.0 to 1.0

Blender 4.0 Changelog

More information:
Pull request with more info
Here is the Blender commit

Solution:
I've found this two solution in the blenderartist forum:

Print a text in the 3D view with the blf library
Set progress information in the header area of a window via a modal timer
In 2.69 an update in the api lets the user change the cursor appearance so we could change the cursor to the "loading" cursor.

What doesn't work:

The solution of printing a progress bar in the console only work with windows.

This part of answer may contain errors

Two of your links are dead. Can you elaborate with some code?

Could use text to show progress bar anywhere you can have text in the UI:
import bpy
from functools import partial

def progress(area):
    if progress.i >= 100:
        area.header_text_set(None)
        return
    else:
        area.header_text_set('Loading ' + progress.bar + " " + str(progress.i) +"%")
        progress.i += 0.5
        progress.bar = "█"*int(progress.i)+"░"*(100-int(progress.i))
        return 0.01

progress.bar = ""
progress.i = 0

bpy.app.timers.register(partial(progress, bpy.context.area))

Here's a minimal working example that displays a progress bar filling in the UI. I used a modal operator and a timer but it can be driven by any property. You'll need Version 4.0 and  bpy.types.UILayout.progress. You're kind of obligated to use a modal operator since a regular operator's execution will block updating the UI until it finishes. Note autosave is disabled while a modal operator runs.

import bpy

class ModalTimerOperator(bpy.types.Operator):
    bl_idname = "wm.modal_timer_operator"
    bl_label = "Modal Timer Operator"

    _timer = None

    def modal(self, context, event):
        [a.tag_redraw() for a in context.screen.areas]
        if self._timer.time_duration > 3:
            context.window_manager.progress = 1
            return {'FINISHED'}
        context.window_manager.progress = self._timer.time_duration / 3
        return {'PASS_THROUGH'}

    def execute(self, context):
        wm = context.window_manager
        self._timer = wm.event_timer_add(0.1, window=context.window)
        wm.modal_handler_add(self)
        return {'RUNNING_MODAL'}

def progress_bar(self, context):
    row = self.layout.row()
    row.progress(
        factor=context.window_manager.progress,
        type="BAR",
        text="Operation in progress..." if context.window_manager.progress < 1 else "Operation Finished !"
    )
    row.scale_x = 2

def register():
    bpy.types.WindowManager.progress = bpy.props.FloatProperty()
    bpy.utils.register_class(ModalTimerOperator)
    bpy.types.TEXT_HT_header.append(progress_bar)

if __name__ == "__main__":
    register()
    bpy.ops.wm.modal_timer_operator()

Here's a second technique using a non-modal operator. You'll notice your script takes significantly longer if you update the UI a lot. I suggest doing it sparsingly. Also the cursor flickers a lot, at least on windows.
import bpy

class TimerOperator(bpy.types.Operator):
    bl_idname = "wm.timer_operator"
    bl_label = "Timer Operator"

    def execute(self, context):
        progress_bar.progress = 0
        for i in range(100):
            progress_bar.progress += 0.01
            bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
            bpy.ops.mesh.primitive_cube_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
        return {'FINISHED'}

def progress_bar(self, context):
    row = self.layout.row()
    row.progress(
        factor=progress_bar.progress,
        type="BAR",
        text="Operation in progress..." if progress_bar.progress < 1 else "Operation Finished !"
    )
    row.scale_x = 2

progress_bar.progress = 0

def register():
    bpy.utils.register_class(TimerOperator)
    bpy.types.TEXT_HT_header.append(progress_bar)

if __name__ == "__main__":
    register()
    bpy.ops.wm.timer_operator()

Is there a way to show progress while subprocess.run(command) is running? I mean there is no way for percentage. Just something like this since the progress depends, sometimes it can take very long so I need feedback to the user that it's in progress. Currently there is no way but looks as if it hangs. That's bad feedback :(

@HarryMcKenzie You can, but you need to run it in a separate thread and use a queue to receive updates https://docs.blender.org/api/current/info_gotcha.html#strange-errors-when-using-the-threading-module

This is a complete example of updating a UI progress bar using multithreading :)  by Blender 4.1

import bpy
import threading
import time

bl_info = {
    "name": "LaserScanningModeling",
    "author": "ShaderFallback",
    "description": "",
    "blender": (2, 80, 0),
    "version": (0, 0, 1),
    "location": "",
    "warning": "",
    "category": "Generic"
}

# Global variables to save progress
progress = 0.0
is_scanning = False
stop_requested = False

def remap(value, from_min, from_max, to_min, to_max):
    from_span = from_max - from_min
    to_span = to_max - to_min
    value_scaled = float(value - from_min) / float(from_span)
    return to_min + (value_scaled * to_span)

def update_ui():
    # Force UI update
    for window in bpy.context.window_manager.windows:
        for area in window.screen.areas:
            if area.type == 'VIEW_3D':
                area.tag_redraw()
    if is_scanning:
        return 0.1  # Call every 0.1 seconds
    else:
        return None  # Stop the timer

def scan_task():
    global progress, is_scanning, stop_requested
    for i in range(30):
        if stop_requested:
            progress = 0.0
            break
        progress = (i + 1) * 3.33  # Progress from 0 to 100
        time.sleep(1)  # Simulate time-consuming task
    if not stop_requested:
        progress = 100.0  # Set to 100% when done
    is_scanning = False
    stop_requested = False
    bpy.app.timers.register(update_ui)

class buttonExplode(bpy.types.Operator):
    bl_idname = "button.explode"
    bl_label = "Start Scan"

    def execute(self, context):
        global is_scanning, stop_requested
        if not is_scanning:
            is_scanning = True
            self.report({'INFO'}, "Starting scan...")
            my_thread = threading.Thread(target=scan_task)
            my_thread.start()
            bpy.app.timers.register(update_ui)
            buttonExplode.bl_label = "Stop Scan"
        else:
            self.report({'INFO'}, "Stopping scan...")
            stop_requested = True
            buttonExplode.bl_label = "Start Scan"
        return {'FINISHED'}

class HelloWorld(bpy.types.Panel):
    bl_idname = "TEST_SCRIPTS"
    bl_label = "LaserScanningTool"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_category = 'LaserScanningTool'

    def draw(self, context):
        global progress, is_scanning
        layout = self.layout
        layout.label(text="Scan Plugin")
        layout.operator("button.explode", text="Stop Scan" if is_scanning else "Start Scan")
        layout.label(text=f"Progress: {progress:.1f}%")
        value = remap(progress, 0, 100, 0, 1)
        layout.progress(factor=value)

def register():
    bpy.utils.register_class(HelloWorld)
    bpy.utils.register_class(buttonExplode)
    bpy.types.Scene.scan_progress = bpy.props.FloatProperty(name="Scan Progress", min=0, max=100, default=0.0, get=lambda self: progress)

def unregister():
    bpy.utils.unregister_class(HelloWorld)
    bpy.utils.unregister_class(buttonExplode)
    del bpy.types.Scene.scan_progress

if __name__ == "__main__":
    register()

How to show a progress bar and load the cpu in the background
demo featuring

Progress Bar!
Responsive GUI
Background Thread (long uninterrupted compute time allowed!)
Signals (user cancel-able pattern)
Memory Safety
Developer Comments
State Reset (user preferences respected)

tested on 2.82 manually :✔:
# blender progress bar
# License: AGPL

import bpy
import bpy.props

import time
import threading

class ThreadExample:
    def __init__(self, context):
        self.thread = threading.Thread(target=self.main)
        self.tid = None

        # self.state is protected by this lock
        self.lock = threading.Lock()
        self.state = None

        # blender memory is protected by this lock
        self.context_lock = threading.Lock()
        self.context = context

    def reset(self):
        self.state = {
            'tid': None,
            'state': None,
            'progress': None,
            'signal': None,
            'rc': None,
        }

    def start(self):
        self.reset()
        self.thread.start()

    def signal(self):
        """ react to user signals (0=RUN, 2=INTERRUPT, 15=EXIT)
        """
        with self.lock:
            if self.state['signal'] != 0:
                self.state.update(dict(state='DONE', rc=1, signal=None))
        return False

    def progress(self, part, total_parts):
        """ inform blender of our progress
        """
        with self.lock:
            self.state.update(dict(state='RUN', progress=part/total_parts))

    def main(self):
        """ your workload here
        """
        # get local ro state copy
        state = dict()
        with self.lock:
            state.update(self.state)

        self.enter_()

        with self.context_lock:
            scene_objects = [i.name for i in self.context.scene.objects]
            scene_objects_len = len(scene_objects)

        for idx, obj_name in enumerate(scene_objects):
            # check for user abort regularly, the thread is atomic between self.signal() calls
            # if the user requests quit, blender will hang until we react
            if self.signal(): return

            with self.context_lock:
                # your workload here
                obj = self.context.scene.objects[obj_name]
                print("%r" % ((self.state['tid'], obj),))

            # report progress
            self.progress(idx, scene_objects_len)
        self.exit_()

    def join(self, *args):
        self.thread.join(*args)

    def enter_(self):
        tid = threading.get_ident()
        with self.lock:
            self.state.update(dict(tid=tid, state='RUN', progress=0.0, signal=0))

    def exit_(self):
        with self.lock:
            self.state.update(dict(state='DONE', progress=1.0))

class ModalOperator(bpy.types.Operator):
    """Move an object with the mouse, example"""
    bl_idname = "object.modal_operator"
    bl_label = "Simple Modal Operator"

    singleton_p = [True]
    dirty_timer = None
    focus_reset = None

    @classmethod
    def poll(cls, context):
        return cls.singleton_p[0]

    def _enter(self, context):
        bpy.context.window.cursor_set("WAIT")
        self.focus_reset = self.focus()
        self.singleton_p[0] = False
        bpy.context.window_manager.modal_handler_add(self)
        self.dirty_timer = bpy.app.timers.register(self.dirty_interval, first_interval=2.0)
        self.thread = ThreadExample(context)
        self.thread.context_lock.__enter__()
        self.thread.start()

    def _exit(self):
        bpy.context.window.cursor_set("DEFAULT")
        for area, context in self.focus_reset:
            area.spaces.active.context = context
            self.focus_reset = None
        with self.thread.lock:
            self.thread.state['signal'] = 15
        self.singleton_p[0] = True
        if bpy.app.timers.is_registered(self.dirty_timer):
            bpy.app.timers.unregister(self.dirty_timer)

        self.thread.join()
        self.thread.reset()
        self._progress(self.thread.state)

    def cancel_(self):
        """ request thread exit
        """
        with self.thread.lock:
            self.thread.state['signal'] = 2

        self._exit()
        self.report({'WARNING'}, "operation stopping ...")
        return {'CANCELLED'}

    def finish_(self):
        """ thread finished
        """
        self._exit()
        self.thread.state['progress'] = 1.0
        self._progress(self.thread.state)
        return {'FINISHED'}

    def _progress(self, state):
        """ copy progress from thread to blender
        """
        if state['progress'] is not None:
            bpy.context.scene['modal_progress'] = state['progress']
        else:
            del bpy.context.scene['modal_progress']

    def dirty_interval(self):
        """ blender only redraws if something happened, the thread doesn't count
            so we artificially "do something" regularly, so the progress bar
            will get redrawn
        """
        try:
            state = dict()
            with self.thread.lock:
                state.update(self.thread.state)

            self._progress(state)
            self.dirty()

            return 1.0/12 # fps

        except ReferenceError:
            # modal finished, "self" is deallocated
            pass

        return None

    @staticmethod
    def get_screens():
        screens = bpy.data.screens
        if bpy.context.screen:
            screens = [bpy.context.screen]
        return screens

    @staticmethod
    def dirty(areas={'PROPERTIES'}, regions={'WINDOW'}):
        """ progress bar is drawn as a scene custom property
        """
        for screen in ModalOperator.get_screens():
            for area in screen.areas:
                for region in area.regions:
                    if area.type in areas and region.type in regions:
                        region.tag_redraw()

    def focus(context='SCENE'):
        """ try to make sure the progress bar is on screen
        """
        ret = []
        for screen in ModalOperator.get_screens():
            for area in screen.areas:
                if area.type != 'PROPERTIES': continue

                ret.append((area, area.spaces.active.context))
                area.spaces.active.context = 'SCENE'
        return ret

    def modal(self, context, event):
        # get read-only copy of thread state
        state = dict()
        with self.thread.lock:
            state.update(self.thread.state)

        # redraw progress indicator
        self.dirty()

        # check if user abort requested
        cancel = event.type in {'ESC'} #, 'RIGHTMOUSE'}
        if cancel:
            return self.cancel_()

        # check if thread finished
        if state['state'] == 'DONE':
            return self.finish_()

        assert self.thread.state['state'] == 'RUN', 'unhandled thread state %r' % self.thread.state['state']

        # report progress from thread to blender
        self._progress(state)

        # dedicated time for thread to read blender state
        self.thread.context_lock.__exit__()
        time.sleep(1/24)  # gui min 24 fps - threat read time
        self.thread.context_lock.__enter__()

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        self._enter(context)
        return {'RUNNING_MODAL'}

class ProgressPanel(bpy.types.Panel):
    """Progress Bar"""
    bl_label = "Progress Panel"
    bl_idname = "SCENE_PT_layout"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"

    # try to make sure the progress bar is on screen
    bl_options = {'HIDE_HEADER'}

    def draw(self, context):
        layout = self.layout

        if context.scene.modal_progress < 1.0:
            text = "Progress: %3.2f%% (ESC to cancel)" % (context.scene.modal_progress*100.0)
        else:
            text = "Progress: Done"
        layout.label(text=text)

        row = layout.row()
        row.prop(context.scene, "modal_progress")

def register():
    bpy.utils.register_class(ModalOperator)
    bpy.utils.register_class(ProgressPanel)
    bpy.types.Scene.modal_progress = bpy.props.FloatProperty(name="Modal Progress", min=0.0, max=1.0, subtype='FACTOR')

def unregister():
    bpy.utils.unregister_class(ModalOperator)
    bpy.utils.unregister_class(ProgressPanel)
    del bpy.types.Scene.modal_progress

if __name__ == "__main__":
    register()
    # test call
    bpy.ops.object.modal_operator('INVOKE_DEFAULT')

Mirror opencode.net: https://www.opencode.net/-/snippets/3378
Mirror archive.org: https://web.archive.org/web/20230705035959/https://www.opencode.net/-/snippets/3378/raw/main/blender_progress_bar.py

well, the progress state/status reporting is working, drawing the progressbar is trickier,
possible future work

create a progress window (seems impossible currently)
to ensure progress bar in on screen, or reset the current window to a specific predictable gui element (possible, but, too invasive)
drawing a progress bar, with import gpu overtop of some existing ui element
find a way to place gui elements more concretely (with many plugins installs, this progress could be pushed off screen)

This doesn't work in 3.6.0 it just freezes until you press escape. Leaves a useless property in the Scene tab, Properties Editor...

Could simply use something like this

hmm, i just tried it on blender 3.6.0 (Linux) and has no issues, seemed to work as intended. you might be talking about blender's Modal mode where it doesn't let you intact with the UI while a modal operator is running, you can still however interrupt the background job by pressing escape, or bind more hotkeys if you like. i think that is what you are talking about @MartynasŽiemys - this method allows the ui to be updated/painted while the thread is running

hmm, i'll think on doing a non-modal version, that will break blender's undo feature, but some people might like to trade "blender being usable" for complicating their background blender<->thread edge cases/synchronization

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Create triangulated faces from edge loop in one step
I have a very large mesh (18M verts, 37M tris) that I need to manually clean up some areas of. (Oof.) Currently I'm cleaning up some long, thin holes (~100 edges on each side, two edges at the ends) by selecting an edge loop around the hole, pressing F to fill with a single face, and then using Face > Triangulate Faces. Because this mesh is so large, and this computer is not super fast, it takes ~30 seconds to create the face, and ~20 seconds to triangulate it. It would make my easier if I could combine those.
Is there a way to kick off a single command that will do the equivalent?
I see that Triangulate Faces shows the shortcut of Ctrl-T, but for some reason typing F and then Ctrl-T immediately does not end up queueing the second command; I have to wait until the face is created.
Blender 4.2 running on Ubuntu/Snap Linux, if it matters.

Can you not just put a triangulate modifier on the object?

@Jakemoyo Answered with a screenshot; the vast majority of the mesh is quads; stitched together with tiny seams that don't line up, and need to be triangulated.

If you press Alt+F when in edit mode it will use the older "Fill Face" operator which automatically fills with tris. You probably have the F2 addon activated which makes it to where "F" fills with an ngon.

@Jakemoyo Perfect! Thank you. Care to post that as an answer, so I can accept it?

If you press Alt+F when in edit mode it will use the older "Fill Face" operator which automatically fills with tris. You might have the F2 addon activated which makes it to where "F" fills with an ngon.

This works nicely most of the time. In a few cases, Face > Fill produced triangulation I didn't like (creating many, much longer edges) while F, Triangulate Faces produced the desired result.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Mute/Unmute NLA actions on all objects by name
I have file with 55 objects and 86 NLA actions using four distinct names - many NLA tracks with the same name are used to control many objects with a single animation when exporting to glTF. I want to preview just one of the action names. How can I iterate through all the NLA stacks and tracks (I think those names are right) and mute all the tracks that don't match the name, and unmute all the tracks that do match the name?
For example, given the string "Length" I want the NLA editor to look like below, muting tracks named "Selected", "Width", or "ShowSymbol", and unmuting all tracks (and their parent stack, if needed) with the name "Length".

Enabling/disabling the parent stack is done via object.animation_data.use_nla = True/False, while enabling/disabling a specific track is done via nla_track.mute = False/True.
import bpy

desired_action_name = "Length"

for obj in bpy.context.scene.objects:
    if obj.animation_data and obj.animation_data.nla_tracks:
        has_matching_track = False
        for track in obj.animation_data.nla_tracks:
            name_matches = track.name == desired_action_name
            has_matching_track = name_matches or has_matching_track

            # Toggle the checkbox for the track row
            track.mute = not name_matches

            # Ensure no track is solo'd (which overrides muting)
            track.is_solo = False

        # Toggle the checkbox for the object
        obj.animation_data.use_nla = has_matching_track

The script assumes that all NLA strips for other tracks are already unmuted. (Muting a track implicitly mutes the strips in it, so there's no need to mute/unmute the individual strips.)
If you want to ensure all your strips are unmuted:
import bpy
for obj in bpy.context.scene.objects:
    if obj.animation_data and obj.animation_data.nla_tracks:
        for track in obj.animation_data.nla_tracks:
            for strip in track.strips:
                strip.mute = False

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Help with modeling this hairstyle
Edit: changed the title since "low-ponytail" sounds similar to "low-poly", so it might confuse people as to what I'm asking for. Sorry about that!
As the title suggests, I'd like to know the best method for creating this hairstyle: (original reference by undeadluciel on discord, I don't know what their other handles are)

I'm just having trouble getting the basic shape of the hair down, as I've never modeled anything like this before. Should I use curves? Should I sculpt the hair? I'm a bit stumped. Any help is appreciated :)

It would be helpful to give examples (if you have any) of already modeled hairstyles in the style you want this to emulate.  There are a lot of different ways to  model polygonal hair, and "low-poly" can mean different things to different people.

@jwrush hey there, could you clarify what you mean by "already modeled hairstyles"? If you mean stuff I've modeled, I unfortunately don't have any examples to show. If you mean other models online, I'm currently looking for models similar to the reference I've attached in the original post.  Also, I'm not necessarily asking for advice on how to model low-poly hair. I'll change the title though since "low-ponytail" is similar to "low-poly", and can therefore confuse others.

I guess he means do you have some 3D models close to what you're looking for

That's what I meant, but if you're okay with the answer, no need.

@jwrush Ah, thank you for clearing that up. I'll go ahead and add some extra references. Just give me a moment!

You could try this way:
Begin with a rough lowpoly shape without any thickness:

Continue all around the head:

Give it a Solidify modifier and a Subdivision Surface level 1:

When you've done your best with this method, apply the modifiers, and work more in detail:

You will also be able to sculpt details on a highpoly version that you'll bake:

Thank you so much! I'll try this out. :)


text:
Environment texture not effecting model in eevee but working fine in cycles
I am new to blender, not sure if I am doing anything wrong with blender settings or is it a blender bug.
I am trying to increase environment texture strength but, I am not able to get environment texture light effect on model in eevee, but works fine in cycles.
Please refer below images
In Eevee environment texture with strength 1

In Eevee environment texture with strength 10

In Cycles environment texture with strength 1

In Cycles environment texture with strength 10

Appreciate some help. Let me know if any other details required.
System info :
Windows 10
16gb ram
Blender 3.0.0 alpha
faced same issue in other blender versions too
Attaching the video link which will help you to understand issue I am facing.
Google drive link to blend file
Thanks in advance

A blend file would be useful along with some step by step instructions, rather than asking people to watch a video. (How to add a blend file)

Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.

@MartyFouts I have updated question with drive link for blend file. I am not able to upload blend file in the link provided by you since its 76 MB.  Let me know if anything more detail you need. Sorry for unclear question.

EEVEE has environment lighting, but no shadows are cast from it, unlike Cycles. Is that what we are talking about (screenshots of the difference between the two would help)

@TheLabCat I have now attached screenshots for both Eevee and cycles. I want to achieve environment light effect in eevee.

Thx, that’s much more clear :-) Hmm, this is odd. That is an environment texture node and not just a regular image texture node, right?

@TheLabCat Ha yes its environment texture node

I suspect this is a bug, so not your fault.

Make sure that you didn't have any indirect light bake, if you did, you just need to go to the render setting > Indirect Lighting >Delete Lighting Cache.

@Emir Thank you so much. Deleting Lighting Cache worked for me.

I’m voting to close this question as off topic because it is about troubleshooting temporary issues with unfinished under development experimental versions of software, which are expected to be working properly upon stable release. This produces a question unlikely to be useful for future users, rendering its long term value low, making it unsuited for this site.


text:
I imported the Collada file into Blender, after I import it why is there a vertices in solid mode?
I imported the Collada file into Blender, after I import it why is there a vertices in solid mode? even though I unchecked the wireframe option in the viewport display. can it be deleted, if possible please show how? thank you

did you turn off geometry > wireframe in the viewport overlays menu in the top right of viewport?

Just select all the vertices in Edit Mode and merge them (press M, and choose By Distance).


text:
Objects move out of collection upon disabling collection
I don't know what's causing this. When I disable a collection, the objects automatically move out of the collection and stay visible. Once I enable the collection again, they move back into the collection.

can u please show us a screenshot (before/after)?

there's not much to show except the objects automatically moving out of the collection once the collection is disabled.

Make sure objects aren't part of both of those collections. You can see which collections they belong to in Properties editor > Object > Collections

so if they are in two or more collections the object wont disappear unless both are disabled? thank you.


text:
color management: prefilter
Color management influences before the nodes. Is it right?
In this scene - 100% white circles look like shades of gray. In Addition blend mode - they become translucent.
But in this case - translucency occurs only if the "mix" node receives a color other than white. Yet I didn't send gray in the first place: I send 100% white. This means that the filter affects the color before it enters the "mix" node. Right?
This article doesn't describe enough about the route and behavior. I assumed that the filter should be post, not pre. But apparently the filter is more complicated (otherwise it's a bug?)
And if indeed the filter works at the beginning - this is important to keep in mind, at least when working with a mask. Otherwise, you may get unpredictable results.

Are you in Filmic, where pure white is about 16.29?

Color management are not influences the image value.
So, it influences after the nodes
In your case. You will see the highest pixle value of Filmic and Standard are same as 2.0.
If you use Standard, there is no problem to set both 1.0
If you use Filmic, you need set higher than 16.19

it doesn't solve.
Please, check how Clamp affects on rendered image,
this is compare two splitted images: screenshot.
Blend.file of demo-scene, link

I update a solution for you.


text:
How do i render black light effects on the object?

No matter what I tried to make the object render for the black light it just goes wrong.
Like if you want the object to glow florescent under the ultraviolet light, not the shadows or the darker shade but the exposer to the lamp.

https://blender.stackexchange.com/questions/148887/how-to-simulate-a-blacklight-effect https://blender.stackexchange.com/questions/166425/blacklight-cfl-bulb-effect

From the screenshot it looks like you are trying to use Blender 2.79 and its old internal render engine, any reason to use that instead of any more modern versions with Eevee or Cycles?


text:
Does "Join as Shapes" not work for curve objects?
Today I tried to join one curve object to another as a shape key, but the function is greyed out in the menu. Is "Join as Shapes" not supported for curve objects?
Both objects have the same number of verts/points. Actually, one was made by duplicating the other, so they have the same curve resolution and everything.

Currently Blender's manual does not mention a lack of support for curve objects:

Join as Shapes (Transfer Mix)
Transfer the current resulting shape from a different object.
Select the object to copy, then the object to copy into. Use this
action and a new shape key will be added to the active object with the
current mix of the first object.

Most of the functionality of Shape Keys holds true for both meshes and curves. So I'm surprised by this. I also tested this on other curve objects, and the result is the same. Also, I verified that Join as Shapes is still working as expected on mesh objects.

I can only say that from my experience it doesn't seem to work. But it's not just the Join as Shapes functionality. If you e.g. simply join two curves that have shape keys this really messes them up and shape keys get lost - whereas two mesh objects join perfectly fine and the shapes and shape keys are preserved.

@GordonBrinkmann That is an interesting observation... thanks for sharing. I just tested it, and got pretty bizarre results myself. Almost like the Z axis became the X axis for the newly added part of the geometry.

Yss, and for example if you join two mesh objects, let's say the first with one shape key and the other with two then the merged object has two or three (depending on the keys' names, keys with the same name will be merged). But with curve objects, the shape keys of one object are lost after merging.


text:
GN: How to assign a random range of colors to islands?
The Mesh Island node is helpful for isolating the geometry islands:

But I'm only getting binary black and white values:

How can I map this across a float range of 0.0 to 1.0?
(Then I could color it using a ColorRamp.)

Simply use float in the random value node?

Fractions or decimals are not integers. To get a value in between, switch the Random Value node type to to Float or try any other type.

D'oh! So obvious! Actually, I had tried that and it didn't make any difference. Can you guess why? ...The Group Output node's Output Attribute socket was still dark green, expecting an integer type. After creating a new (float value) output, it works. :-) Thanks.

@Mentalist I guess a could never have figured that out :D

@Mentalist if your output is an integer, all values passed to it will be cast (converted) to an integer, which for floats means truncating the fraction (flooring positive values and ceiling negative values). You can modify domains, types, names of inputs/outputs in the Numbers Panel of the tree editor

@MarkusvonBroady Thank you for those details. I was wondering about whether it would round to an integer, but it's helpful to know it will truncate.


text:
How to get normal colors in Geometry Nodes
I am aware of how to get normal vector/color data for a matcap in a material.
Example of matcap normal data:

But how can that vector/color data be obtained within Geometry Nodes from the input geometry?
I can see that the Normal node does give some kind of normal data, but it doesn't look the same.

The matcap appears in camera space.(it changes with the view) Is that what you want? Or do you want the normal in tangent space, fixed to the surface, as it would be when baked into the UV? How do you want to use this data?

If we want to display the normals of an object like they are displayed in Blender-- possibly with a matcap, but possibly with a few other different methods-- the main thing we need to do is map the normals from their existing -1,1 range to the visible 0,1 range:

Here, I'm using geometry nodes to create an attribute representing our remapped, object space normals.  We can see on the Suzanne on the left, that isn't what you expect, but on the Suzanne on the right, who has been rotated so that her Z axis points roughly toward our view, that's what you expect.
So with the matcap, what we're actually interested in is our camera space normals.  To do that, we need to know what our camera space is.  The easiest way to do that (not the only way, but the easiest) is to simply instance our geometry from an object that copies the transform of the camera:

Here, I have a different mesh object, copying transforms from the camera via a constraint, and then instancing a hidden mesh (shown in this image with a wireframe.)  We're still displaying our object space normals, but our object space is now the exact same space as our camera space.
What if we don't want to have a camera?  Can we use the location of the viewport eye as a space?  No.  While there are ways to use the location of the eye in shader nodes, there is no way to use it in geometry nodes.  When you think about it, this makes sense: we might, after all, have two different viewports open; would Blender keep track of different geometry for each viewport?  It works with shader nodes because, yes, each viewport does keep track of different samples, different renders.

With you most of the way... (Nice way to Camera Space) I could be wrong, but I thought the Blender matcap used this XYZ->RGB ?  BTW, thanks for your edit yesterday.

@RobinBetts It's hard to say exactly how that matcap is built, since that description differs from mine by 0.5/255 in one channel, and we don't have a center texel for the matcap.  I suppose it's technically computable from the adjacent texels?  Seems like not worth worrying about to me.

Oops, of course. the 128-255 Z makes no difference with no negative Z's. I was wrong :) sorry

You can use Map Range in Vector mode.

Oops, we wouldn't tell at the central texel anyways, we'd tell at the silhouette texels.  (Which makes me wonder even more why anyone would bother; they'd be better off caring about their 0.5 RG values than B, 001 is the most important vector.)

@MarkusvonBroady Thanks, I didn't realize that!  Wish I could do the same in shader nodes.

Thank you :-) Your explanation about remapping the normals helped me understand this better. I admit though, that I don't completely understand why it is necessary to use a constraint and instancing of a "hidden mesh". Is it perhaps possible that the same result can be achieved using the camera's coordinates? Something similar to the method used in this answer?

@Mentalist We have object space normals, but if you want camera space normals, the easiest thing to do is to make your object's space the same as the camera's space.  If you don't-- then don't worry about it.  That answer is maybe halfway there, because it gets one vector from your camera, but you need two vectors to figure out your camera's space (can't determine rotation from only Z, you need X or Y, otherwise those vectors could point anywhere in the Z plane.)  Like I said, I think it's easiest to do it just by instancing onto something with the same transform.

I was thinking about how this method will scale if there are multiple objects using it. Will hidden duplicates need to be created for each? ...and so on. So if there is a way to get the camera space into the GN setup and rely on that vector data (instead of using the constraint method) I'd be curious to know more about that. However, if the existing solution relies on the camera's data in some way that causes the constraint + hidden duplicate to be necessary, then maybe this is the best solution. (I want to experiment with this more, but unfortunately I can't right at the moment.)

@Mentalist Instance a collection onto a single object.  But really, it's hard to imagine why you actually want to do this, when you could just do a matcap render anyways; I only answered the question you asked.  I would recommend you ask about your actual problem, at a "how to achieve this render" level rather than a "how to make GN do what I want" level, because the odds are good that there is something easier than you're contemplating.


text:
Is there a way to include material color changes in motion blur?
In both Eevee and Cycles, changes to the material color are not rendering in the motion blur.
For example, if there is a moving cube that is red on frame 1, and keyframed to transition to blue on frame 2, the sub-frame calculations do not result in a blur that trails off into purple. Instead the blur is entirely red on the frame that is keyframed to red, and entirely blue on the frame that is keyframed to blue.
I guess this is probably done to speed up rendering, but for my project that has quick color changes it is undesirable. Is there any way to get Blender's motion blur to account for material color changes as well as motion?

I'm not sure about the technical implementations, but I think the motion blur is calculated via speed vectors, and the color change simply doesn't generate speed vectors in the mesh... But I maybe completely wrong here.

The obvious answer is to render at a higher framerate, and then use video editing software (even Blender) to merge it back. I don't know how optical flow algorithm would deal with color changes, but simple alpha overlaying would get you exactly what you want.


text:
Blender 2.83 - Hair particles with big diameter showing cuts in strands
I am trying to make an anemone like model and want to render the tentacles as hair particles. So I need to increase the root diameter quite a lot. It is actually a few meters now (which of course is not realistic), but I don't think that adds to the problem.
In the render preview you can see cuts in some hair strands and I wonder why this happens.

For the shader I do not use Hair BDSF but a simple custom one for now. I tried to adjust render steps, segments, render path settings, shader .. but nothing has an effect on the issue. I'll append the file to fiddle with.
If you increase the render steps (Render Tab -> Path) to 5 and check the B-Spline option the result gets smoother, but then the strand will look like an elephant's trunk (more cuts) :-) like so:

The interpolations just does not seem smooth. I forgot to check "Close Tips" for the screenshots, but this also does not have an effect on these cuts.
I could always make a few tentacle objects and use a particle group instead, but I wonder if is not possible to solve this using the standard hair system.
Happy if you have an idea.

See if this works for you, it seems to have fixed the issue in my machine.

Change the Primitive to curve segments in Render Properties > Hair.

Oh my, yes it does on my machine too, great! I am happy with the result. I never really changed those parameters before, thanks a lot for pointing that out! Only drawback seems to be much longer rendertimes, but that's bcs. I can't render on GPU and my machine is old.

Try using the least amount of curve subdivisions you can get away with, cuz I literally just punched some random number in there, to see if that helped, no further testing.
But unfortunately, that's how it goes, there's always a trade off between quality and render time..... I'm just glad it works!
Best of luck!

Thanks again, I ended up with 4 Curve subdivisions and got a smooth enough result..

No problem, have fun!


text:
"Use self" doesn't work?
I'm currently working with drivers in Blender 2.81 and want to use self but it doesn't work.
For example drive the rotation by the location, I'm adding a driver to the rotation, check the Use Self box and write self.location.x
Blender return the message: ERROR Invalid Python expression.
Have I missed something, is it a bug?
edit:

Can you post a picture of driver editor.  Recent example doing just this https://blender.stackexchange.com/a/164893/15543

also post any error message that may be printed to console re the error in your expression. Make sure there is no leading spaces in expression for example.  Look for "Error in Driver: The following Python expression failed:"

https://blender.stackexchange.com/questions/6173/where-does-console-output-go

I'm working on 2.9. Problem is still here.
Allowing auto run python scripts fixed it.

Look in the system console.
As an addendum to the accepted answer, to use self in drivers requires enabling auto-run python scripts. However will also get an invalid expression python error, if ... you have an invalid expression.
When you get an error in a driver expression look at the system console.
Where does console output go
Use self and the slow python expression
Turning off allow auto-run python scripts with use self can lead to invalid expression error.. looking at console.
BPY_driver_eval() - restricted access disallows name 'location', enable auto-execution to support

Error in Driver: The following Python expression failed:
'self.location.x'

Will give a big tip that checking enable auto run fixes this... but as demonstrated here
How to use a custom property of an object as input for a driver? an error in the driver expression can also produce an invalid python expression error message.
So for example  accidentally on purpose making a typo

Will look like this with or without auto run python scripts
self.lodation.x

With python auto run OFF error
    BPY_driver_eval() - restricted access disallows name 'lodation', enable auto-execution to support

Error in Driver: The following Python expression failed:
    'self.lodation.x'

With python auto run ON error
Traceback (most recent call last):
  File "<bpy driver>", line 1, in <module>
AttributeError: 'Object' object has no attribute 'lodation'

This appears to no longer work in 4.2.2 LTS


text:
Eevee Texture Edge Problem
I'm doing a few tests on Eevee because I'm migrating from Cycles to Eevee. In this particular test, I realized that the edge of my texture is being rendered differently (and inaccurately) with Eevee.
I used these two textures, they are exactly the same except for their colors:

And this is my node setup:

The idea is to use second image texture's alpha to allow me to change the color of the cube without affecting the text's color (Yes, I know there are easier ways to do it, I just want to test out the difference).
So these are the differences:

I noticed that for eevee the text's tiny grey edge became bigger when the camera is further away from the object. As for cycles, it is rendered correctly because the edges are small and "disappeared" when the camera is further away.
Looks like the edges were pixelated and enlarged in Eevee. Any idea on what is happening and what should be tweaked so that it would render similar to Cycles?
Thank you!
This is the blender file if you wish to try it out:
EEVEE_ImageTextureEdgeTest.blend

If you want to avoid smoothing caused by interpolation, set the Texture Interpolation to closest instead of linear. Then both results in Eevee and Cycles look very similar.
Eevee

Cycles

Eevee

Cycles

Thank you so much for explaining and testing!

The white edges come from sampling of the white background in the color texture. The main problem is that the texture should just look like this:

You can fiddle with texture sampling settings (like @rjg suggests), but this will fix your white lines in closeups too, in cycles and eevee, and is the way to texture if there are transparency/alpha masks/channels - make sure colors bleed over the edges.


text:
Transparent PNG over a base material
I am trying to have a transparent PNG over a base material.
I tried using the same technique as mentioned here but somehow i am getting the mesh lines in the render.
How can I setup a Material in Cycles for Z-Transparency?
Transparent image textures in cycles
Can someone please guide me. Thanks in advance.
Regards S

Did you exported UV Map to external software? It seams like you didn't remove UV Map wires.

@LukeD Yes. Sorry i did not notice that the texture had the UV wires on them. Thank you.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
How to create real tilt-shift lens blur in Blender?
I basically want to rotate the DoF-Plane just as a real tilt-shift lens does, so that the depth influences the blur and not a gradient. Is there a way to recreate this effect in blender?

@cegaton you can only shift there, you can't tilt

Please could you elaborate on this question - what specific effect are you trying to achieve (I don't know much about the operation of tilt-shift lenses) - preferably with a sample image or diagrams. I suspect this will be possible with creative use of Refraction shaders.

I want to provide an alternative to cegatons answer. This is an attempt to reproduce the behavior of a real Scheimpflug. The focus plane is supposed to "cut" objects. When you create the focus plane in post however, it doesn't intersect with the objects. To mimic this behavior, follow these steps:

Create a Cube in your scene, name it "gradient Cube" or similar, it will control the falloff of the gradient. In the object tab, disable all cycles visibility options (camera, diffuse, ..., shadow) to make it completly invisible for the renderer. Create a second RenderLayer ("gradient"), add a material to it, with the nodesetup shown in image 1. In the TextureCoordinate node choose your gradient cube as object input.
Position the cube so that the middle grey (~0,5) of the gradient follows the desired Scheimpflug. The farthest visible point from camera should be black (0), the neares white (1).
Render the image. Save each RenderLayer to OpenEXR, 32 Bit float. I added the contrast only for illustrating that the gradient now "cuts" the objects. The actual gradient is very flat.
I would recommend not to use the blender Defocus. It produces horrible artifacts. I used Nuke non-commercial, which is free to download/use with some restrictions in functionality. Read both renderlayers. Shuffle them together, take RGB from the beauty pass and shuffle the R channel of the gradient layer to Z(depth). Insert ZDefocus, choose the focal point. To round it off, introduce some grain. (the out-of-focus areas looked too smooth)

The result with animated gradient-cube:

Yesss! Thank you so much! This is exactly what I was looking for. Sorry for checking the wrong "right-answer" first


text:
Mirror modifier using geometry nodes, supporting arbitrary rotations
My question is very similar to the following question:
Geometry node: mirror position of object
However, the GN I'm using causes a glitch when I apply a rotation.
Is there a way to flip the object left and right while also referencing rotation?
If I rotate the Y axis, it is working as I expect it to:

However, Z and X axis rotation will rotate in ridiculous directions:

I want to create this kind of behavior with Geometry Node:

You'll need to provide more details. "Causes a glitch when I apply a rotation" is not clear. "while also referencing rotation" is not clear. While you're editing your question to precisely describe your problem, your question, and the solution you're looking for, please also edit the title of your question to concisely describe your actual question (not be a general topic).

How about this? Let me know if you still have trouble understanding the question

That's much better details. I've edited the question formatting so the images are shown inline and changed my downvote to an upvote. Hopefully you will now be able to get help from the true experts.

Thanks! I didn't know it could be displayed inline!


text:
Shortcut for Cursor to Selection not working in Object Mode
ShiftS + Pie Menu is working as expected. In Object Mode the 3D Cursor jumps to an object's Origin. In Edit Mode it jumps to the selected geometry.
The custom keyboard shortcut I assigned however, is only working in Edit Mode. In Object Mode it does not jump to the selected objects. What might cause this?

I've assigned the shortcut in the 3D View > 3D View (Global) section. This made it work... for Edit Mode only.
I've also tried placing it in:

Object Mode (Global)
3D View (Generic)
Object Non-modal

No luck getting the shortcut to work in Object Mode. It's strange because the Console shows the same command I've typed (beginning after bpy.ops.): view3d.snap_cursor_to_selected

(I'm using version 2.9 now, and had this shortcut working in 2.79)

An existing shortcut called Select Hierarchy at the Object Mode (Global) level was taking precedence over any key bindings I was setting at the 3D View (Global) level (and other levels/sections I had tried).
I resolved this by reassigning the Select Hierarchy shortcuts to other modifier keys:

Why is there no warning for a dup assignment?!  These are not easy to find through inspection or any reasonable workflow.

@james_t Agreed. A dup warning would be a welcome feature.

feel free to upvote at right-click


text:
Is it possible to assign a keyboard shortcut for toggling a preference?
I would like to be able to toggle ToolTips on and off, however being that it's a value in Blender's Preferences I don't see anything register in the Console when I enable or disable it. This makes me think it may not be possible to assign a keyboard shortcut to it. Does anyone know if there's a way? Thanks.

As sambler points out, my answer is overkill for your purposes. However the general question deserves an answer too: How to assign a toggle shortcut to a preference.
Make a new keyboard shortcut or re-appropriate a shortcut you don't use.
UserPreferences -> Input -> Window

If you add a wm.context_toggle and hit enter you'll get another field called "Context Attributes". It might appear that you can't type into that field but you can. Paste into it:
user_preferences.view.show_tooltips
# or
user_preferences.view.show_tooltips_python

depending on what you need.

Thank you both for the very helpful answers! @zeffi I'm marking yours as the accepted answer because it is most relevant to the question title and therefor most likely to be helpful to others viewing. Also, I may use the method to toggle some other preference in the future. As for quickly viewing a ToolTip, I will use sambler's shortcut.

For the specific case you mention you don't need to add a shortcut as a temporary show tooltips feature already exists.
In the preferences disable tooltips. When you want to see a tooltip hold down ⎇ Alt and move your mouse over the item and you will see the tooltip.


text:
What is this ghost plane that appears with Multi-View Stereoscopy?
I just set up a rig of six cameras, and for some reason, after enabling Stereoscopy > Multi-View a plane appears that seems to be some sort of a guide, but the reason for its positioning is not clear.

Selecting different cameras in the Viewport doesn't make it change. Neither does selecting different cameras in the Stereoscopy list.

I would prefer not to have to tolerate this awkward plane off to right side of my cam rig (the active camera in the screenshot is the "Forward" cam). So if anyone knows why the plane is there or how to change its positioning/appearance, please share.
Other observations: Disabling Stereoscopy makes the ghost plane disappear. Switching the Stereoscopy mode to Stereo 3D puts it in front of my "Forward" cam (which is a better position, but since I need to use Multi-View this is not a solution - besides, I wouldn't mind the plane disappearing altogether).
Blender version: 2.9.0

That is your convergence plane, e.g. where the L/R cameras converge. You can turn it off in the N menu under View->Stereoscopy->Plane

Thank you for demystifying! Seeing as my cameras all face away from a central point and their fields of view don't overlap, I'll definitely be turning that off.  :-)


text:
Attempting to layer two materials on the same parts of a mesh
I have two textures ready to apply on a mesh of a space ship.  One is the texture of the hull of the space ship itself, the other is the lighting coming from the ship's windows as well as other light sources on the ship.
I need to have the first texture emit no light and be affected by external light sources, while the second emits light.  Is there a way that I can have these two textures with these two different behaviors in the Cycles Render engine?  I've posted examples of the two textures below.

Dont know if this is what your asking. But you can try this, https://blender.stackexchange.com/questions/77071/do-i-need-to-separate-an-object-in-order-to-give-it-different-materials-and-text/77072#77072 Just select the faces you want to have the light and apply emission shader to it.

I gave that a try, and got the top of the ship to go bright white, completely obscuring the textures altogether, which might be a step in the right direction.  If it helps, I posted screenshots of the textures in question above, so it might be more obvious what I mean.
The one that's mostly black needs to be emitting light, whereas the other one needs to be affected by that light source and others.

You can use the following steps :

create two UV maps in the vertex panel

create a material for all faces of the hull like this :

A diffuse BSDF (for the hull details) and a Emission BSDF (for the windows ligght) are added together (using a Mix BSDF should be better). The strength of the emission BSDF is increased to 10. The diffuse BSDF is connected with the hull details image which is connected to the UV map of the hull. The Emission BSDF is connected with the windows light image which is connected to the UV map of the window.

Unwrap the hull on the hull image like this (note that windows are painted with black)

Unwrap the windows on a white part of the windows light image. Then unwrap all other faces on a black part (they are all stacked in the orange square at the bottom)

The size of the windows light can be very small (256px x 256px) because it contains only white and black surfaces.
Here is a final render :

If you add an object near the window, you will see that it will be lighted by the window light.


text:
Cant Texture Paint one part of the model
I made the mesh and now that I've finished it I wanted to paint it, but somehow it won't let me paint one of the hands, and I don't know what to do. Any solutions?
EDIT: I realised that it might be because that hand was a copy of the other one,
 although I'm not really sure because the shoes are also a copy and I can paint them perfectly. (I got into this conclussion because I tried to copy the entire left arm and put it instead of the actual right arm and then all the arm, including the hand went white).

Select the hand in Edit Mode and press Ctrl+N to recalculate normals and then try to paint.

Still not working :(

Ok I found out what was it, so I'll leave it here for anyone that has the same problem. It seems that if you want to copy an item, you have to go to the manu and duplicate it, you CAN'T do CTROL+C and CTRL+V (Maybe this is basic, but all the knowledege I've got are 3 YouTube videos xd). Hope it helps someone.

Mark the solution as an answer so that it doesn't appear as needing a solution still.

apply first the mirror before texture painting??


text:
How to add header and space choice combobox to a custom made space?
I followed the tutorial for making a custom space in C code, from the tutorial in this question Creating own editor type.
I succeeded but it seems that it has no header and no combo box with the list of other spaces. If I try to run template scripts to create panels and switch the bl_space_type to the name of my editor the script runs with no errors but the controls don't show up.
So I am interested in how to insert header, combo box and generally make it work like other spaces with the Python API.
A python based solution is preferable but, at this point, I would welcome any.

While there is some discussion to allow blender development questions, the C/C++ development of blender is still considered off topic here.

Okay, I will be sure to remember that, hopefully, I can achieve everything I want to, without editing more C/C++ code.

I am not sure how much of this is necessary but I did some intuitive edits on the code and it works, if anyone can explain exactly why I would be most grateful.
Go to the /home/user/blender-git/build_linux/bin/2.79/scripts/startup/bl_ui(respective to your system) folder where all the other editor *.py startup files are copy space_info.py, rename it to space_yourspace.py.
In the same folder find the __init__.py open it and add space_yourspace to the constant _modules, this will make blender run said module on startup, so be sure to edit the file before starting it up.
Now open up space_yourspace.py and delete everything from         INFO_MT_editor_menus.draw_collapsible(context, layout) down to, but not including classes = (.
Now in the classes tuple delete everything except INFO_HT_header, be sure to leave one comma after INFO_HT_header so it remains a tuple and not just a pair of parenthesis. Rename INFO_HT_header to YOURSPACE_OT_header in the tuple.
Go back to the remaining class and rename it also to YOURSPACE_OT_header.Inside the class change the value of static variable bl_space_type to 'YOURSPACE_EDITOR'.
After this, you can start Blender and in the header of yourspace you will have the said combo box.

While the main area of an editor is implemented in C/C++, all of the UI widgets are controlled using python. The bl_ui/space_yourspace.py is the file blender finds to use for a yourspace editor, without it there are no regions displayed around the editor. Similar naming conventions are used to find the code to use - YOURSPACE_HT_header for the header, while bl_space_type needs to be set for panels that belong to that editor, this is the same as setting it for any custom panels you add to existing editors.


text:
Two materials on one object
I'm trying to do something simple and I know there are a few tutorials on how to do this but the steps set out don't seem to work for me.  What i want to achieve is a tile with an asphalt image texture on one side and a grass texture on the other.
The video shows the problem i'm having https://vimeo.com/239592554 although the resolution is not that great.
My workflow is:

select object and enter edit mode
select required face
type 'U' and unwrap face
create new material
select 'image texture'
find asphalt image and select
assign material
turn the object over and select opposite face
repeat steps 2 to 7 using the image of grass

The problem i have is that the grass then appears on both faces.  I can't see what i'm doing wrong but hopefully you can.  I'm using Cycles.
Many thanks in advance.
Stephen
Following helpful responses, I've tried with a fresh instance of Blender and a 'straight out of the box' mesh cube.  Then tried to add basic BSDF materials to separate faces but every time the material gets applied to the whole cube not just the selected face.
Could it be something to do with my Blender set up/user preferences?  I can't think what.  Anyway, gif of the new test included below:

i think u trying on the normal plane not on the cube with low height as shown in the video

Hi Atek and thank you for coming back to me. Not sure i understand your comment though, could you elaborate for me?  Appreciate your help.

can u plz show me screenshot what material or texture and how ur using it on what mesh

Hi Atek, see my gif and comments above.

If i understood with the gif file you have send. 2 Material on single cube
Click on the material and it will add the material to complete cube. Name it as 1
Add new material with the + sign in the material. Name it as 2

Go to edit mode and select the face you want to add the new material or material 2 and click on assign.

And change the view port color also same red and green below or u can drag the color on the view port color.

Thanks Atek, but how do i drop .jpg images into the viewport colour box?  So far the only way i can make it work is to use two planes, allocate a separate material/texture to each and then make them part of a single object in 'object' mode, then joining vertices to make new faces.  Very cumbersome and leaves the edges with strange colouring.

No the viewport is for color not for image. I have show the material u can add material also same way. Just to assume u can fix the viewport color for example green for grass

Stephen, at the right of the color, you press the "point" button, and you can select "image texture" instead of a pure colour. Or, if ou wish, after following Atek's tut, you change to node view, and work from there, inserting your images.

Thanks MCunha, I am familiar with both the selection of image textures and the use of material nodes.  My problem is, none of it seems to work!!  I've even tried opening a new instance of Blender and working on an unedited cube but it will not accept material textures (.jpg images) on anything other than all faces.  I'm completely baffled but appreciate the help/ideas you guys are coming up with.

You can perform a "double side material" node setup with the geometry node (selecting the backfacing option). The following image presents half a cube where the exterior is grass and the interior is gravel. The backfacing option uses the same UVmap but shows the texture for the other side of the faces, so from your steps, you can ignore step 8 and step 9. The same technique is used to create double sided pages, in a book or similar.

you can even try using different UVmaps, if you don't plan to use the other side of the faces, but put different textures on different faces. Consider the following tutorial on managing different UVmaps: https://www.youtube.com/watch?v=MqmXqgbzIxg

Thanks MCunha for coming back so promptly but sadly none of this works for me.  I've tried everything from recreating the tile to deleting all materials, textures, UV maps and starting all over again, but I still get the same image on both sides.  Your node map was helpful as was the tutorial but I can't see what is causing the problem.

LIke most people, UV maps are a bit of mystery to me, especially as the names at the bottom of the image editor don't seem to be synced with those in the mesh properties panel - they both get assigned independently, and neither seems to have anything to do with materials when they are assigned.  It just seems to be a whole bunch of separate data that doesn't interact in any way.  Am baffled but appreciative!!

MCunha - I've realised the node tree you put together applies materials/textures to opposite sides of a plane, not a solid object.  Useful to know but it doesn't create the tile object i'm looking for.  Appreciate your help though.

Many thanks to Atek and MCunha for their efforts in trying to sort out my problem, it is very much appreciated.
I solved the problem eventually after much searching and hair tearing - because my tile was a modified version of a previous shape, there was some duplicate geometry in there that was invisible. 'Remove doubles' eventually tidied it up and the materials worked as required.  A great relief.  Will now get on with what i was trying to do in the first place!!


text:
Knife tool not appearing in toolbar
I'm new to Blender.
I'm trying to cut a cylinder in half vertically but I don't see the knife tool in the toolbar.
I see what follows:

Switch to Edit Mode.

I'm already in edit mode

https://docs.blender.org for the manual. It’s got decent chapters :-) TYJ.

I ask because I've already searched for it and I have time contrain. Could you please help me?

I guess you have a surface object because its name. Knife tool only for mesh objects.

Solved, thank you!

@DavideModesto Hello and welcome. Please don't turn your questions into guessing games, provide factual info we can use to diagnose the issue. A severely cropped screenshot that doesn't show the UI or the object is not much to go by. We aim to be a a high quality database of answers that are above all expected to help future visitors, rather than provide assistance on time constraints.


text:
Follow Path object constraint not putting object's origin along the path
So I just rigged my car model and wanted to do the follow path constraint. I created a curve that has a shrink wrap modifier and constraint to follow the terrain. When I put a constraint on my car to follow the path, it seems to be floating above the curve/ where the surface is... does anyone know what I did wrong or if there's a fix to this?

Try zeroing the parent object's position to get rid of that offset:

+1 I've found the best rule of thumb is to make sure that, no matter what the scenario, both the object origin and the curve origin are in the same place. That will remove all possibility of weird issues cropping up.

The great thing about this is that if you want, you can use simple Transform adjustments (or animations!) on the object itself to offset/rotate/etc. along the path; you don't have to bake them into the mesh geometry.


text:
How to use new Capture Attribute node
Capture Attribute node in Blender 4.2LTS not looking the same as in Blender 3.3LTS and I am having no idea how to use this new Capture Attribute node.

The new Capture Attribute allows you to capture several attributes with a single node. Other than the Store Named Attribute where it makes sense to allow only a single source as input since you cannot store several attributes under a single name, it was always a bit uncomfortable having to use for example 4 Capture Attribute nodes just to capture 4 attributes on a single source geometry.
The new node has optional sockets and you do not have to switch the type manually, it adjusts automatically to whatever source you plug in, may it be float, vector, integer or whatever. After plugging something in the optional input, another optional input appears.
Sorry for my following bad example, this does not really make much sense to use a Capture Attribute node here but I guess it shows what the adavantage of the new one versus the old one is.
Here I am capturing 5 attributes on the geometry with the new node:

And here I am capturing the exact same 5 attributes with the old node:

I think a simple and practical example would be to use a capture attribute, capturing multiple outputs of a Raycast node, followed by multiple "Store Named Attribute" nodes. This makes sense because the attributes can be used elsewhere and showcases the performance improvement, because the raycast is done only once.

@MarkusvonBroady Well, my goal was mainly to show the difference between how the old node worked compared to the new one since the OP stated in the question having "no idea" how to use the new node. So I think my answer was already far too long. How the new node is an improvement or how to use it best goes a lot into answering opinion-based, so I would rather remove it from my answer instead of adding more examples. But feel free to add as many practical examples as you like.


text:
Model looks dented but geometry is correct
I'm wondering why my model has weird artifacts. I already tried removing overlapping vertices, and recalculating normals. I've attached the blender file to the post

In Mesh section of Properties window in Geometry Data section, click on Clear Custom Split Normals Data:

Thank you so much!

You have bad split normals on some of your vertices:

You need to fix your normals. Easiest is to clear the splits, using:
Properties > Object Properties > Geometry Data > Clear Custom Split Normals Data

Once you do that:

Thank you so much!

Love it.  Same information as the currently accepted answer...but also explains what's going on with explanations and visuals.  Thank you.


text:
Performing bevel operation using BMesh API
I'm trying to perform a bevel operation using the bmesh API. My script either crashes Blender, with the error message EXCEPTION_ACCESS_VIOLATION, or it doesn't do anything, with the 'new' geometry being {'face':[]}. To make it crash I pass the edges to the geom argument, pass it the verts causes nothing to happen. Has anyone managed to use bevel successfully before?
import bpy
import bmesh
from math      import *
from mathutils import *

AXES = {'X' : Vector((1,0,0)),
        'Y' : Vector((0,1,0)),
        'Z' : Vector((0,0,1))}

def selectPlane(bm, normal = 'z', location = Vector((0,0,0)), feature = 'verts', tolerance = 0.1) : # bpy.context.active_object.location
    normal = normal if isinstance(normal, Vector) else AXES[normal.upper()]
    if isinstance(feature, list) :
       return {key : planeSelect(bm, normal, feature, location, tolerance) for key in feature}
    else :
       return {'verts' : [vert for vert in bm.verts if abs(vert.co.__sub__(location).dot(normal)) < tolerance],
               'edges' : [],
               'faces' : []}[feature]

def selectCylinder(bm, radius = 1, normal = 'z', feature = 'verts', location = Vector((0,0,0)), tolerance = 0.1) :
    normal = normal if isinstance(normal, Vector) else AXES[normal.upper()]
    projxn = lambda vector : vector - vector.project(normal)
    if isinstance(feature, list) :
       return {key : selectCylinder(bm, radius, feature, location, tolerance) for key in feature}
    else :
       return {'verts' : [vert for vert in bm.verts if abs(projxn(vert.co.__sub__(location)).length - radius) < tolerance],
               'edges' : [edge for edge in bm.edges if all([abs(projxn(vert.co.__sub__(location)).length - radius) < tolerance for vert in edge.verts])],
               'faces' : []}[feature]

me = bpy.data.meshes.new("Temp")
ob = bpy.data.objects.new("Temp", me)
bm = bmesh.new()
diameter = 20
length   = 20
matrix   = Matrix.Identity(4)
ge = bmesh.ops.create_cone(bm, cap_ends  = True,
                               cap_tris  = True,
                               segments  = 12,
                               diameter1 = diameter,
                               diameter2 = diameter,
                               depth     = length,
                               matrix    = matrix)
go = selectCylinder(bm, radius = diameter, feature = 'edges')
ug = selectPlane(bm, location = Vector((0, 0,  length/2)))
lg = selectPlane(bm, location = Vector((0, 0, -length/2)))
es = [edge for edge in go if all([vert in ug for vert in edge.verts])]
vs = list(set([vert for edge in es for vert in edge.verts]))
print('#'*5)
print(go)
print(es)
ge = bmesh.ops.bevel(bm, geom   = vs, # list(set([vert for edge in es for vert in edge.verts])),
                         offset = 2)
print('>'*5)
print(ge)
bm.to_mesh(me)
bm.free()
me.update()
bpy.context.scene.objects.link(ob)

The selectCylinder and selectPlane methods are there to select the appropriate vertices and edges, but for the rest it's just bmesh operations.

The geom parameter must be a list of edges and their verts, see:
Beveling edges with varying number of segments (preferably programatically)


text:
How to know if the system console is open?
Can we know, with python, if the system console of blender is open? I know that we can open or close it with this function:
bpy.ops.wm.console_toggle()

But it doesn't return the 'state' of the system console like open or closed (True,False).
I want to be sure that the console is open when i execute one of my script.

This function doesn't accept any parameters and return just a {'FINISHED'}. It just open the console if it's close and vice versa.

You can on Windows ; On Windows, it's possible to check using python code, even if the blender console window has been toggled visible or not. See my answer here (linked to not duplicate answers in many places): https://blender.stackexchange.com/a/291507/24534

Short Answer: You cannot
First, bpy.ops.wm.console_toggle() is available only on Windows. And I admit, it is a work around. Other OSs run without a console. If you want a console, you must start blender from a terminal on Linux and Mac.
The I/O steam redirect blender.exe > out.txt should work. (but I haven't test it)
If you realy want to communicate with user, you should use a dialog box:
http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Cookbook/Code_snippets/Interface
error message or save it in a log file. Those methods should work on any system.
P.S.
On C code side, the function returns the current status, and you can query the status.

I can confirm streaming blender in linux works.

You can on Windows ; On Windows, it's possible to check using python code, whether the blender console window is already visible or not.
That Blender's console window being most probably the only window of the console class (ConsoleWindowClass) with the name ""
(see bellow to install win32gui)
def show_blender_system_console():
    import win32gui

    def enum_windows_callback(hwnd, results):
        class_name = win32gui.GetClassName(hwnd)
        if class_name == "ConsoleWindowClass":
            results.append((hwnd, win32gui.GetWindowText(hwnd)))

    windows = []
    win32gui.EnumWindows(enum_windows_callback, windows)

    for hwnd, title in windows:
        if title=="":
            break

    print(f"The Blender console window is {hwnd}")

    # Check if the window is visible or hidden
    is_visible = win32gui.IsWindowVisible(hwnd)

    if is_visible:
        print("The window is visible.")
        win32gui.SetForegroundWindow(hwnd)
    else:
        print("The window is hidden.")
        bpy.ops.wm.console_toggle()

win32gui is included in pywin32 ; to install a python package do in a cmd (win+R>cmd):
C:\[path to your blender app]\python\bin\python.exe -m pip install pywin32

e.g. (Change the path accordingly to your version):
C:\Program Files\Blender Foundation\Blender 3.5\3.5\python\python.exe -m pip install pywin32

you might want to do ensure pip is installed and updated before:
C:\[path to your blender app]\python\bin\python.exe -m ensurepip
C:\[path to your blender app]\python\bin\python.exe -m pip  install --upgrade pip

This is a great starting point, though to my understanding it gives you first open console window. Could be a console not related to Blender, or could be a console of another Blender instance. You could send something to the console and find the console with that message in it (I don't know how hard it would be to read it from a console), or you could somehow check for ownership (again, not proficient with winapi, but maybe can be done)

So far my blender console is the only one with "" as a title ;  As it's (on my side) only for debugging reasons and not to be deployed. If another console window with no title was to be used, you could also try to select the blender console considering it's size or the fact the top right close cross is greyed

import bpy
from bpy.app.handlers import persistent

bl_info = {
  "name": "Startup",
  "author": "",
  "version": (1, 2, 4),
  "blender": (3, 6, 0),
  "location": "",
  "description": "startup scripts",
  "warning": "",
  "doc_url": "",
  "category": "startup",
  "addon_id": "startup"
}

console_opened = False
def ensure_console():
  global console_opened
  if console_opened: return
  bpy.ops.wm.console_toggle()
  console_opened = True

@persistent
def load_handler(a, b):
  ensure_console()

def register():
  bpy.app.handlers.load_post.append(load_handler)

if __name__ == "__main__":
  register()

This will execute the console open just once.
So no need for external stuff.


text:
Add a filter for the extension of a file in the file browser
I'm writing a python script that allow us to open a file in it like that:

It's a string properties wich is coded like that :
bpy.props.StringProperty(description="Path of .DAT File", default="C:", subtype='FILE_PATH')

When the user click on the little folder on right it open a file browser.
In the file browser, in my case I want to filter only the .DAT files. I know that it's possible to filter the extension of file for exemple here it filter the .py or .zip file:

How can I do that with Python ?

Unfortunately this isnt documented, however it is used in the templates that come with blender, see Text -> Templates -> Python -> Operator File Export, there is a filter_glob string property.
eg:
filter_glob = StringProperty(
        default="*.txt;*;*.py",
        options={'HIDDEN'},
        )

Mmmmh if I understand correctly, this cannot be implemented with only my bpy.props.StringProperty(description="Path of .DAT File", default="C:", subtype='FILE_PATH'), if I want to put a filter I've to do an importer class?

You would need to define an importer that will translate the data into blender objects. Your folder icon doesn't have to initiate the file import. You may be able to break it into parts, so that choosing the file only sets properties instead of actually reading the data and creating new objects, which could be done at a later stage.

Is there a shorthand to filter types of files? E.G. Set FileSelectParams.use_filter_image?

I wrote class following above answer:
Instead of register:
bpy.types.Scene.my_unfiltered_filepath =
                bpy.props.StringProperty(name = 'Unfiltered',
                                         description="Path of .* File",
                                         default="//",
                                         subtype='FILE_PATH')

and in draw method:
col.prop(context.scene, 'my_unfiltered_filepath')

use in draw method:
FilteredFiledialog.add(col, context.scene, 'my_filtered_filepath', 'txt', 'py')

one or more extensions can be used, this filters txt and python files.
And register:
bpy.types.Scene.my_filtered_filepath =
                bpy.props.StringProperty(name = 'Filtered',
                                         description="Path of .txt and .py File",
                                         default="//",
                                         subtype='NONE') # important

from bpy_extras.io_utils import ImportHelper

class FilteredFiledialog(bpy.types.Operator, ImportHelper):
    bl_idname = "pathload.test"
    bl_label = ''
    filename_ext = ''
    filter_glob = bpy.props.StringProperty(
        default="",
        options={'HIDDEN'},
        maxlen=255  # Max internal buffer length, longer would be clamped.
    )

    def execute(self, context):
        setattr(self.string_prop_namespace, self.string_prop_name, bpy.path.relpath(self.filepath))
        return {'FINISHED'}

    def invoke(self, context, event):
        self.filter_glob = "*" + ";*".join(self.ext)
        return super().invoke(context, event)

    @classmethod
    def add(cls, layout, string_prop_namespace, string_prop_name, *ext):
        cls.ext = ext
        cls.string_prop_namespace = string_prop_namespace
        cls.string_prop_name = string_prop_name
        col = layout.split(.33)
        col.label(string_prop_namespace.bl_rna.properties[string_prop_name].name)
        row = col.row(align=True)
        if string_prop_namespace.bl_rna.properties[string_prop_name].subtype != 'NONE':
            row.label("ERROR: Change subtype of {} property to 'NONE'".format(string_prop_name), icon='ERROR')
        else:
            row.prop(string_prop_namespace, string_prop_name, icon_only=True)
            row.operator(cls.bl_idname, icon='FILESEL')

File dialog looks identical.


text:
Custom properties possible for individual path points?
I am working on a small script that turns Blender into a kind of level editor and can import and export Bezier paths from CSV information into Blender. However, these CSVs contain custom properties for the curve object and for each of the individual points.
Curve objects can contain custom properties in Blender, but this does not seem to be possible for the individual points of the paths. Blender stores some values per point, but only 3, namely the Tilt, Radius and Weight values. But I would need 8 integer values for each point.
Therefore I ask if there is another way to give path points custom properties? Possibly via a plugin?


text:
Adding bloom in Blender 4.2
In previous versions of Blender, there was an option in the output properties to enable bloom. It seems that this was removed when it was updated to 4.2. Is there another way to allow bloom in Blender version 4.2? Perhaps in the texture system?

You need to use the Glare filter node in the Compositing setup, and choose the Bloom or Fog Glare option at the top:

Here's a detailed walkthrough, first hit on Google for "Bloom Blender 4.2":
https://www.youtube.com/watch?v=bqmmKpeQ_rw

Alternatively, there's a (currently) $3 extension named "Add Bloom Add-on" that adds an Add Bloom section to the render properties:
https://blendermarket.com/products/add-bloom-back