Does removing a SubShape change the CompoundShape Shapes Array? #174
-
I'm working on a version of dynamic shapes and trying to figure out the best way to track the identity of a subshape so I can modify it at runtime. The ModifyShape method takes the index of the shape. What I'm worried about is the If I do In Javascript the shapes array would look like: Which means shapes C & D have new indexes. However I'm not sure if the C++ Array would work this way as its an I thought about using GetSubShapeIDFromIndex and storing the subshape but it's a little confusing how this works and what params I'd pass around. My other solution was to just set a hash in If Indexes don't change I'll go with that, if they do I'll probably buckle down on the SubShapeID |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
When you call Note that the SubShapeID basically encodes a sub shape index, so if you get a SubShapeID and then remove a sub shape, it will no longer point to the same sub shape. The |
Beta Was this translation helpful? Give feedback.
When you call
RemoveShape(1)
the indexes shift, so you'll end up withA:0, C:1, D:2
.Note that the SubShapeID basically encodes a sub shape index, so if you get a SubShapeID and then remove a sub shape, it will no longer point to the same sub shape.
The
UserData
of a sub shape was meant to keep track of sub shapes while adding/removing and is the only thing that can be used reliably (although from your post I gather you want the indices to shift, so maybe you don't need to track anything extra).