#"Make Unique" as a function

38 messages · Page 1 of 1 (latest)

brazen crow
#

Making duplicates of a mesh object and making them unique in the editor works as intended. However, duplicating them in code keeps the meshes linked, and modifying the shape keys of one modifies all of them. Is there a way to separate them in code? I'm using Gscript.

cunning birch
#

Are you sure you're using duplicate correctly?

#

They shouldn't be linked after duplicating

brazen crow
#

I've tried a few different flag sets, and none of them seem to work as intended

#

Upper left is made unique in editor. Ones on the right are duplicate()s of the bottom left one.

cunning birch
#

Then you're doing it wrong

#

Maybe you aren't duplicating the right thing?

brazen crow
cunning birch
#

That's just duplicating a node, not the mesh

brazen crow
#

Huh. So I'd need to duplicate the mesh separately from the node?

cunning birch
#

Assuming it needs to be duplicated, then yes

brazen crow
#

That... okay I kinda hate that, I haven't seen anything like that anywhere

cunning birch
#

Why are you duplicating nodes instead of using scenes or something?

#

Resources are reference types, so if you duplicate a node, it just copies the reference

brazen crow
#

I mean, I need copies of the script too.

#

And I tried using scenes, but those got linked too.

#

I tried Duplicate and Instance with a pre-loaded resource, both had the exact same result.

cunning birch
#

In a scene you can set "local to scene" on any resource that you want to have a local scene copy, rather than a reference to the same copy

brazen crow
#

Wat. How?

cunning birch
#

Just check the box

brazen crow
#

Okay, where

cunning birch
#

On the resource

brazen crow
#

Do you mean in MeshInstance in the Inspector?

cunning birch
#

I mean on any resource in the inspector

#

Mesh, shape, material, whatever

brazen crow
#

Found it on my own :V

cunning birch
#

How are you changing the mesh anyway? That code didn't really show that

brazen crow
#

Modifying shape keys using the script in the MeshInstance node.

cunning birch
#

Not sure what that means

#

What shape keys?

brazen crow
#

... Blend Shapes

#

These bits.

#

Also, to anyone else who looks at this asking the same thing: this button here

#

-> Resource tab -> Local To Scene

#

You REALLY gotta be more specific to what buttons we're supposed to click in the editor, but thanks for nudging me in the right direction.

cunning birch
#

You found it, so seems like I was specific enough