*/}}
Explorar o código

Unparent object fix

YimingWu hai 1 ano
pai
achega
c266416361
Modificáronse 1 ficheiros con 7 adicións e 4 borrados
  1. 7 4
      resources/la_modelling.c

+ 7 - 4
resources/la_modelling.c

@@ -790,11 +790,14 @@ int la_ParentableRecursive(tnsObject* root, tnsObject* parent){
 }
 void la_MakeParentExecuteRecursive(tnsObject* root, tnsObject* parent, int Unparent, int KeepTransform){
     laListItemPointer* NextLip;
+    if(root->Type!=TNS_OBJECT_ROOT){ 
+        if((root->Flags&TNS_OBJECT_FLAGS_SELECTED)&&root->InRoot==parent->InRoot){
+            if(Unparent) tnsUnparentObject(root, KeepTransform);
+            elif(root!=parent) tnsParentObject(root, parent, KeepTransform);
+        }
+    }
     for(laListItemPointer* lip=root->ChildObjects.pFirst;lip;lip=NextLip){ NextLip=lip->pNext;
-        tnsObject* o=lip->p; if((!o) || (!(o->Flags&TNS_OBJECT_FLAGS_SELECTED)) || (o==parent)) continue;
-        if(Unparent) tnsUnparentObject(o, KeepTransform);
-        else tnsParentObject(o, parent, KeepTransform);
-        la_MakeParentExecuteRecursive(o,parent,Unparent,KeepTransform);
+        tnsObject* o=lip->p; if(!o) continue; la_MakeParentExecuteRecursive(o,parent,Unparent,KeepTransform);
     }
     laNotifyUsers("tns.world");
 }