|
From: <tre...@us...> - 2007-10-19 17:15:22
|
Revision: 517
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=517&view=rev
Author: trevorolio
Date: 2007-10-19 10:15:26 -0700 (Fri, 19 Oct 2007)
Log Message:
-----------
Sitting framework pretty much done for now, though the avatars need better animations and a fix for Mike's baggy butt when sitting.
Added seat metadata editing to templateEditor.html
Handled the cases of a thing or user involved in a sit being reloaded or removed from a space.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/templateEditor.html
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/templateEditor.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/templateEditor.html 2007-10-19 00:58:59 UTC (rev 516)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/templateEditor.html 2007-10-19 17:15:26 UTC (rev 517)
@@ -18,6 +18,32 @@
width: 100%;
}
+#northDiv {
+ width: 500px;
+ border-right: 250px solid #FFF;
+ margin-right: -250px;
+ float: left;
+}
+
+#rail {
+ background-color: #FFF;
+ width: 250px;
+ float: left;
+}
+
+#seatDiv h3 form {
+ display: inline;
+}
+
+#seatPositionForm {
+ margin-right: 30px;
+ text-align: right;
+}
+#seatRotationForm {
+ margin-right: 30px;
+ text-align: right;
+}
+
.section {
border: solid 1px #CCD;
border-top: solid 5px #CCD;
@@ -37,6 +63,9 @@
var resourceForm = null;
var currentResourcesDiv = null;
var objMessage = null;
+var seatCheckbox = null;
+var seatPositionForm = null;
+var seatRotationForm = null;
var scriptEditor = null;
@@ -88,6 +117,21 @@
}
currentResourcesDiv.innerHTML = resourceHTML;
objMessage.innerHTML = geometryMessage;
+ seatCheckbox.checked = templateDoc.getAttribute("seat") == "true";
+ seatPositionForm["seatX"].value = parseFloat(templateDoc.getAttribute("seatx")).toFixed(2);
+ seatPositionForm["seatY"].value = parseFloat(templateDoc.getAttribute("seaty")).toFixed(2);
+ seatPositionForm["seatZ"].value = parseFloat(templateDoc.getAttribute("seatz")).toFixed(2);
+
+ var rw = parseFloat(templateDoc.getAttribute("seatrw")).toFixed(2);
+ var rx = parseFloat(templateDoc.getAttribute("seatrx")).toFixed(2);
+ var ry = parseFloat(templateDoc.getAttribute("seatry")).toFixed(2);
+ var rz = parseFloat(templateDoc.getAttribute("seatrz")).toFixed(2);
+ var quat = new Quaternion(rw, rx, ry, rz);
+ var euler = quat.getEuler();
+ seatRotationForm["seatRotX"].value = euler[0].toFixed(2);
+ seatRotationForm["seatRotY"].value = euler[1].toFixed(2);
+ seatRotationForm["seatRotZ"].value = euler[2].toFixed(2);
+
}
function deleteObjGeometry0Go(){
@@ -164,6 +208,39 @@
requestTemplate(authedUsername, templateID, handleTemplateDocument);
}
+function updateSeatSettingsGo(){
+ if(templateDoc == null){
+ return;
+ }
+ var isASeat = seatCheckbox.checked;
+ var seatX = +seatPositionForm["seatX"].value;
+ var seatY = +seatPositionForm["seatY"].value;
+ var seatZ = +seatPositionForm["seatZ"].value;
+ var seatRotX = +seatRotationForm["seatRotX"].value;
+ var seatRotY = +seatRotationForm["seatRotY"].value;
+ var seatRotZ = +seatRotationForm["seatRotZ"].value;
+
+ if(isNaN(seatX) || isNaN(seatY) || isNaN(seatX) || isNaN(seatRotX) || isNaN(seatRotY) || isNaN(seatZ)){
+ alert("Bad position or ratation (not a number)");
+ return;
+ }
+
+ templateDoc.setAttribute("seat", isASeat);
+
+ templateDoc.setAttribute("seatx", seatX);
+ templateDoc.setAttribute("seaty", seatY);
+ templateDoc.setAttribute("seatz", seatZ);
+
+ var rotQuat = new Quaternion();
+ rotQuat.setEuler(seatRotX, seatRotY, seatRotZ);
+ templateDoc.setAttribute("seatrw", rotQuat.w);
+ templateDoc.setAttribute("seatrx", rotQuat.x);
+ templateDoc.setAttribute("seatry", rotQuat.y);
+ templateDoc.setAttribute("seatrz", rotQuat.z);
+
+ updateTemplate(templateDoc, handleTemplateDocument);
+}
+
function init(){
populateMemberMenuItem();
mainElement = document.getElementById("main");
@@ -174,6 +251,9 @@
resourceForm = document.getElementById('resourceForm');
currentResourcesDiv = document.getElementById("currentResources");
objMessage = document.getElementById("objMessage");
+ seatCheckbox = document.getElementById("seatCheckbox");
+ seatPositionForm = document.getElementById("seatPositionForm");
+ seatRotationForm = document.getElementById("seatRotationForm");
scriptEditor = document.getElementById('scriptEditor');
@@ -208,29 +288,50 @@
<form id="titleForm" onsubmit="titleFormGo(); return false;"><h1 id="title">Template: loading...</h1></form>
<div id="content">
+ <div id="northDiv">
+ <div class="section">
+ <h3>Geometry:</h3>
+ <p>
+ <h4>Obj file:</h4>
+ <span id="objMessage"></span>
+ <form id="obj0Form" onsubmit="return false;" target="obj0Target" action="" enctype="multipart/form-data" method="post">
+ <input type="file" name="objFile" />
+ <input type="submit" value="set" />
+ </form>
+ <iframe id="obj0Target" name="obj0Target" style="width: 1px; height: 1px;"></iframe>
+
+ <h4>JPEGs, GIFs, PNGs, and MTLs:</h4>
+ <div id="currentResources"> </div>
- <div class="section">
- <h3>Geometry:</h3>
- <p>
- <h4>Obj file:</h4>
- <span id="objMessage"></span>
- <form id="obj0Form" onsubmit="return false;" target="obj0Target" action="" enctype="multipart/form-data" method="post">
- <input type="file" name="objFile" />
- <input type="submit" value="set" />
+ <form id="resourceForm" onsubmit="resourceFormGo();" target="resourceTarget" action="" enctype="multipart/form-data" method="post">
+ <input type="file" name="resourceFile" />
+ <input type="submit" value="add" />
+ </form>
+ <iframe id="resourceTarget" name="resourceTarget" style="width: 1px; height: 1px;"></iframe>
+ </p>
+ </div>
+ </div> <!-- end northDiv -->
+
+ <div id="rail">
+ <div id="seatDiv" class="section">
+ <h3>Is a seat: <form onsubmit="updateSeatSettingsGo(); return false;"><input onchange="updateSeatSettingsGo();" type="checkbox" id="seatCheckbox" /></form></h3>
+ <form method="get" action="index.html" onsubmit="updateSeatSettingsGo(); return false;" id="seatPositionForm">
+ x: <input type="text" size="5" id="seatX" name="seatX" /><br/>
+ y: <input type="text" size="5" id="seatY" name="seatY" /><br/>
+ z: <input type="text" size="5" id="seatZ" name="seatZ" /><br/>
</form>
- <iframe id="obj0Target" name="obj0Target" style="width: 1px; height: 1px;"></iframe>
- <h4>JPEGs, GIFs, PNGs, and MTLs:</h4>
- <div id="currentResources"> </div>
-
- <form id="resourceForm" onsubmit="resourceFormGo();" target="resourceTarget" action="" enctype="multipart/form-data" method="post">
- <input type="file" name="resourceFile" />
- <input type="submit" value="add" />
+ <form method="get" action="index.html" onsubmit="updateSeatSettingsGo(); return false;" id="seatRotationForm">
+ rotation x: <input type="text" size="5" id="seatRotX" name="seatRotX" /><br/>
+ rotation y: <input type="text" size="5" id="seatRotY" name="seatRotY" /><br/>
+ rotation z: <input type="text" size="5" id="seatRotZ" name="seatRotZ" /><br/>
+ <input type="submit" value="set" />
</form>
- <iframe id="resourceTarget" name="resourceTarget" style="width: 1px; height: 1px;"></iframe>
- </p>
- </div>
+ </div>
+ </div><!-- end rail -->
+ <br clear="all"/>
+
<div class="section">
<div style="float: right;" class="navLink"><a href="http://ogoglio.wiki.sourceforge.net/ServerManualJavascriptAPI">Script API »</a></div>
<h3>Script:</h3>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|