mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-07-24 08:05:04 +00:00
Make Imaginate into a node (#878)
* Simplify document node input defenitions * Remove imaginate layer * Imaginate node properties * Fix serde feature gate * Add Proc Macro for Protonode implementation * Fix incorrect type * Add cargo.toml metadata * Send imaginate params to frontend * Fix image_creativity range * Finish imaginate implementation * Fix the imaginate draw tool * Remove node-graph/rpco-macro * Cargo fmt * Fix missing workspace member * Changes to the resolution * Add checkbox for Imaginate auto resolution; improve Properties panel layouts And fix bugs in panel resizing * Implement the Rescale button * Reorder imports * Update Rust deps Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
2f2daa25e9
commit
2732492307
61 changed files with 2249 additions and 2596 deletions
|
@ -12,8 +12,8 @@ use editor::messages::input_mapper::utility_types::input_keyboard::ModifierKeys;
|
|||
use editor::messages::input_mapper::utility_types::input_mouse::{EditorMouseState, ScrollDelta, ViewportBounds};
|
||||
use editor::messages::portfolio::utility_types::{ImaginateServerStatus, Platform};
|
||||
use editor::messages::prelude::*;
|
||||
use graph_craft::document::NodeId;
|
||||
use graphene::color::Color;
|
||||
use graphene::layers::imaginate_layer::ImaginateStatus;
|
||||
use graphene::LayerId;
|
||||
|
||||
use serde::Serialize;
|
||||
|
@ -508,27 +508,23 @@ impl JsEditorHandle {
|
|||
|
||||
/// Sends the blob URL generated by JS to the Imaginate layer in the respective document
|
||||
#[wasm_bindgen(js_name = setImaginateImageData)]
|
||||
pub fn set_imaginate_image_data(&self, document_id: u64, layer_path: Vec<LayerId>, image_data: Vec<u8>) {
|
||||
let message = PortfolioMessage::ImaginateSetImageData { document_id, layer_path, image_data };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Sends the blob URL generated by JS to the Imaginate layer in the respective document
|
||||
#[wasm_bindgen(js_name = setImaginateBlobURL)]
|
||||
pub fn set_imaginate_blob_url(&self, document_id: u64, layer_path: Vec<LayerId>, blob_url: String, width: f64, height: f64) {
|
||||
let resolution = (width, height);
|
||||
let message = PortfolioMessage::ImaginateSetBlobUrl {
|
||||
pub fn set_imaginate_image_data(&self, document_id: u64, layer_path: Vec<LayerId>, node_path: Vec<NodeId>, image_data: Vec<u8>, width: u32, height: u32) {
|
||||
let message = PortfolioMessage::ImaginateSetImageData {
|
||||
document_id,
|
||||
node_path,
|
||||
layer_path,
|
||||
blob_url,
|
||||
resolution,
|
||||
image_data,
|
||||
width,
|
||||
height,
|
||||
};
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Notifies the Imaginate layer of a new percentage of completion and whether or not it's currently generating
|
||||
#[wasm_bindgen(js_name = setImaginateGeneratingStatus)]
|
||||
pub fn set_imaginate_generating_status(&self, document_id: u64, path: Vec<LayerId>, percent: Option<f64>, status: String) {
|
||||
pub fn set_imaginate_generating_status(&self, document_id: u64, layer_path: Vec<LayerId>, node_path: Vec<NodeId>, percent: Option<f64>, status: String) {
|
||||
use graph_craft::imaginate_input::ImaginateStatus;
|
||||
|
||||
let status = match status.as_str() {
|
||||
"Idle" => ImaginateStatus::Idle,
|
||||
"Beginning" => ImaginateStatus::Beginning,
|
||||
|
@ -541,7 +537,13 @@ impl JsEditorHandle {
|
|||
|
||||
let percent = if matches!(status, ImaginateStatus::Uploading(_)) { None } else { percent };
|
||||
|
||||
let message = PortfolioMessage::ImaginateSetGeneratingStatus { document_id, path, percent, status };
|
||||
let message = PortfolioMessage::ImaginateSetGeneratingStatus {
|
||||
document_id,
|
||||
layer_path,
|
||||
node_path,
|
||||
percent,
|
||||
status,
|
||||
};
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
|
@ -563,12 +565,13 @@ impl JsEditorHandle {
|
|||
|
||||
/// Sends the blob URL generated by JS to the Imaginate layer in the respective document
|
||||
#[wasm_bindgen(js_name = processNodeGraphFrame)]
|
||||
pub fn process_node_graph_frame(&self, document_id: u64, layer_path: Vec<LayerId>, image_data: Vec<u8>, width: u32, height: u32) {
|
||||
pub fn process_node_graph_frame(&self, document_id: u64, layer_path: Vec<LayerId>, image_data: Vec<u8>, width: u32, height: u32, imaginate_node: Option<Vec<NodeId>>) {
|
||||
let message = PortfolioMessage::ProcessNodeGraphFrame {
|
||||
document_id,
|
||||
layer_path,
|
||||
image_data,
|
||||
size: (width, height),
|
||||
imaginate_node,
|
||||
};
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue