Skip to content

Commit

Permalink
Merge pull request #459 from Autodesk/1213-hide-joint-editor
Browse files Browse the repository at this point in the history
Hide Joint Editor when editing Advanced Settings

Former-commit-id: 509ed51
  • Loading branch information
MattMoradi authored Aug 21, 2019
2 parents 13205ae + f3d846e commit ee35e18
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 47 deletions.
10 changes: 8 additions & 2 deletions exporters/FusionRobotExporter/Source/AddIn/CustomHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ void WorkspaceActivatedHandler::notify(const Ptr<WorkspaceEventArgs>& eventArgs)
eui->openGuidePalette();
else
eui->closeGuidePalette(true);

eui->imagesGenerated = false;
}
}

Expand Down Expand Up @@ -113,10 +115,14 @@ void ReceiveFormDataHandler::notify(const Ptr<HTMLEventArgs>& eventArgs)
{
if (eventArgs->action() == "highlight")
eui->highlightAndFocusSingleJoint(eventArgs->data(), false, 1);
else if (eventArgs->action() == "edit_sensors")
else if (eventArgs->action() == "edit_sensors") {
eui->closeJointEditorPalette();
eui->openSensorsPalette(eventArgs->data());
else if (eventArgs->action() == "save_sensors")
}
else if (eventArgs->action() == "save_sensors") {
eui->closeSensorsPalette(eventArgs->data());
eui->openJointEditorPalette();
}
else if (eventArgs->action() == "settings_guide")
eui->closeSettingsPalette(eventArgs->data());
else if (eventArgs->action() == "open_link")
Expand Down
20 changes: 13 additions & 7 deletions exporters/FusionRobotExporter/Source/AddIn/EUI-UIManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,18 @@ void EUI::openJointEditorPalette()

config.tempIconDir = std::experimental::filesystem::temp_directory_path().string() + "Synthesis\\FusionIconCache\\"; // Get OS temp dir for icons and save to JSON object

int index = 0;
for (std::pair<const std::basic_string<char>, BXDJ::ConfigData::JointConfig> joint : config.getJoints()) // For each joint, focus on the joint, take a pic, save to temp dir
if (!imagesGenerated)
{
EUI::highlightAndFocusSingleJoint(joint.first, false, 0.6);
app->activeViewport()->saveAsImageFile(config.tempIconDir+std::to_string(index)+".png", 90, 90); // TODO: Is this cross-platform?
index++;
};
int index = 0;
for (std::pair<const std::basic_string<char>, BXDJ::ConfigData::JointConfig> joint : config.getJoints()) // For each joint, focus on the joint, take a pic, save to temp dir
{
EUI::highlightAndFocusSingleJoint(joint.first, false, 0.6);
app->activeViewport()->saveAsImageFile(config.tempIconDir + std::to_string(index) + ".png", 90, 90); // TODO: Is this cross-platform?
index++;
};

EUI::resetHighlightAndFocusWholeModel(true, 1.5, ogCam); // clear highlight and move camera to look at whole robot
imagesGenerated = true;
}

uiThread = new std::thread([this](std::string configJSON) // Actually open the palette and send the joint data
{
Expand All @@ -286,6 +289,8 @@ void EUI::openJointEditorPalette()
jointEditorPalette->sendInfoToHTML("joints", configJSON);
}, config.toJSONString());
Analytics::LogPage(U("Joint Editor"));

UI->activeSelections()->clear();
}


Expand Down Expand Up @@ -554,6 +559,7 @@ void EUI::deleteSensorsPalette()

void EUI::openSensorsPalette(std::string sensors)
{
disableEditorButtons();
static std::thread * uiThread = nullptr;
if (uiThread != nullptr) { uiThread->join(); delete uiThread; }

Expand Down
1 change: 1 addition & 0 deletions exporters/FusionRobotExporter/Source/AddIn/EUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ namespace SynthesisAddIn
void focusWholeModel(bool transition, double zoom, Ptr<Camera> ogCam);

// bool dofViewEnabled = false;
bool imagesGenerated = false;

Ptr<Application> getApp() { return app; }

Expand Down
12 changes: 0 additions & 12 deletions exporters/FusionRobotExporter/palette/jointEditor.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,6 @@
</head>
<body>
<script src="js/jointEditor.js"></script>

<div id="advanced-modal" class="modal" style="display: none;">
<div class="modal-content">
<div class="modal-header">
<h2>Synthesis Add-In: Joint Editor</h2>
</div>
<div class="modal-body">
<p>Please save your changes in the advanced form before modifying advanced settings of other joints.</p>
</div>
</div>
</div>

<div class="fusion-content" id="export-settings">
<p id="nodata" style="font-size: 15px;">There were no joints found on your robot. To create a new joint, change to the "Design" workspace in the top left corner, and click "Joint" under "Assemble". You can also view our YouTube tutorial on how to add joints <a href="#" onclick="openLink('https://youtu.be/_YCP-cWn1Gc')">here.</a></p>

Expand Down
26 changes: 0 additions & 26 deletions exporters/FusionRobotExporter/palette/js/jointEditor.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
var noJoints = false;
let openFieldsetSensors = null;
var interactionAllowed = true;

document.addEventListener("click", freezeClicking, true);

function freezeClicking(e) {
if (!interactionAllowed) {
e.stopPropagation();
e.preventDefault();
document.getElementById("advanced-modal").style.display = "block";
}
}

// Prompts the Fusion add-in for joint data
// Highlight a joint in Fusion
Expand All @@ -29,9 +18,6 @@ function editSensors(fieldset)
const sensors = JSON.parse(fieldset.dataset.sensors);
sensors.isDrivetrain = jointTypeComboBox.value === "drivetrain";
adsk.fusionSendData('edit_sensors', JSON.stringify(sensors));

// interaction in main joint editor disabled while advanced form is opened
interactionAllowed = false;
}

// Handles the receiving of data from Fusion
Expand All @@ -54,8 +40,6 @@ window.fusionJavaScriptHandler =
console.log(data);
if (openFieldsetSensors != null)
openFieldsetSensors.dataset.sensors = data;
interactionAllowed = true;
document.getElementById("advanced-modal").style.display = "none";
}
else if (action === 'debugger')
{
Expand Down Expand Up @@ -299,16 +283,6 @@ function saveValues()
return configData;
}

//document.getElementsByClassName("close")[0].onclick = function() {
// document.getElementById("advanced-modal").style.display = "none";
//}
//
//window.onclick = function(event) {
// if (event.target == document.getElementById("advanced-modal")) {
// document.getElementById("advanced-modal").style.display = "none";
// }
//}

// Sends the data to the Fusion add-in
function sendInfoToFusion()
{
Expand Down

0 comments on commit ee35e18

Please sign in to comment.