AddObject doesn't work with linked objects in Blenderplayer #45597

Closed
opened 2015-07-29 05:30:42 +02:00 by Dalai Felinto · 12 comments

System Information
OSX 10.9.5

Blender Version
Broken: 2.60 all the way to 2.75a

Short description of error
I can't dynamically add a linked object with the AddObject Actuator in the Blenderplayer (it works with the embed BGE).

Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps

It works fine in the embed BGE in Blender, but in the Blenderplayer I get the error:
Warning, object "Plane" from AddObject actuator "Edit Object" is not in a hidden layer.

Note: the original object being added by the actuator is 'Cylinder', but the Blenderplayer mangles this which lead to the warning message.

**System Information** OSX 10.9.5 **Blender Version** Broken: 2.60 all the way to 2.75a **Short description of error** I can't dynamically add a linked object with the AddObject Actuator in the Blenderplayer (it works with the embed BGE). **Exact steps for others to reproduce the error** Based on a (as simple as possible) attached .blend file with minimum amount of steps * unzip base.blend and cylinder.blend from the zip file: [bplayer_addobject_linked.zip](https://archive.blender.org/developer/F214950/bplayer_addobject_linked.zip) * open base.blend It works fine in the embed BGE in Blender, but in the Blenderplayer I get the error: `Warning, object "Plane" from AddObject actuator "Edit Object" is not in a hidden layer.` Note: the original object being added by the actuator is 'Cylinder', but the Blenderplayer mangles this which lead to the warning message.
Author
Owner

Changed status to: 'Open'

Changed status to: 'Open'
Author
Owner

Added subscriber: @dfelinto

Added subscriber: @dfelinto
Author
Owner

I think I found the reason of this issue, basically in the blenderplayer any linked object is considered to be in the layer of its original file, regardless of the layer where the linked instance is in it.

I think I found the reason of this issue, basically in the blenderplayer any linked object is considered to be in the layer of its original file, regardless of the layer where the linked instance is in it.
Author
Owner

Added subscriber: @ideasman42

Added subscriber: @ideasman42
Author
Owner

If I add the following debug code:

diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 33c4ffd..cb097ec 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1981,6 +1981,11 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
                                                                                libloading);
 
                bool isInActiveLayer = (blenderobject->lay & activeLayerBitInfo) !=0;
+
+               std::cout <<  "DEBUG: Object \"" << blenderobject->id.name + 2 <<
+                             "\" layer: " << blenderobject->lay <<
+                             " (" << activeLayerBitInfo << ")." << std::endl;
+
                if (gameobj)
                {
                        /* macro calls object conversion funcs */

I get Object "Cylinder" layer: 2 (1) in the embed BGE, and Object "Cylinder" layer: 1 (1) in the Blenderplayer.

@ideasman42 do you know where should I look at to find why Blenderplayer linked objects have a different lay than Blender objects?

If I add the following debug code: ``` diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 33c4ffd..cb097ec 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1981,6 +1981,11 @@ void BL_ConvertBlenderObjects(struct Main* maggie, libloading); bool isInActiveLayer = (blenderobject->lay & activeLayerBitInfo) !=0; + + std::cout << "DEBUG: Object \"" << blenderobject->id.name + 2 << + "\" layer: " << blenderobject->lay << + " (" << activeLayerBitInfo << ")." << std::endl; + if (gameobj) { /* macro calls object conversion funcs */ ``` I get `Object "Cylinder" layer: 2 (1)` in the embed BGE, and `Object "Cylinder" layer: 1 (1)` in the Blenderplayer. @ideasman42 do you know where should I look at to find why Blenderplayer linked objects have a different `lay` than Blender objects?

Added subscriber: @AngusHollands-4

Added subscriber: @AngusHollands-4

Might want to check the conversion stage - BGE internal and external players have different code paths both running the engine and initialising it.

Might want to check the conversion stage - BGE internal and external players have different code paths both running the engine and initialising it.
Author
Owner

Either way it's something to fix for 2.8x. If we fix now it will introduce regression in many files. It's a nasty bug though, but at least we have a workaround.

Either way it's something to fix for 2.8x. If we fix now it will introduce regression in many files. It's a nasty bug though, but at least we have a workaround.
Author
Owner

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Dalai Felinto self-assigned this 2015-08-06 15:43:19 +02:00
Author
Owner
Moved to the TODO: http://wiki.blender.org/index.php/Dev:2.5/Source/Development/Todo/GameEngine#Game_Engine

This issue was referenced by 44384c698d

This issue was referenced by 44384c698d394f6e7ed17b61e8406c867488aef9

Changed status from 'Archived' to: 'Resolved'

Changed status from 'Archived' to: 'Resolved'
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
4 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#45597
No description provided.