Page MenuHome

PythonProject
ActivePublic

Members

  • This project does not have any members.

Watchers (10)

Details

Description

Python API for scripting and console editor.

Module Owner: @Campbell Barton (campbellbarton)

Recent Activity

Today

Mikhail Rachinskiy (alm) added a comment to T60643: BMesh poke operator does not work.

Running bpy.ops.mesh.poke() in the Python console works in 2.8.

Hi William, this report is not about mesh operator, it is about bmesh operator. Hence bmesh.ops not bpy.ops.

Sat, Jan 19, 2:46 PM · Python, Mesh Modeling, BF Blender
William Reynish (billreynish) updated subscribers of T60643: BMesh poke operator does not work.

The Python API has changed between 2.7x and 2.8.

Sat, Jan 19, 2:31 PM · Python, Mesh Modeling, BF Blender
Mikhail Rachinskiy (alm) created T60643: BMesh poke operator does not work.
Sat, Jan 19, 8:16 AM · Python, Mesh Modeling, BF Blender

Yesterday

Matthias (jayanam) added a comment to T59113: Addon's keymaps are not registered at Blender opening if the addon's enable state is saved in user preferences.

I have the same issue, the keymaps are not persisted.

Fri, Jan 18, 10:20 PM · Python, BF Blender

Tue, Jan 15

Bastien Montagne (mont29) closed T60083: Particle HairKey[x].co gives always zero Vectors as Archived.

Yes, totally agree with @Sergey Sharybin (sergey) here. We do have a few helpers (like for raycast) where is sort of make sense to implicitly get the evaluated data from context's depsgraph, but think this should remain an exception (and a documented one).

Tue, Jan 15, 4:49 PM · Python
Philipp Oeser (lichtwerk) added a comment to T60083: Particle HairKey[x].co gives always zero Vectors.

@Brecht Van Lommel (brecht), @Bastien Montagne (mont29): If this (what @Sergey Sharybin (sergey) mentioned) is the consensus, then this report can be closed?

Tue, Jan 15, 1:42 PM · Python

Fri, Jan 11

Jonathan Dent (jdent02) closed T60382: Issues with custom node registration (annotation issue) as Invalid.

User error, not a bug.

Fri, Jan 11, 1:40 PM · Nodes, Python, Addons

Thu, Jan 10

Jonathan Dent (jdent02) closed T60384: Error with custom nodes and node editor as Invalid.

Good Lord that's embarrassing, must've been doing stuff too late into the evening.

Thu, Jan 10, 1:49 PM · Nodes, Python, Addons
Jonathan Dent (jdent02) added a comment to T60382: Issues with custom node registration (annotation issue).

No, it appears I misread the warnings by thinking they were status messages instead. The properties in question are dynamically created during module registration using setattr, apparently that no longer works? Is there an alternative?

Thu, Jan 10, 1:11 PM · Nodes, Python, Addons
Jacques Lucke (JacquesLucke) added a comment to T60384: Error with custom nodes and node editor.

Besides that it would be helpful when you try to remove everything from the file that is not necessary to reproduce the bug.
Also currently the script you provided does not run on its own, which makes it hard to reproduce the issue.

Thu, Jan 10, 10:36 AM · Nodes, Python, Addons
Philipp Oeser (lichtwerk) added a comment to T60384: Error with custom nodes and node editor.

Havent look in depth, but the AppleseedOSLNode polls for AppleseedNodeTree whereas the nodetree itself is called AppleseedOSLNodeTree, could this be the cause?

Thu, Jan 10, 10:14 AM · Nodes, Python, Addons
Philipp Oeser (lichtwerk) added projects to T60384: Error with custom nodes and node editor: Addons, Python, Nodes.
Thu, Jan 10, 10:00 AM · Nodes, Python, Addons
Philipp Oeser (lichtwerk) added projects to T60382: Issues with custom node registration (annotation issue): Addons, Python, Nodes.

