3
$\begingroup$

Blender Loading Cursor with Digits

Blender has a special cursor when you run an operation that taxes the system. I always thought it was a progress counter, but the numbers do not add up.

Can anybody tell me, what those numbers in the rectangle are displaying?

Blender 2.79 Loading Cursor while Loading an OBJ File

In this example, I simply loaded in an OBJ. I would expect the numbers to go up to 100, but for some reason, they do not.

$\endgroup$
  • $\begingroup$ The last huge file I loaded in made the upper and lower line go up to 66 and then it was done. Based on that, it does not look like a loading bar to me. $\endgroup$ – Ben Nov 27 '18 at 19:07
  • $\begingroup$ Those two lines move independently, by which I mean the top and bottom number seem not connected. It is a conundrum. $\endgroup$ – Ben Nov 28 '18 at 8:50
  • 2
    $\begingroup$ I don't think I'll be able to help you with this, but to increase your chances of getting an answer, I would suggest adding to your question: (1) the version of blender and your operating system, (2) an example of operation that triggers the "progress" status of the pointer, so that people can see what you're seeing $\endgroup$ – Nicola Sap Nov 28 '18 at 9:02
  • 1
    $\begingroup$ Good call, I'll try to get some footage. $\endgroup$ – Ben Nov 28 '18 at 9:48
2
$\begingroup$

In short

You are reading: «33.33 percent, 66.66 percent, done», or more literally «3333 per ten thousand (‱), etc». These percentages don't necessarily correspond to a "fraction of the evaluation time", but more likely to a "fraction of the total number of steps", in this case: 3.

In detail

The cursor displays the current progress, mapped to the range 0 to 9999. It is called, for instance, in $SOURCE/blender/makesrna/intern/rna_wm_api.c like this:

static void rna_progress_update(struct wmWindowManager *wm, float value)
{
  if (wm_progress_state.is_valid) {
    /* Map to cursor_time range [0,9999] */
    wmWindow *win = wm->winactive;
    if (win) {
              int val = (int)(10000 * (value - wm_progress_state.min) / (wm_progress_state.max - wm_progress_state.min));
              WM_cursor_time(win, val);
    }
  }
}

where a given "value" is compared to a "min" and a "max" and expressed as "val" in terms of a fraction of 10,000 of the (min, max) interval. The function WM_cursor_time from $SOURCE/blender/windowmanager/intern/wm_cursors.c takes care of "visualising" the cursor.

Of course script creators can pass to the cursor number mapped to 1-100, or 1-1000 if they want: "WM_cursor_time" doesn't check that the number is a fraction of 10000. So it really depends on context here!

In your case, probably the process of loading an OBJ has three checkpoints, that were hard-assigned to 1/3, 2/3 and 3/3 and don't necessarily correspond linearly to their evaluation time. These fractions, mapped to 10000, with the decimal part ignored ("floor" rounding) are 3333, 6666 and 10000.

I speculate that what you are seeing are just the first two of these numbers while "10000" (999) is skipped because it's probably overridden by the next event.

$\endgroup$
  • $\begingroup$ Thank you so much, I was going bonkers not knowing! For further reference, can you point me to some kind of documentation where I can read up on the name of the inner gears of Blender? I feel that might come in handy in the future! $\endgroup$ – Ben Nov 28 '18 at 13:16
  • $\begingroup$ I might not be the best person to point you in that direction: I don't know if there are manuals for the source code of blender, and I myself have just a limited knowledge of what's inside. There is an intermediate level though, used for scripting applications and add-ons that work with blender, that is the Blender Python API. That one is well documented on the blender website. $\endgroup$ – Nicola Sap Nov 28 '18 at 13:40
2
$\begingroup$

Show progress with cursor.

As outlined in this answer the progress of a script can be displayed using the cursor.

Set the start number with WindowManager.progress_begin(min, max) update with wm.progress_update(i) and finish with wm.progress_end()

Code from link

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()

As pointed out via code in @NicolaSap's Answer the 4 digit number displayed will range from 0 to 9999 .. or think of a as a 0 to 99.99% (the 1438 in q image would be 14.38% based on how many lines in file or s....(consult addon code).. ) progress or as a fraction of 1 [0, 0.9999] where 1 is complete.

The code above will start at 0, step up by 10, 1000 times.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.