chore: checkpoint web Blender migration source, tools and docs
Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer, web workflow engine and protocol, tooling, docs and task records. Large generated evidence, user-testing archives, build snapshots and imported test assets remain untracked. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,9 @@
|
||||
#include "RE_engine.h"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
#ifdef WITH_WEB
|
||||
# include "RNA_access_guard.hh"
|
||||
#endif
|
||||
#include "RNA_prototypes.hh"
|
||||
#include "RNA_types.hh"
|
||||
|
||||
@@ -93,6 +96,7 @@ struct bContext {
|
||||
struct {
|
||||
Main *main;
|
||||
Scene *scene;
|
||||
ViewLayer *view_layer;
|
||||
|
||||
int recursion;
|
||||
/** True if python is initialized. */
|
||||
@@ -130,9 +134,32 @@ bContext *CTX_copy(const bContext *C)
|
||||
|
||||
void CTX_free(bContext *C)
|
||||
{
|
||||
#ifdef WITH_WEB
|
||||
/* Poll-message cleanup can release Python callbacks. Suspended RNA accesses
|
||||
* must stop before those callbacks re-enter with a context being destroyed. */
|
||||
RNAMainAccessScope::context_destroyed(C);
|
||||
# ifdef WITH_PYTHON
|
||||
/* All native context owners pass here, not just the WebEngine wrapper.
|
||||
* Poll-message finalizers must not obtain a context being retired via bpy. */
|
||||
if (BPY_context_get() == C) {
|
||||
BPY_context_set(nullptr);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
/* This may contain a dynamically allocated message, free. */
|
||||
CTX_wm_operator_poll_msg_clear(C);
|
||||
|
||||
#ifdef WITH_WEB
|
||||
/* Also retire pending accesses created by the cleanup callback itself. */
|
||||
RNAMainAccessScope::context_destroyed(C);
|
||||
# ifdef WITH_PYTHON
|
||||
/* A nested callback can have rebound the module while clearing the poll
|
||||
* message. Never leave that slot pointing at the allocation freed below. */
|
||||
if (BPY_context_get() == C) {
|
||||
BPY_context_set(nullptr);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
MEM_delete(C);
|
||||
}
|
||||
|
||||
@@ -1310,6 +1337,11 @@ Main *CTX_data_main(const bContext *C)
|
||||
|
||||
void CTX_data_main_set(bContext *C, Main *bmain)
|
||||
{
|
||||
#ifdef WITH_WEB
|
||||
if (C->data.main != bmain) {
|
||||
RNAMainAccessScope::context_main_changed(C);
|
||||
}
|
||||
#endif
|
||||
C->data.main = bmain;
|
||||
BKE_sound_refresh_callback_bmain(bmain);
|
||||
}
|
||||
@@ -1353,6 +1385,14 @@ ViewLayer *CTX_data_view_layer(const bContext *C)
|
||||
return view_layer;
|
||||
}
|
||||
}
|
||||
else if (scene && C->data.view_layer) {
|
||||
/* RNA can remove a layer between calls. Compare membership before dereferencing. */
|
||||
for (ViewLayer &candidate : scene->view_layers) {
|
||||
if (&candidate == C->data.view_layer) {
|
||||
return &candidate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return BKE_view_layer_default_view(scene);
|
||||
}
|
||||
@@ -1531,6 +1571,9 @@ const char *CTX_data_mode_string(const bContext *C)
|
||||
|
||||
void CTX_data_scene_set(bContext *C, Scene *scene)
|
||||
{
|
||||
if (C->data.scene != scene) {
|
||||
C->data.view_layer = nullptr;
|
||||
}
|
||||
C->data.scene = scene;
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
@@ -1541,6 +1584,11 @@ void CTX_data_scene_set(bContext *C, Scene *scene)
|
||||
#endif
|
||||
}
|
||||
|
||||
void CTX_data_view_layer_set(bContext *C, ViewLayer *view_layer)
|
||||
{
|
||||
C->data.view_layer = view_layer;
|
||||
}
|
||||
|
||||
ToolSettings *CTX_data_tool_settings(const bContext *C)
|
||||
{
|
||||
ToolSettings *toolsettings;
|
||||
|
||||
Reference in New Issue
Block a user