Afaics the ...contains a properties which should be an annotation warning is printed as a summary for all the other make annotation: ... warnings.
So you get this once and then all the specific ones for each property.

Thu, Jan 10, 10:00 AM · Nodes, Python, Addons
Campbell Barton (campbellbarton) abandoned D4172: Fix bugs in anim_utils.py.

Thanks! committed rBa44ac44c1e1d1a4eff5824711e7763d9feae122b

Thu, Jan 10, 3:20 AM · Python

Tue, Jan 8

Sergey Sharybin (sergey) added a comment to T60083: Particle HairKey[x].co gives always zero Vectors.

From predictability point of view using an explicit evaluation object from a script will be preferable solution: this eliminates possibility of system silently switching to an object instance which you don't intent to. Points are:

  • Access to any ID field should be following one rule (as in, it shouldn't be reading some fields from given ID and other fields from an evaluated ID).
  • Scripts need to be able to read write fields which are considered inputs for evaluation.

So from this point of view i am in favor of leaving it up to script to decide what ID to access.

Tue, Jan 8, 11:09 PM · Python
Jose Conseco (joseconseco) added a comment to T60083: Particle HairKey[x].co gives always zero Vectors.

Thanks Philipp, depsgrapth thing work ok. It would be nice to have it working the old way, without the depsgrapth, unless it would be problem for performance.

Tue, Jan 8, 9:37 PM · Python

Sat, Jan 5

Ryan (rcorre) created D4172: Fix bugs in anim_utils.py.
Sat, Jan 5, 8:51 PM · Python
Paul Maréchal (wkk.py) added a comment to T60175: Missing "Python.h" when building Python extensions.

Sorry, I didn't know where to post this issue (that is not a bug).

Sat, Jan 5, 7:28 PM · Python, BF Blender
Stephen Swaney (stiv) closed T60175: Missing "Python.h" when building Python extensions as Archived.

Typically, to compile a package named 'foo' in Linux, you need to install the necessary foo-dev or foo-devel to get the header files.

Sat, Jan 5, 2:42 AM · Python, BF Blender
Paul Maréchal (wkk.py) added a comment to T60175: Missing "Python.h" when building Python extensions.

My original goal was to install pythonnet, but it is a deep pain to get to the point where files are missing. dependency-injector is the easiest one to reproduce the issue.

Sat, Jan 5, 2:21 AM · Python, BF Blender
Paul Maréchal (wkk.py) created T60175: Missing "Python.h" when building Python extensions.
Sat, Jan 5, 2:19 AM · Python, BF Blender

Fri, Jan 4

Adam Dominec (emu) updated the task description for T60093: Cycles bake (bpy.ops.object.bake) unstable when using `uv_layer` parameter.
Fri, Jan 4, 9:47 AM · BF Blender, Python, Cycles
Adam Dominec (emu) updated the task description for T60093: Cycles bake (bpy.ops.object.bake) unstable when using `uv_layer` parameter.
Fri, Jan 4, 9:39 AM · BF Blender, Python, Cycles

Thu, Jan 3

Bastien Montagne (mont29) edited projects for T60093: Cycles bake (bpy.ops.object.bake) unstable when using `uv_layer` parameter, added: BF Blender; removed BF Blender: 2.8.
Thu, Jan 3, 4:01 PM · BF Blender, Python, Cycles
Adam Dominec (emu) edited projects for T60093: Cycles bake (bpy.ops.object.bake) unstable when using `uv_layer` parameter, added: BF Blender: 2.8; removed BF Blender.
Thu, Jan 3, 10:52 AM · BF Blender, Python, Cycles
Philipp Oeser (lichtwerk) updated subscribers of T60083: Particle HairKey[x].co gives always zero Vectors.

Well from first investigation, we would need a way to flag RNA_def_property_float_funcs to be able to use context [FUNC_USE_CONTEXT].
This is because rna_ParticleHairKey_location_object_get / rna_ParticleHairKey_location_object_info check ParticleSystemModifierData->mesh_final which we can only get/evaluate using a depsgraph...
Looks like this is not possible atm., (or needs further investigation...)

Thu, Jan 3, 10:31 AM · Python
Philipp Oeser (lichtwerk) claimed T60083: Particle HairKey[x].co gives always zero Vectors.

Confirmed, checking...

Thu, Jan 3, 9:38 AM · Python

Wed, Jan 2

Adam Dominec (emu) created T60093: Cycles bake (bpy.ops.object.bake) unstable when using `uv_layer` parameter.
Wed, Jan 2, 11:44 PM · BF Blender, Python, Cycles
Jose Conseco (joseconseco) created T60083: Particle HairKey[x].co gives always zero Vectors.
Wed, Jan 2, 8:25 PM · Python
Germano Cavalcante (mano-wii) closed T59773: Crash accessing python gpu module in background mode. as Resolved by committing rB945007b32e9a: Fix T59773: Raise exception if the gpu module is used in backgound mode..
Wed, Jan 2, 2:03 PM · Addons, OpenGL / Gfx, Python, BF Blender

Tue, Jan 1

Bastien Montagne (mont29) edited projects for T59896: Gizmos done via python block other gizmos already present in the scene, added: BF Blender; removed BF Blender: 2.8.
Tue, Jan 1, 3:58 PM · BF Blender, Python

Sat, Dec 29

Bastien Montagne (mont29) merged T59929: Blender 2.8 command line into T59773: Crash accessing python gpu module in background mode..
Sat, Dec 29, 3:30 PM · Addons, OpenGL / Gfx, Python, BF Blender

Fri, Dec 28

Michel Anders (varkenvarken) added a comment to T58734: bvhtree.fromObject - error ( returned NULL without setting an error) in blender 2.8.

great! works like a charm now :-) (tested on linux 64bit)

