Browse Source

allow relative transform to unconnected nodes

David Rose 23 năm trước cách đây
mục cha
commit
e11f759e48
1 tập tin đã thay đổi với 6 bổ sung2 xóa
  1. 6 2
      panda/src/pgraph/nodePath.cxx

+ 6 - 2
panda/src/pgraph/nodePath.cxx

@@ -542,8 +542,12 @@ set_transform(const NodePath &other, const TransformState *transform) const {
   nassertv_always(!is_empty());
 
   // First, we perform a wrt to the parent, to get the conversion.
-  NodePath parent = get_parent();
-  CPT(TransformState) rel_trans = other.get_transform(parent);
+  CPT(TransformState) rel_trans;
+  if (has_parent()) {
+    rel_trans = other.get_transform(get_parent());
+  } else {
+    rel_trans = other.get_transform(NodePath());
+  }
 
   CPT(TransformState) new_trans = rel_trans->compose(transform);
   set_transform(new_trans);