Maniphest T46338

Do not work change the grid taken from another scene.
Closed, Resolved

Assigned To
None
Authored By
Tort (Tort)
Oct 1 2015, 6:04 AM
Tags
  • Game Engine
Subscribers
Campbell Barton (campbellbarton)
Jorge Bernal (lordloki)
Mitchell Stokes (moguri)
perfection cat (sindra1961)
Porteries Tristan (panzergame)
Sybren A. Stüvel (sybren)
Tort (Tort)
Ulysse Martin (youle)

Description

System Information
Ubuntu 12.04

Blender Version
Broken: (2.75a)
Worked: (2.70a)

Short description of error
Do not work change the grid taken from another scene.

Exact steps for others to reproduce the error
Do not work
sce.objects['obj'].replaceMesh(mesh, True, False)
If the mesh is in a different scene.

Revisions and Commits

Abandoned
rB Blender

Event Timeline

Tort (Tort) created this task.Oct 1 2015, 6:04 AM
Tort (Tort) raised the priority of this task from to 90.
Tort (Tort) updated the task description.
Tort (Tort) added a project: Game Engine.
Tort (Tort) edited a custom field.
Tort (Tort) added a subscriber: Tort (Tort).
Porteries Tristan (panzergame) added a subscriber: Porteries Tristan (panzergame).Oct 1 2015, 11:57 AM

@Tort (Tort) : Please provide an example file, reopen this task when you will do it.

Porteries Tristan (panzergame) lowered the priority of this task from 90 to 30.Oct 1 2015, 11:57 AM
Tort (Tort) added a comment.Oct 1 2015, 6:34 PM

Example

Jorge Bernal (lordloki) raised the priority of this task from 30 to Normal.Oct 3 2015, 10:31 AM
Jorge Bernal (lordloki) added a subscriber: Jorge Bernal (lordloki).

I confirm the bug.

Porteries Tristan (panzergame) added a comment.Oct 3 2015, 6:27 PM

It's not a bug because two scene can have a mesh with the same name, so by default replaceMesh function works only with the object's scene meshes.

The bug is more that BGE doesn't print a message error for this.

perfection cat (sindra1961) added a subscriber: perfection cat (sindra1961).Oct 5 2015, 3:33 AM

@Porteries Tristan (panzergame):
I think that your understanding is wrong.
Even if the scenes are different, the object of the same name cannot exist.
In such a case we cannot identify an object by the name in bpy.data.objects.

Ulysse Martin (youle) added a subscriber: Ulysse Martin (youle).Oct 5 2015, 3:29 PM

The problem seems to come from this commit:

$ git bisect bad
6c9dd174a8bc2cd9a857c96f3ddfdb398aa6f88c is the first bad commit
commit 6c9dd174a8bc2cd9a857c96f3ddfdb398aa6f88c
Author: Mitchell Stokes <mogurijin@gmail.com>
Date: Mon Jun 2 18:52:13 2014 -0700

Fix T39053: Replace mesh actuator does not replace material (only mesh)

The replace mesh actuator was reconverting the mesh data which causes
conflicts with the LoD code. Instead, we just look for an already
converted mesh, which should already be in the scene.

https://developer.blender.org/rB6c9dd174a8bc2cd9a857c96f3ddfdb398aa6f88c

Porteries Tristan (panzergame) added subscribers: Mitchell Stokes (moguri), Campbell Barton (campbellbarton), Sybren A. Stüvel (sybren).EditedOct 17 2015, 10:24 AM

Mesh are shared by library in blender but not in the BGE : the BGE make a copy of a mesh for each scene if at least one object use it. So you can't replace by a mesh not in the object's scene, KX_GameObject.replaceMesh respect this behavior only the replace mesh logic brick respect half it : it does nothing but doesn't print any warning message.

Why not share meshes between scenes ?
It will disallow to free a scene because one of the scene's mesh can be owned in any other object, and the replace mesh brick should always check if its mesh still exist.
Of course we can do like libload : remove all meshes in all objects owned by the freeing library.

@Campbell Barton (campbellbarton), @Mitchell Stokes (moguri), @Sybren A. Stüvel (sybren) : What are your opinion on this report ?

Tort (Tort) added a comment.Oct 17 2015, 12:40 PM

Why not share meshes between scenes ?

Because no room to swing fall.

Porteries Tristan (panzergame) changed the task status from Unknown Status to Resolved by committing rB8d3d931f6a64: BGE: Fix T46338 replace mesh from an other scene..Oct 29 2015, 12:14 PM
Porteries Tristan (panzergame) added a commit: rB8d3d931f6a64: BGE: Fix T46338 replace mesh from an other scene..