Fri, Dec 28, 9:21 AM · BF Blender, Python

Thu, Dec 27

William Reynish (billreynish) assigned T59896: Gizmos done via python block other gizmos already present in the scene to Campbell Barton (campbellbarton).
Thu, Dec 27, 6:56 PM · BF Blender, Python
Bastien Montagne (mont29) closed T58734: bvhtree.fromObject - error ( returned NULL without setting an error) in blender 2.8 as Resolved by committing rBb3e68a83f30f: Fix T58734: bvhtree.fromObject - error ( returned NULL without setting an….
Thu, Dec 27, 5:21 PM · BF Blender, Python
Bastien Montagne (mont29) claimed T58734: bvhtree.fromObject - error ( returned NULL without setting an error) in blender 2.8.

Issue is actually dead simple: C_BVHTree_FromObject() unconditionally frees its mesh, when bvh_get_mesh() actually may return direct data from evaluated object, not always creating its own mesh...

Thu, Dec 27, 5:19 PM · BF Blender, Python
Adrian Rutkowski (rrtk) created T59896: Gizmos done via python block other gizmos already present in the scene.
Thu, Dec 27, 2:35 PM · BF Blender, Python
Sebastian Parborg (zeddb) merged T59869: BVHTree.FromObject crashes with pthread priority assertion when called in quick succession on same object into T58734: bvhtree.fromObject - error ( returned NULL without setting an error) in blender 2.8.
Thu, Dec 27, 1:52 PM · BF Blender, Python
Sebastian Parborg (zeddb) merged T59889: Second call to BVHTree.FromObject with the same object results in a segmentation fault into T58734: bvhtree.fromObject - error ( returned NULL without setting an error) in blender 2.8.
Thu, Dec 27, 1:23 PM · BF Blender, Python

Wed, Dec 26

Bastien Montagne (mont29) added a comment to T59773: Crash accessing python gpu module in background mode..

@Jacques Lucke (JacquesLucke) Think most of the time they won't work in background mode, no, which would solve most of the crashes already. For cases where OGL context is used in background mode, indeed that patch sounds OK to me, and it's add-on responsibility to handle the issue properly. And no rush here, it can wait for you to get back from holidays! ;)

