Game Engine returns NONE when accessing object's .groupMembers attribute #40778

Closed
opened 2014-06-24 02:59:17 +02:00 by Brian Cochran · 11 comments

System Information
Windows 7

Blender Version
Broken: 2.7 19e627c

Short description of error
When trying to access the object attribute .groupMembers, NONE is always returned. Only way it works is if you instance the group and put it on an active layer and try to access the group instance's attribute.

Exact steps for others to reproduce the error
Open the System Console and uncomment the print statements individually and run the Game Engine to see the bug. There are 4 different setups of accessing the attribute: 1.From object on Active layer. 2.From object on inactive layer 3.From group instance on active layer (This works currently). 4.From group instance on inactive layer.

BGE_bug.blend

**System Information** Windows 7 **Blender Version** Broken: 2.7 19e627c **Short description of error** When trying to access the object attribute .groupMembers, NONE is always returned. Only way it works is if you instance the group and put it on an active layer and try to access the group instance's attribute. **Exact steps for others to reproduce the error** Open the System Console and uncomment the print statements individually and run the Game Engine to see the bug. There are 4 different setups of accessing the attribute: 1.From object on Active layer. 2.From object on inactive layer 3.From group instance on active layer (This works currently). 4.From group instance on inactive layer. [BGE_bug.blend](https://archive.blender.org/developer/F95412/BGE_bug.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @BrianCochran

Added subscriber: @BrianCochran
Member

Added subscriber: @brita

Added subscriber: @brita
Member

Added subscribers: @kupoman, @Moguri

Added subscribers: @kupoman, @Moguri
Member

I see several things here. One, you are getting objects from the scene with both:

  scene.objects["obj_name"]
  scene.objectsInactive["obj_name"]

As far as I can tell, this is always getting the objects correctly including in the last case.

Then, having the object, you always query for groupMembers that, according to the documentation :
"Returns the list of group members if the object is a group object, otherwise None is returned."
So, doing this for the Cylinder and Cube is correctly returning None, as they belong to a group, but are not a group instance.
As I see it, this:

 scene.objects["Cube"].groupObject.groupMembers

should do what you want in that case.
But it doesn't because groupObject is returning None. I don't think this even makes much sense as an object can belong to several groups, so this should return a list? @kupoman @Moguri

Summing up the problems:
KX_GameObject.groupObject is returning None when it should return the group
KX_GameObject.groupObject should actually return a list??
KX_GameObject.groupMembers is returning None when the group instance is on an invisible layer, should it?

I see several things here. One, you are getting objects from the scene with both: ``` scene.objects["obj_name"] scene.objectsInactive["obj_name"] ``` As far as I can tell, this is always getting the objects correctly including in the last case. Then, having the object, you always query for groupMembers that, according to the [documentation ](http://www.blender.org/documentation/blender_python_api_2_71_release/bge.types.KX_GameObject.html#bge.types.KX_GameObject.groupMembers): "Returns the list of group members if the object is a group object, otherwise None is returned." So, doing this for the Cylinder and Cube is correctly returning None, as they belong to a group, but are not a group instance. As I see it, this: ``` scene.objects["Cube"].groupObject.groupMembers ``` should do what you want in that case. But it doesn't because groupObject is returning None. I don't think this even makes much sense as an object can belong to several groups, so this should return a list? @kupoman @Moguri Summing up the problems: KX_GameObject.groupObject is returning None when it should return the group KX_GameObject.groupObject should actually return a list?? KX_GameObject.groupMembers is returning None when the group instance is on an invisible layer, should it?
Member

related commit: 7beff06950

related commit: 7beff06950

I think things are working as intended, but this is instead a case of confusing documentation. In the BGE, a KX_GroupObject is an object representing a dupligroup instance. So, only dupligroup instances will have a non-None groupMembers. Also, only objects that were instantiated from a dupligroup instance will have a non-None groupObject (in this sense, only one instance ever causes a specific object to be instantiated, so a list doesn't make sense). The only "groups" that the BGE cares about are dupligroup instances (it other wise doesn't recognize Blender groups).

I think things are working as intended, but this is instead a case of confusing documentation. In the BGE, a KX_GroupObject is an object representing a dupligroup instance. So, only dupligroup instances will have a non-None groupMembers. Also, only objects that were instantiated from a dupligroup instance will have a non-None groupObject (in this sense, only one instance ever causes a specific object to be instantiated, so a list doesn't make sense). The only "groups" that the BGE cares about are dupligroup instances (it other wise doesn't recognize Blender groups).
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Inês Almeida self-assigned this 2014-07-02 18:16:43 +02:00
Member

Changing the documentation then.

Changing the documentation then.

This issue was referenced by 0eb272df755772c2ad01e3e3738377d08803dda9

This issue was referenced by 0eb272df755772c2ad01e3e3738377d08803dda9

This issue was referenced by 7501bdc52e

This issue was referenced by 7501bdc52efe6224fba382c3652d193beec9402f
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#40778
No description provided.