2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2010-01-19 00:59:36 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup pythonintern
|
2011-02-27 20:10:08 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2010-01-19 00:59:36 +00:00
|
|
|
|
2025-01-07 12:39:13 +01:00
|
|
|
#include <Python.h>
|
|
|
|
|
|
|
|
|
|
struct StructRNA;
|
|
|
|
|
|
2024-09-24 12:23:25 +02:00
|
|
|
PyObject *BPY_rna_props();
|
2021-12-02 17:24:04 +11:00
|
|
|
/**
|
|
|
|
|
* Run this on exit, clearing all Python callback users and disable the RNA callback,
|
|
|
|
|
* as it would be called after Python has already finished.
|
|
|
|
|
*/
|
2024-09-24 12:23:25 +02:00
|
|
|
void BPY_rna_props_clear_all();
|
2010-01-19 00:59:36 +00:00
|
|
|
|
Datablock ID Properties
The absence of datablock properties "will certainly be resolved soon as the need for them is becoming obvious" said the [[http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.67/Python_Nodes|Python Nodes release notes]]. So this patch allows Python scripts to create ID Properties which reference datablocks.
This functionality is implemented for `PointerProperty` and now such properties can be created with Python.
In addition to the standard update callback, `PointerProperty` can have a `poll` callback (standard RNA) which is useful for search menus. For details see the test included in this patch.
Original author: @artfunkel
Alexander (Blend4Web Team)
Reviewers: brecht, artfunkel, mont29, campbellbarton
Reviewed By: mont29, campbellbarton
Subscribers: jta, sergey, campbellbarton, wisaac, poseidon4o, mont29, homyachetser, Evgeny_Rodygin, AlexKowel, yurikovelenov, fjuhec, sharlybg, cardboard, duarteframos, blueprintrandom, a.romanov, BYOB, disnel, aditiapratama, bliblubli, dfelinto, lukastoenne
Maniphest Tasks: T37754
Differential Revision: https://developer.blender.org/D113
2017-04-13 12:30:03 +03:00
|
|
|
PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw);
|
|
|
|
|
PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw);
|
|
|
|
|
StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix);
|
|
|
|
|
|
2024-09-24 12:23:25 +02:00
|
|
|
struct BPy_PropDeferred {
|
2021-02-20 16:16:43 +11:00
|
|
|
PyObject_HEAD
|
2021-07-30 16:04:00 +10:00
|
|
|
/**
|
|
|
|
|
* Internally a #PyCFunctionObject type.
|
|
|
|
|
* \note This isn't GC tracked, it's a function from `bpy.props` so it's not going away.
|
|
|
|
|
*/
|
2021-06-24 17:10:22 +10:00
|
|
|
void *fn;
|
2021-02-20 16:16:43 +11:00
|
|
|
PyObject *kw;
|
2024-09-24 12:23:25 +02:00
|
|
|
};
|
2021-02-20 16:16:43 +11:00
|
|
|
|
|
|
|
|
extern PyTypeObject bpy_prop_deferred_Type;
|
|
|
|
|
#define BPy_PropDeferred_CheckTypeExact(v) (Py_TYPE(v) == &bpy_prop_deferred_Type)
|
|
|
|
|
|
2017-11-29 15:16:12 +01:00
|
|
|
#define PYRNA_STACK_ARRAY RNA_STACK_ARRAY
|