Wed, Dec 26, 10:54 PM · Addons, OpenGL / Gfx, Python, BF Blender
Bastien Montagne (mont29) merged task T59790: Object has no mesh data to be used for ray casting into T57861: Object.ray_cast (and all RNA functions using "ob->runtime") broken in Blender 2.80.
Wed, Dec 26, 5:32 PM · Python, BF Blender: 2.8, BF Blender
Michel Anders (varkenvarken) renamed T59790: Object has no mesh data to be used for ray casting from Objcet has no mesh data to be used for ray casting to Object has no mesh data to be used for ray casting.
Wed, Dec 26, 12:13 PM · Python, BF Blender: 2.8, BF Blender
Michel Anders (varkenvarken) added a comment to T59790: Object has no mesh data to be used for ray casting.

Can confirm this on Ubuntu 18.04 / GTX 1080

Wed, Dec 26, 12:12 PM · Python, BF Blender: 2.8, BF Blender

Tue, Dec 25

Germano Cavalcante (mano-wii) added a comment to T59773: Crash accessing python gpu module in background mode..

IMHO, first thing first, addons should not call those gpu functions at module level (...)

Tue, Dec 25, 3:41 PM · Addons, OpenGL / Gfx, Python, BF Blender
Jacques Lucke (JacquesLucke) added a comment to T59773: Crash accessing python gpu module in background mode..

I can fix the Object Scatter and Math Vis addon in that regard (maybe also the UV Export addon).
However, it might take me a couple of days because I'm on vacation and have to work on my Bachelor thesis..
Feel free to assign the addon updates to me.

Tue, Dec 25, 12:29 PM · Addons, OpenGL / Gfx, Python, BF Blender
Bastien Montagne (mont29) added a comment to T59773: Crash accessing python gpu module in background mode..

IMHO, first thing first, addons should not call those gpu functions at module level, that means they get called during first eval of the code (first import). This is bad practice in general, unless absolutely mandatory we avoid that kind of extra processing since it makes Blender loading slower.

Tue, Dec 25, 11:26 AM · Addons, OpenGL / Gfx, Python, BF Blender

Mon, Dec 24

Amir Shehata (amir.shehata) added a comment to T59773: Crash accessing python gpu module in background mode..

animation nodes addon also triggers this crash

Mon, Dec 24, 11:36 PM · Addons, OpenGL / Gfx, Python, BF Blender
Germano Cavalcante (mano-wii) added a comment to T59773: Crash accessing python gpu module in background mode..

I think it would be best if the addons chek out these errors themselves.
But for this, instead of crash it would be better to raise an error message:

