Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming objects in external layout causes them to be invisible + more #142

Closed
unsoundness opened this issue Jun 23, 2015 · 4 comments
Closed

Comments

@unsoundness
Copy link

Renaming objects in an external layout causes them to become invisible, or act as if they don't exist.
It seems that the object name is not being updated/saved.

Note: if you rename it back to the original name (e.g. NewObject) it will show again

To reproduce:

  1. New empty project
  2. Add an external layout
  3. Double click the new external layout to open it
  4. Choose any scene to edit "as if the objects were included"
  5. Make a text object or shape painter (for example)
    You will see it on the screen fine,
    until 6) Rename the object (in object editor) to anything else
    It disappears, and doesn't render in the game either.
  6. Rename it back to the original name (NewObject) and it shows again..

In addition, if you stop at Step 6 (leaving the name as something new)
Then
-Add another object
-It will have the same name as the first object originally did (e.g. NewObject)
And even though the original object is named something else (such as "Blah"), when editing the properties of EITHER object, it changes the values for both of them as if they are the same object.

@victorlevasseur
Copy link
Contributor

Good catch ! The problem is that objects (in my opinion) should not be
renamed in the external layout because these are the objects of the
selected scene. We can prevent the user from doing so in the next version
of GDevelop.

Le mar. 23 juin 2015 à 23:45, unsoundness notifications@github.com a
écrit :

Renaming objects in an external layout causes them to become invisible, or
act as if they don't exist.
It seems that the object name is not being updated/saved.

Note: if you rename it back to the original name (e.g. NewObject) it will
show again

To reproduce:

  1. New empty project
  2. Add an external layout
  3. Double click the new external layout to open it
  4. Choose any scene to edit "as if the objects were included"
  5. Make a text object or shape painter (for example)
    You will see it on the screen fine,
    until 6) Rename the object (in object editor) to anything else
    It disappears, and doesn't render in the game either.
  6. Rename it back to the original name (NewObject) and it shows again..

In addition, if you stop at Step 6 (leaving the name as something new)
Then
-Add another object
-It will have the same name as the first object originally did (e.g.
NewObject)
And even though the original object is named something else (such as
"Blah"), when editing the properties of EITHER object, it changes the
values for both of them as if they are the same object.


Reply to this email directly or view it on GitHub
#142.

@4ian
Copy link
Owner

4ian commented Jun 25, 2015

If I'm not mistaken, when editing an external layout, the objects editor is passed the scene as parameter and so think that you are editing this scene. I think the solution would be to take a look at the method doing the renaming and ensure that all part of the project using the object (i.e: any external events/layout) are updated.
See https://github.com/4ian/GD/blob/master/IDE/Dialogs/ObjectsEditor.cpp#L596 :) (There are even TODO to refactor this part ^^)

@unsoundness
Copy link
Author

It would be very nice if it could be updated to allow the renaming rather than just disabled on the external layout, because it seems to get buggy even if I edit the name on other scenes, and I really don't want to keep the default NewObject# names for the following reason:

I'm basically trying to use these objects in multiple scenes as an overlay. Being forced to keep the default name of "NewObject#" (at the moment) is not very clean / clear in code, and it's a problem when I want to delete these objects (toggle off the overlay) as well. So I wanted to name everything with a prefix: e.g. OverlayTitleText, OverlaySomethingElse and then access/delete them this way.

In addition (while slightly on the topic):

It would be awesome if the external layouts actually were accessible as more of an "external" thing (e.g. MyExternalLayout.ObjectName)

or better, if there were a new feature called Overlays. Because I realize the way the external layout works now is also useful for true game objects/mechanics.

So ..
Right now the way you add them now is "Create objects from external layout" with seemingly no other options except editing it as if it's part of the scene.
What if instead, for an "Overlay Layout" (requested new feature)
a) you don't put these objects as part of the scene, they stay as an Overlay Layout
b) they are just drawn over the requested scene, with the X/Y being changeable (without the background unless that is requested)
c) Z-order would be good in case of multiple
d) methods to create/destroy + just hide and make visible again (in case it's a common toggle for a GUI or something)
e) translucent/transparency options and so on (bonus)

They would be drawn kind of like a layer, except you can use it on multiple scenes, and have better control over them. Even if it's always on top of the main scene (to keep it simpler to implement), it would be useful for GUI/HUD.

Example of how I imagine it would work in event (actions):
Show external overlay "MyOverlay"
Set the position (x,y) of overlay "MyOverlay" to 50,50
Set the transparency of overlay "MyOverlay" to 80%
(optional, you won't always want to pause, but maybe if it's an in-game menu without exiting the game)
Pause scene "GameScene"
then handle resume in the overlay when it's closed if you want
would be good to store which scene Called this overlay. so you can do like
Resume scene CallingScene (whatever called this overlay)
or CallingScene.SomeObject.MyFunction()
(callingscene=sender,whatever)

Or is there another clean way to do this and I'm completely oblivious to it existing?
Maybe I am asking for too much :)

Either way, thanks for looking into the original issue!

@4ian
Copy link
Owner

4ian commented May 26, 2018

Closing this as object names should properly be propagated across scenes and external layouts now.

@4ian 4ian closed this as completed May 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants