Group instantiation problem with mesh objects created in inactive scene. #54358

Closed
opened 2018-03-19 11:58:20 +01:00 by Bill Currie · 8 comments

System Information
Linux, Nvidia 1080

Blender Version
Broken: 2.79 (2018-03-15 hash 995ccf8168)

Short description of error
When a mesh object is created in an inactive scene and instantiated via group instantiation, the mesh does not show until the inactive scene is visited.

Exact steps for others to reproduce the error
In the attached scenetest.blend, hit alt-p in the text editor. The created object will be just an empty until test_scene is visited.scenetest.blend

**System Information** Linux, Nvidia 1080 **Blender Version** Broken: 2.79 (2018-03-15 hash 995ccf81688) **Short description of error** When a mesh object is created in an inactive scene and instantiated via group instantiation, the mesh does not show until the inactive scene is visited. **Exact steps for others to reproduce the error** In the attached scenetest.blend, hit alt-p in the text editor. The created object will be just an empty until test_scene is visited.[scenetest.blend](https://archive.blender.org/developer/F2463550/scenetest.blend)
Author

Added subscriber: @taniwha

Added subscriber: @taniwha

Added subscriber: @idlecode

Added subscriber: @idlecode
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Confirming the issue on first sight.

Before looking at this further: Is there actually a reason to not change scenes via python [to circumvent this issue?]

import bpy
from mathutils import Vector

test_verts = [
    Vector(( 1,  1,  1)),
    Vector((-1, -1,  1)),
    Vector(( 1, -1, -1)),
    Vector((-1,  1, -1)),
]
test_faces = [
    (0, 1, 2),
    (0, 2, 3),
    (0, 3, 1),
    (3, 2, 1),
]

if "test_scene" not in bpy.data.scenes:
    scene = bpy.data.scenes.new("test_scene")
else:
    scene = bpy.data.scenes["test_scene"]

bpy.context.screen.scene = scene

mesh = bpy.data.meshes.new("testmesh")
mesh.from_pydata(test_verts, [], test_faces)

obj = bpy.data.objects.new("testobj", mesh)
scene.objects.link(obj)

group = bpy.data.groups.new("test_group")
group.objects.link(obj)

bpy.context.screen.scene = bpy.data.scenes["Scene"]

iobj = bpy.data.objects.new("group_object", None)
iobj.dupli_type = 'GROUP'
iobj.dupli_group = group
bpy.context.scene.objects.link(iobj)
Confirming the issue on first sight. Before looking at this further: Is there actually a reason to **not** change scenes via python [to circumvent this issue?] ``` import bpy from mathutils import Vector test_verts = [ Vector(( 1, 1, 1)), Vector((-1, -1, 1)), Vector(( 1, -1, -1)), Vector((-1, 1, -1)), ] test_faces = [ (0, 1, 2), (0, 2, 3), (0, 3, 1), (3, 2, 1), ] if "test_scene" not in bpy.data.scenes: scene = bpy.data.scenes.new("test_scene") else: scene = bpy.data.scenes["test_scene"] bpy.context.screen.scene = scene mesh = bpy.data.meshes.new("testmesh") mesh.from_pydata(test_verts, [], test_faces) obj = bpy.data.objects.new("testobj", mesh) scene.objects.link(obj) group = bpy.data.groups.new("test_group") group.objects.link(obj) bpy.context.screen.scene = bpy.data.scenes["Scene"] iobj = bpy.data.objects.new("group_object", None) iobj.dupli_type = 'GROUP' iobj.dupli_group = group bpy.context.scene.objects.link(iobj) ```
Author

I sort of do a similar thing by creating the object in the current scene then moving it to the utility scene, but that's only because the created object may or may not be moved depending on other factors.

Of course, I could just briefly switch to the utility scene when creating the object, but that feels too hacky for me to be comfortable with it, and also I worry about the possibility that there may be other lurking issues that will need addressing anyway. That is, it seems cleaner to fix the root problem rather than just work around it.

I sort of do a similar thing by creating the object in the current scene then moving it to the utility scene, but that's only because the created object may or may not be moved depending on other factors. Of course, I could just briefly switch to the utility scene when creating the object, but that feels too hacky for me to be comfortable with it, and also I worry about the possibility that there may be other lurking issues that will need addressing anyway. That is, it seems cleaner to fix the root problem rather than just work around it.
Philipp Oeser self-assigned this 2018-04-26 15:07:41 +02:00
Member

OK, will have a closer look later [and shout for help if that doesnt succeed :)]

OK, will have a closer look later [and shout for help if that doesnt succeed :)]
Philipp Oeser was unassigned by Dalai Felinto 2019-12-23 16:36:16 +01:00
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Philipp Oeser self-assigned this 2020-01-30 13:47:27 +01:00
Member

Hi there (sorry this has been lying around for so long...)

I have updated the file/script to 2.8 syntax
https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/Scene_and_Object_API

scenetest_28.blend

This now seems to work just fine, the mesh does show up immediately, the inactive scene doesnt have to be visited.

So will close as resolved then (feel free though to comment again if issues persist....)

Hi there (sorry this has been lying around for so long...) I have updated the file/script to 2.8 syntax https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/Scene_and_Object_API [scenetest_28.blend](https://archive.blender.org/developer/F8313622/scenetest_28.blend) This now seems to work just fine, the mesh does show up immediately, the inactive scene doesnt have to be visited. So will close as resolved then (feel free though to comment again if issues persist....)
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#54358
No description provided.