1diff --git a/source/blender/gpu/GPU_init_exit.h b/source/blender/gpu/GPU_init_exit.h
2index e89c970b7d9..8f1a42c8795 100644
3--- a/source/blender/gpu/GPU_init_exit.h
4+++ b/source/blender/gpu/GPU_init_exit.h
5@@ -38,6 +38,7 @@ extern "C" {
6
7 void GPU_init(void);
8 void GPU_exit(void);
9+bool GPU_is_initialized(void);
10
11 #ifdef __cplusplus
12 }
13diff --git a/source/blender/gpu/intern/gpu_init_exit.c b/source/blender/gpu/intern/gpu_init_exit.c
14index 55d0466c929..d21acb188d9 100644
15--- a/source/blender/gpu/intern/gpu_init_exit.c
16+++ b/source/blender/gpu/intern/gpu_init_exit.c
17@@ -73,7 +73,6 @@ void GPU_init(void)
18 }
19
20
21-
22 void GPU_exit(void)
23 {
24 if (!G.background) {
25@@ -92,3 +91,9 @@ void GPU_exit(void)
26
27 initialized = false;
28 }
29+
30+
31+bool GPU_is_initialized(void)
32+{
33+ return initialized;
34+}
35diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c
36index 5f1ea7a33ce..25ffd768a07 100644
37--- a/source/blender/python/gpu/gpu_py_shader.c
38+++ b/source/blender/python/gpu/gpu_py_shader.c
39@@ -29,6 +29,7 @@
40
41 #include "BLI_utildefines.h"
42
43+#include "GPU_init_exit.h"
44 #include "GPU_shader.h"
45 #include "GPU_shader_interface.h"
46
47@@ -721,6 +722,11 @@ static PyObject *bpygpu_shader_from_builtin(PyObject *UNUSED(self), PyObject *ar
48 return NULL;
49 }
50
51+ if (!GPU_is_initialized()) {
52+ PyErr_SetString(PyExc_SystemError, "This function can not be called without a GPU context");
53+ return NULL;
54+ }
55+
56 GPUShader *shader = GPU_shader_get_builtin_shader(shader_id);
57
58 return BPyGPUShader_CreatePyObject(shader, true);
59diff --git a/source/blender/python/gpu/gpu_py_types.c b/source/blender/python/gpu/gpu_py_types.c
60index d9ef0736f8e..b767ee1b56c 100644
61--- a/source/blender/python/gpu/gpu_py_types.c
62+++ b/source/blender/python/gpu/gpu_py_types.c
63@@ -27,6 +27,10 @@
64
65 #include <Python.h>
66
67+#include "BLI_utildefines.h"
68+
69+#include "GPU_init_exit.h"
70+
71 #include "../generic/py_capi_utils.h"
72 #include "../generic/python_utildefines.h"
73
74@@ -43,12 +47,31 @@ static struct PyModuleDef BPyGPU_types_module_def = {
75 .m_name = "gpu.types",
76 };
77
78+static PyObject *bpygpu_type_new_error(
79+ PyTypeObject *UNUSED(type),
80+ PyObject *UNUSED(args),
81+ PyObject *UNUSED(kwds))
82+{
83+ PyErr_SetString(PyExc_SystemError, "This object can not be created without a GPU context");
84+ return NULL;
85+}
86+
87 PyObject *BPyInit_gpu_types(void)
88 {
89 PyObject *submodule;
90
91 submodule = PyModule_Create(&BPyGPU_types_module_def);
92
93+ if (!GPU_is_initialized()) {
94+ /* Warning: Only restarting Blender for it to work again. */
95+ BPyGPUVertFormat_Type.tp_new = bpygpu_type_new_error;
96+ BPyGPUVertBuf_Type.tp_new = bpygpu_type_new_error;
97+ BPyGPUIndexBuf_Type.tp_new = bpygpu_type_new_error;
98+ BPyGPUBatch_Type.tp_new = bpygpu_type_new_error;
99+ BPyGPUOffScreen_Type.tp_new = bpygpu_type_new_error;
100+ BPyGPUShader_Type.tp_new = bpygpu_type_new_error;
101+ }
102+
103 if (PyType_Ready(&BPyGPUVertFormat_Type) < 0)
104 return NULL;
105 if (PyType_Ready(&BPyGPUVertBuf_Type) < 0)

Mon, Dec 24, 11:07 PM · Addons, OpenGL / Gfx, Python, BF Blender

Sun, Dec 23

Vlad (Darcvizer) created T59790: Object has no mesh data to be used for ray casting.
Sun, Dec 23, 1:52 PM · Python, BF Blender: 2.8, BF Blender
Bastien Montagne (mont29) merged T59787: Blender 2.80 crash when running in batch mode into T59773: Crash accessing python gpu module in background mode..
Sun, Dec 23, 1:18 PM · Addons, OpenGL / Gfx, Python, BF Blender