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.
4 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blender/blender#45597
No description provided.