Hi, all!
@TheComet it looks like something fishy is going on, but I can’t understand what.
Doing the following:
Node *head_bone = node_->GetChild("head", true);
Node *root_bone = node_->GetChild("spine02", true);
IKEffector *ike = head_bone->CreateComponent<IKEffector>();
ike->SetChainLength(2);
iks = root_bone->CreateComponent<IKSolver>();
iks->EnableAutoSolve(false);
iks->EnableUpdatePose(true);
SubscribeToEvent(E_SCENEDRAWABLEUPDATEFINISHED, URHO3D_HANDLER(BTBlackboard, HandleSceneDrawableUpdateFinished));
And get crash on creation of IKSolver.
#3 0x0000000000b86994 in Urho3D::IKSolver::BuildTreeToEffector (this=0x0, node=0xd946a20) at /home/slapin/Urho3D/Source/Urho3D/IK/IKSolver.cpp:387
#4 0x0000000000b86ad2 in Urho3D::IKSolver::HandleComponentAdded (this=0xcd2c5b0, eventType=..., eventData=...) at /home/slapin/Urho3D/Source/Urho3D/IK/IKSolver.cpp:423
#5 0x0000000000b894be in Urho3D::EventHandlerImpl<Urho3D::IKSolver>::Invoke (this=0xa0a11a0, eventData=...) at /home/slapin/Urho3D/Source/Urho3D/IK/../IK/../Scene/../Scene/../Scene/../Core/Object.h:307
#6 0x0000000000baf801 in Urho3D::Object::OnEvent (this=0xcd2c5b0, sender=0x2f914c0, eventType=..., eventData=...) at /home/slapin/Urho3D/Source/Urho3D/Core/Object.cpp:121
#7 0x0000000000bb0396 in Urho3D::Object::SendEvent (this=0x2f914c0, eventType=..., eventData=...) at /home/slapin/Urho3D/Source/Urho3D/Core/Object.cpp:355
#8 0x00000000009803ea in Urho3D::Node::AddComponent (this=0xd946a20, component=0xd67f8d0, id=16777474, mode=Urho3D::LOCAL) at /home/slapin/Urho3D/Source/Urho3D/Scene/Node.cpp:1851
#9 0x000000000097c611 in Urho3D::Node::CreateComponent (this=0xd946a20, type=..., mode=Urho3D::LOCAL, id=0) at /home/slapin/Urho3D/Source/Urho3D/Scene/Node.cpp:922
#10 0x00000000008e1820 in Urho3D::Node::CreateComponent<Urho3D::IKEffector> (this=0xd946a20, mode=Urho3D::REPLICATED, id=0) at /home/slapin/Urho3D/include/Urho3D/IK/../Scene/../Scene/Node.h:706
#11 0x00000000008dca85 in BTBlackboard::Start (this=0xd67f6c0) at /home/slapin/dungeon/rework/BehaviorTree.cpp:47
#12 0x0000000000988ef0 in Urho3D::LogicComponent::OnNodeSet (this=0xd67f6c0, node=0xd8eaaa0) at /home/slapin/Urho3D/Source/Urho3D/Scene/LogicComponent.cpp:83
#13 0x0000000000975e0c in Urho3D::Component::SetNode (this=0xd67f6c0, node=0xd8eaaa0) at /home/slapin/Urho3D/Source/Urho3D/Scene/Component.cpp:259
#14 0x0000000000980230 in Urho3D::Node::AddComponent (this=0xd8eaaa0, component=0xd67f6c0, id=0, mode=Urho3D::REPLICATED) at /home/slapin/Urho3D/Source/Urho3D/Scene/Node.cpp:1821
#15 0x000000000097c611 in Urho3D::Node::CreateComponent (this=0xd8eaaa0, type=..., mode=Urho3D::REPLICATED, id=0) at /home/slapin/Urho3D/Source/Urho3D/Scene/Node.cpp:922
#16 0x00000000012197ee in Urho3D::NodeCreateComponent (typeName=..., mode=Urho3D::REPLICATED, id=0, ptr=0xd8eaaa0) at /home/slapin/Urho3D/Source/Urho3D/AngelScript/../AngelScript/APITemplates.h:517
#17 0x0000000000fa7d0f in endstack () at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_callfunc_x64_gcc.cpp:162
#18 0x0000000000fa8706 in CallSystemFunctionNative (context=0x30d4180, descr=0x2535ed0, obj=0xd8eaaa0, args=0x2f66a98, retPointer=0x0, retQW2=@0x7fffffffd820: 0, secondObject=0x0)
at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_callfunc_x64_gcc.cpp:468
#19 0x0000000000908037 in CallSystemFunction (id=2367, context=0x30d4180) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_callfunc.cpp:712
#20 0x00000000008eef32 in asCContext::ExecuteNext (this=0x30d4180) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_context.cpp:2515
#21 0x00000000008ec423 in asCContext::Execute (this=0x30d4180) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_context.cpp:1297
#22 0x00000000009cc314 in Urho3D::ScriptFile::Execute (this=0x2f4b790, function=0x30d4a10, parameters=..., unprepare=true) at /home/slapin/Urho3D/Source/Urho3D/AngelScript/ScriptFile.cpp:324
#23 0x00000000009cf13a in Urho3D::ScriptEventInvoker::HandleScriptEvent (this=0x3103d90, eventType=..., eventData=...) at /home/slapin/Urho3D/Source/Urho3D/AngelScript/ScriptFile.cpp:956
#24 0x00000000009d30d8 in Urho3D::EventHandlerImpl<Urho3D::ScriptEventInvoker>::Invoke (this=0x2411210, eventData=...) at /home/slapin/Urho3D/Source/Urho3D/AngelScript/../AngelScript/../Core/Object.h:307
#25 0x0000000000baf801 in Urho3D::Object::OnEvent (this=0x3103d90, sender=0x1cdfdd0, eventType=..., eventData=...) at /home/slapin/Urho3D/Source/Urho3D/Core/Object.cpp:121
#26 0x0000000000bb0396 in Urho3D::Object::SendEvent (this=0x1cdfdd0, eventType=..., eventData=...) at /home/slapin/Urho3D/Source/Urho3D/Core/Object.cpp:355
#27 0x0000000000bcec7e in Urho3D::Engine::Update (this=0x1cdfdd0) at /home/slapin/Urho3D/Source/Urho3D/Engine/Engine.cpp:695
#28 0x0000000000bce5be in Urho3D::Engine::RunFrame (this=0x1cdfdd0) at /home/slapin/Urho3D/Source/Urho3D/Engine/Engine.cpp:519
#29 0x0000000000bcb162 in Urho3D::Application::Run (this=0x1cdfc40) at /home/slapin/Urho3D/Source/Urho3D/Engine/Application.cpp:86
#30 0x00000000008e6301 in RunApplication () at /home/slapin/dungeon/rework/Urho3DPlayer.cpp:47
#31 0x00000000008e63a8 in main (argc=1, argv=0x7fffffffe248) at /home/slapin/dungeon/rework/Urho3DPlayer.cpp:47
This looks like it failed to generate tree, and fails to find any node thus crashing.
I added some debug in the loop to show node name it parses:
[Fri May 26 20:44:27 2017] INFO: chain: head
[Fri May 26 20:44:27 2017] INFO: chain: neck03
[Fri May 26 20:44:27 2017] INFO: chain: neck02
[Fri May 26 20:44:27 2017] INFO: chain: neck01
[Fri May 26 20:44:27 2017] INFO: chain: spine01
[Fri May 26 20:44:27 2017] INFO: chain: spine02
[Fri May 26 20:44:27 2017] INFO: chain: spine03
[Fri May 26 20:44:27 2017] INFO: chain: spine04
[Fri May 26 20:44:27 2017] INFO: chain: spine05
[Fri May 26 20:44:27 2017] INFO: chain: root
[Fri May 26 20:44:27 2017] INFO: chain: AdjNode
[Fri May 26 20:44:27 2017] INFO: chain: npc1
[Fri May 26 20:44:27 2017] INFO: chain:
Which looks like it parses till scene, than gets NULL and crashes.
I wonder why it fails building tree completely. I use makehuman model for test.
I created the bug
https://github.com/urho3d/Urho3D/issues/1957
to indicate the issue.