Compare commits

..

1 Commits

Author SHA1 Message Date
verysecrethero 0aedeb61b4 CapturePointSystem now sets all children visible/not visible for each red/blue/spectator 2016-03-11 14:15:46 +01:00
5 changed files with 115 additions and 30 deletions
+1 -1
Submodule assets updated: 007b54bd67...33455a9d10
-1
View File
@@ -47,7 +47,6 @@ private:
// Utility functions // Utility functions
EntityWrapper importEntity(EntityWrapper parent, boost::filesystem::path filePath); EntityWrapper importEntity(EntityWrapper parent, boost::filesystem::path filePath);
void setWidgetMode(EditorGUI::WidgetMode mode); void setWidgetMode(EditorGUI::WidgetMode mode);
bool isAnyParentMissingTransform(EntityID entityID);
// GUI callbacks // GUI callbacks
void OnEntitySelected(EntityWrapper entity); void OnEntitySelected(EntityWrapper entity);
@@ -13,6 +13,7 @@
<c:Model> <c:Model>
<Resource>models/core/unitcube.mesh</Resource> <Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="0.980392158" G="1" R="1"/> <Color A="1" B="0.980392158" G="1" R="1"/>
<Shadow>false</Shadow>
</c:Model> </c:Model>
<c:Transform> <c:Transform>
<Position X="-0.100000001" Y="0" Z="0"/> <Position X="-0.100000001" Y="0" Z="0"/>
@@ -28,6 +29,7 @@
<c:Model> <c:Model>
<Resource>models/core/unitcube.mesh</Resource> <Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/> <Color A="1" B="0" G="0" R="1"/>
<Shadow>false</Shadow>
</c:Model> </c:Model>
<c:Transform> <c:Transform>
<Position X="-14.500001" Y="1.50000012" Z="16.9222012"/> <Position X="-14.500001" Y="1.50000012" Z="16.9222012"/>
@@ -52,6 +54,7 @@
<c:Model> <c:Model>
<Resource>models/core/unitcube.mesh</Resource> <Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="1" G="0" R="0"/> <Color A="1" B="1" G="0" R="0"/>
<Shadow>false</Shadow>
</c:Model> </c:Model>
<c:Transform> <c:Transform>
<Position X="-14.500001" Y="1.50000012" Z="-17.6888409"/> <Position X="-14.500001" Y="1.50000012" Z="-17.6888409"/>
@@ -67,6 +70,7 @@
<c:Model> <c:Model>
<Resource>models/core/unitcube.mesh</Resource> <Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/> <Color A="1" B="0" G="0" R="1"/>
<Shadow>false</Shadow>
</c:Model> </c:Model>
<c:Transform> <c:Transform>
<Position X="12.1000004" Y="1.50000012" Z="16.9222012"/> <Position X="12.1000004" Y="1.50000012" Z="16.9222012"/>
@@ -82,6 +86,7 @@
<c:Model> <c:Model>
<Resource>models/core/unitcube.mesh</Resource> <Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="1" G="0" R="0"/> <Color A="1" B="1" G="0" R="0"/>
<Shadow>false</Shadow>
</c:Model> </c:Model>
<c:Transform> <c:Transform>
<Position X="12.1228638" Y="1.50000012" Z="-17.9642811"/> <Position X="12.1228638" Y="1.50000012" Z="-17.9642811"/>
@@ -198,6 +203,7 @@
<c:Model> <c:Model>
<Resource>models/core/unitcube.mesh</Resource> <Resource>models/core/unitcube.mesh</Resource>
<Color A="1" B="39.2156868" G="0" R="3.13725495"/> <Color A="1" B="39.2156868" G="0" R="3.13725495"/>
<Shadow>false</Shadow>
</c:Model> </c:Model>
<c:Transform> <c:Transform>
<Scale X="-70" Y="-70" Z="-70"/> <Scale X="-70" Y="-70" Z="-70"/>
@@ -210,7 +216,7 @@
<c:Transform/> <c:Transform/>
</Components> </Components>
<Children> <Children>
<Entity name="-"> <Entity name="CapP">
<Components> <Components>
<c:AABB/> <c:AABB/>
<c:CapturePoint> <c:CapturePoint>
@@ -254,6 +260,13 @@
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
<Entity>
<Components>
<c:PointLight/>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="Blue"> <Entity name="Blue">
@@ -265,8 +278,26 @@
<Scale X="3.4000001" Y="4.70000029" Z="0.700000048"/> <Scale X="3.4000001" Y="4.70000029" Z="0.700000048"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource></Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:PointLight/>
<c:Transform/>
</Components>
<Children/> <Children/>
</Entity> </Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="Spectator"> <Entity name="Spectator">
<Components> <Components>
<c:Model> <c:Model>
@@ -276,22 +307,58 @@
<Scale X="1" Y="5.70000029" Z="1"/> <Scale X="1" Y="5.70000029" Z="1"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children>
<Entity>
<Components>
<c:PointLight/>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource></Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:PointLight/>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource></Resource>
</c:Model>
<c:Transform/>
</Components>
<Children/> <Children/>
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity> <Entity>
<Components> <Components>
<c:Transform/> <c:Transform/>
</Components> </Components>
<Children> <Children>
<Entity name="-"> <Entity name="CapP">
<Components> <Components>
<c:AABB/> <c:AABB/>
<c:CapturePoint> <c:CapturePoint>
<CaptureTimer>-15</CaptureTimer> <CaptureTimer>12</CaptureTimer>
<HomePointForTeam> <HomePointForTeam>
<Blue/> <Blue/>
</HomePointForTeam> </HomePointForTeam>
@@ -317,8 +384,39 @@
<Scale X="4.4000001" Y="2" Z="3.70000029"/> <Scale X="4.4000001" Y="2" Z="3.70000029"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource></Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Transform/>
</Components>
<Children/> <Children/>
</Entity> </Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="Blue"> <Entity name="Blue">
<Components> <Components>
<c:Model> <c:Model>
+1 -18
View File
@@ -72,9 +72,6 @@ void EditorSystem::Update(double dt)
m_EditorStats->Draw(actualDelta); m_EditorStats->Draw(actualDelta);
if (m_CurrentSelection.Valid() && m_Widget.Valid()) { if (m_CurrentSelection.Valid() && m_Widget.Valid()) {
if (isAnyParentMissingTransform(m_CurrentSelection.ID)) {
return;
}
(glm::vec3&)m_Widget["Transform"]["Position"] = Transform::AbsolutePosition(m_CurrentSelection); (glm::vec3&)m_Widget["Transform"]["Position"] = Transform::AbsolutePosition(m_CurrentSelection);
if (m_WidgetSpace == EditorGUI::WidgetSpace::Local) { if (m_WidgetSpace == EditorGUI::WidgetSpace::Local) {
(glm::vec3&)m_Widget["Transform"]["Orientation"] = Transform::AbsoluteOrientationEuler(m_CurrentSelection); (glm::vec3&)m_Widget["Transform"]["Orientation"] = Transform::AbsoluteOrientationEuler(m_CurrentSelection);
@@ -82,6 +79,7 @@ void EditorSystem::Update(double dt)
(glm::vec3&)m_Widget["Transform"]["Orientation"] = glm::vec3(0, 0, 0); (glm::vec3&)m_Widget["Transform"]["Orientation"] = glm::vec3(0, 0, 0);
} }
} }
m_EditorWorldSystemPipeline->Update(actualDelta); m_EditorWorldSystemPipeline->Update(actualDelta);
ComponentWrapper& cameraTransform = m_EditorCamera["Transform"]; ComponentWrapper& cameraTransform = m_EditorCamera["Transform"];
@@ -205,9 +203,6 @@ bool EditorSystem::OnMousePress(const Events::MousePress& e)
bool EditorSystem::OnWidgetDelta(const Events::WidgetDelta& e) bool EditorSystem::OnWidgetDelta(const Events::WidgetDelta& e)
{ {
if (m_CurrentSelection.Valid()) { if (m_CurrentSelection.Valid()) {
if (isAnyParentMissingTransform(m_CurrentSelection.ID)) {
return false;
}
if (m_WidgetSpace == EditorGUI::WidgetSpace::Global) { if (m_WidgetSpace == EditorGUI::WidgetSpace::Global) {
glm::quat parentOrientation; glm::quat parentOrientation;
glm::vec3 parentScale(1.f); glm::vec3 parentScale(1.f);
@@ -314,15 +309,3 @@ void EditorSystem::setWidgetMode(EditorGUI::WidgetMode mode)
m_Widget["Transform"]["Position"] = Transform::AbsolutePosition(m_CurrentSelection.World, m_CurrentSelection.ID); m_Widget["Transform"]["Position"] = Transform::AbsolutePosition(m_CurrentSelection.World, m_CurrentSelection.ID);
} }
bool EditorSystem::isAnyParentMissingTransform(EntityID entityID)
{
EntityWrapper entity(m_World, entityID);
while (entity.Parent().Valid()) {
if (!entity.HasComponent("Transform")) {
return true;
}
entity = entity.Parent();
}
return false;
}
+6 -1
View File
@@ -234,10 +234,15 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
void CapturePointSystem::ChangeCapturePointModelsVisibility(EntityWrapper &capturePointModels, bool isOwner) { void CapturePointSystem::ChangeCapturePointModelsVisibility(EntityWrapper &capturePointModels, bool isOwner) {
(bool&)capturePointModels["Model"]["Visible"] = isOwner; (bool&)capturePointModels["Model"]["Visible"] = isOwner;
for (auto& capModel : capturePointModels.ChildrenWithComponent("Model")) for (auto& capModel : capturePointModels.ChildrenWithComponent("Transform"))
{ {
if (capModel.HasComponent("Model")) {
(bool&)capModel["Model"]["Visible"] = isOwner; (bool&)capModel["Model"]["Visible"] = isOwner;
} }
if (capModel.HasComponent("PointLight")) {
(bool&)capModel["PointLight"]["Visible"] = isOwner;
}
}
} }
bool CapturePointSystem::OnTriggerTouch(const Events::TriggerTouch& e) bool CapturePointSystem::OnTriggerTouch(const Events::TriggerTouch& e)