From 3555bacbac9cf7f455d81b74c9c9d6124acf1695 Mon Sep 17 00:00:00 2001 From: Markus Moenig Date: Tue, 24 Sep 2024 17:01:23 +0700 Subject: [PATCH] Changed wall naming scheme --- creator/embedded/geo_wall_back.png | Bin 0 -> 4475 bytes creator/embedded/geo_wall_left.png | Bin 0 -> 4468 bytes creator/src/modeleditor.rs | 4 +-- creator/src/modelfxeditor.rs | 34 +++++++++++++-------- shared/src/geofxnode.rs | 46 +++++++++++++++++------------ shared/src/geofxobject.rs | 4 +-- 6 files changed, 53 insertions(+), 35 deletions(-) create mode 100644 creator/embedded/geo_wall_back.png create mode 100644 creator/embedded/geo_wall_left.png diff --git a/creator/embedded/geo_wall_back.png b/creator/embedded/geo_wall_back.png new file mode 100644 index 0000000000000000000000000000000000000000..7df6589e8508585c7f684f5fdc16aec307914668 GIT binary patch literal 4475 zcmcIoc~sJA+r}kr$|aZ70@TtZN5j%WFqeEsGxurv%-j+;QgA^uOmnE5BqOlNNi(-5 z)8>5(l}HN>&2Y_yG6PJ_1rDQXP+$~&>h||PG zBGH?>8q(vw{W#OUZE~dCbRljg5SI=S2V0Cj=p^ zCfljpenrv*eLGV$duFW85v)}BEv2qGifyv{j?4~2B(lanU~@Yn+UE-+?_R6L2){+r z&Jv+3KY-p~QhAu%6(wa6cjjr`qPtp-`+uBHZ#j_12%-z_bcn|Y2oZtzu0gO9NFre2 zp7L?x`S0qAYuiT(`bQ&4i_H`23Y@6MPod2fiW=sp&D<1wcJc#>(Bo!;ZI1nYBi&T% zu4vpB0}u#^mYO{m`zG7H@asd;>;0ZdkTYruZL@bT44lN4gj?oyoO{>sVhZ)kgkHBB z{Wjx};KOh!*&&|w^R98`!T8o&I%TCDr)AxDAiau(6TPXf1Wa0i}JI z(b0INpKWJ+z)QUyqVQ#~3Yly>%U!-vJbFvZ z-{0fq(9kZ*Tz+w}QS}L5s?n~uiO@Y+9Q3^+uBj#m`2@d+gjH3=Va=O=1IMzi#xEih z?M2QTmHf~@>PnJg+N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-HWtNqITB*Ei5bDd2O_9S6Yc{@U zVigya54{N!-|?E8GthU%ZjOI(BOv%`X$qy0Ktl$Uv&O4>k#*0SNo#njYcVodjtg4c z6LbX_X`*i;k;uOWg75c~@zcZ3QKq)j8Qvp(b2E#&Yrvqe+uiF9^7HLGhN2pqfC|U} zAmBxTMEp4YS(l%%Zmm)S!3^IopUb6Dt0LD7C4Tw#(4l}J>YP5SvNnD`y~90I=Cf!m m_qS19S)1wpmp6k3auUx<*uFIQec;~|kgKzoQ`x_QulyI1T`HUa literal 0 HcmV?d00001 diff --git a/creator/embedded/geo_wall_left.png b/creator/embedded/geo_wall_left.png new file mode 100644 index 0000000000000000000000000000000000000000..7e8b60259846cdb3f8cb2587ef2c97c64482b552 GIT binary patch literal 4468 zcmcIoeK^y5|6dfHatMX8BplUAGn8hYszbXa4@cdOhgob)7&gNQXQ{g!XPHV7!<!M?Izgq;k7-o_M0_~b`useM*X3O}% zmfHpncMTlWDF4pnAnfe0SgiX$fs3?$$(sK^uE_PRfBS7c3Ko0ztlhsjw9Fl?=dr($ zqDUl{*7cC*AKHwuY?_wWwq5!Yq;bJx(IPb}a;n#qY>t2UaG zzSDwe{i3k!$yi;$2Y zh6zKstEL2%#+V)opHkRWLpIrnYx|~8Oj1uuQmVZg>SdUus0aq@wBLUXb=r#eBhxj> z?B9kzu!S?1lt2lBz=ZTg6@ju!H)jlzuBh1Q=DJnZM>?R`^pm!lBaL4;JoV|1Th*CX zk}gz=dSJ`ce;1j8_cP(-+>iN=7n8ejyoA8kh>2c{uU?}|x!kTlV}(rAiz8|m3@yFA zt!9A5aN6|dT2e9J$0c6R`xGmPk;v~Rjy&LxAS)u130a@M>bwxz2~7g-cGQgyH+ZJ% z3oGj!@t?Coz8EWPKyC@{jWZTQi+cM5PdIgMhxk<3u`+pgx&{yax+5sVdfs~l8?dXU|rcz(V2z_v2IN!YV z*NigpS*&S_zBi4gG6o1Fd1ygTzyT^i!m%uyCWs1okrY*7XIGSE_#RfwW!7B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om{LvZ`$19BP6!l`dVw=xrS<@I zDVKI&**A9`5TJ8$0N;@ev|6A83&nVOgreek^WipCk(LK8OieYLgHL4S?0*t81o$Nx z;2Im8v-9qq!4{K7)x3Lpz&iT}gV3`g6P#J0JDB0#92~Gz_rpRoDf5^H7z}oG9Hd%K z)|ne`*3pNR1Z>k!CvCsf^v<~%*C)t&Ye&-#G3|shK+Ms!u3&q{{YPBuXdueb8-PXx z_p4V2lj$iJ3PfCd;y9+^FuUFKi0XE&n~C!g4mqtqBtxz(t@jjWq8R{TJx^gJzGY?r zWB~N%gdoJp0Wi;R1%qv5b3sCu%h5?}S#M*IHUymIy9qHcN=@lBogE)!%Ij z1b-StWNCS0ydbBChE{C?TXR45gEpoS()Q$xcqzsr>htcF$DMB@*m?!YK!e~dplgD` z%sL*9x0>&Gulv^R2VHN2!R3>cOCC5J^pX((s;7`pf>dLlF=Q2DEU3*`vmyuD&XE>E zgAZwXa)Z&!iVregQ@A1uK|C*HRaLbHb0uGH$mM;1&MY zPk*GpL7P9K@c~5&lzR`|rPkm=m-vRO@b2tPO3JoL$l{89a#sOs?4-Wt{B5YqOR}B& z%SzIg`s9+)%a{ct$|BgnG)*k_0Ynf`PmNiNkx8y*aQ?Z+bsTwci}iZj+n** zhA95LkT^PIZ(dgVg;urV?LKy5?es<_*0vfid_oY1Q%<(GVqs}m7PI^f00#1X55|O^ zHrxozn9Q_8f2#sq{>P9nnU3k{F%pLG2nOc{mv8K}8V_>$MQttd+hzt0sRu@wsaJMW zQht1Y9B{LZypFoytWSC{82rqsduLLvdS%{B>}pe`Fpf=dWT@Pkl7eaahW0MHM0Yry zoSre3MF4XHVPS$ZIzptTI|8-VoN0!9h2J9YuSc7QU90O~skJRCD{CO@ZKzq*DZ8l% z { if name == "Length" || name == "Height" { diff --git a/creator/src/modelfxeditor.rs b/creator/src/modelfxeditor.rs index 120d5447..dc7f40e9 100644 --- a/creator/src/modelfxeditor.rs +++ b/creator/src/modelfxeditor.rs @@ -631,9 +631,9 @@ impl ModelFXEditor { geo_obj.nodes[index].set(name, value.clone()); match &geo_obj.nodes[index].role { GeoFXNodeRole::LeftWall - | GeoFXNodeRole::TopWall + | GeoFXNodeRole::BackWall | GeoFXNodeRole::RightWall - | GeoFXNodeRole::BottomWall + | GeoFXNodeRole::FrontWall | GeoFXNodeRole::MiddleWallH | GeoFXNodeRole::MiddleWallV => { if name == "Length" || name == "Height" { @@ -1260,8 +1260,8 @@ impl ModelFXEditor { } /// Set the tiles for the picker. - pub fn set_geo_tiles(&mut self, palette: &ThePalette, ui: &mut TheUI, ctx: &mut TheContext) { - let tile_size = 48; + pub fn set_geo_tiles(&mut self, _palette: &ThePalette, ui: &mut TheUI, ctx: &mut TheContext) { + let tile_size = 65; //let mut set_default_selection = false; @@ -1310,14 +1310,24 @@ impl ModelFXEditor { i += 1; - tile.preview( - &mut tile_buffer, - None, - palette, - &FxHashMap::default(), - Vec2f::zero(), - ctx, - ); + if let Some(icon_name) = tile.icon_name() { + if let Some(b) = ctx.ui.icon(&icon_name) { + tile_buffer.copy_into(0, 0, b); + } else { + tile_buffer.fill(BLACK); + } + } else { + tile_buffer.fill(BLACK); + } + + // tile.preview( + // &mut tile_buffer, + // None, + // palette, + // &FxHashMap::default(), + // Vec2f::zero(), + // ctx, + // ); buffer.copy_into(x * grid, y * grid, &tile_buffer); self.geos.insert((x, y), tile.clone()); } diff --git a/shared/src/geofxnode.rs b/shared/src/geofxnode.rs index 41dd675b..a43a7ce6 100644 --- a/shared/src/geofxnode.rs +++ b/shared/src/geofxnode.rs @@ -24,9 +24,9 @@ pub enum GeoFXNodeRole { Column, LeftWall, - TopWall, + BackWall, RightWall, - BottomWall, + FrontWall, MiddleWallH, MiddleWallV, @@ -100,7 +100,7 @@ impl GeoFXNode { coll.set("Annular", TheValue::Text(str!("0.0"))); coll.set("Extrusion", TheValue::Text(str!("thickness"))); } - LeftWall | TopWall | RightWall | BottomWall | MiddleWallH | MiddleWallV => { + LeftWall | FrontWall | RightWall | BackWall | MiddleWallH | MiddleWallV => { coll.set("Pos X", TheValue::Float(0.1)); coll.set("Pos Y", TheValue::Float(0.5)); coll.set("Length", TheValue::FloatRange(1.0, 0.001..=1.0)); @@ -253,9 +253,9 @@ impl GeoFXNode { Self::new(GeoFXNodeRole::RemoveHeight), Self::new(GeoFXNodeRole::SetHeight), Self::new(GeoFXNodeRole::LeftWall), - Self::new(GeoFXNodeRole::TopWall), + Self::new(GeoFXNodeRole::BackWall), Self::new(GeoFXNodeRole::RightWall), - Self::new(GeoFXNodeRole::BottomWall), + Self::new(GeoFXNodeRole::FrontWall), Self::new(GeoFXNodeRole::MiddleWallH), Self::new(GeoFXNodeRole::MiddleWallV), // Self::new(GeoFXNodeRole::BendWallNW), @@ -282,9 +282,9 @@ impl GeoFXNode { RemoveHeight => str!("Remove height from the ground tile (height map)."), SetHeight => str!("Set the height of the ground tile (height map)."), LeftWall => str!("Left Wall"), - TopWall => str!("Top Wall"), + BackWall => str!("Back Wall"), RightWall => str!("Right Wall"), - BottomWall => str!("Bottom Wall"), + FrontWall => str!("Front Wall"), MiddleWallH => str!("Middle Wall X"), MiddleWallV => str!("Niddle Wall Y"), Column => str!("A column (disc) with an optional profile."), @@ -312,15 +312,23 @@ impl GeoFXNode { GeoFXNode::new(MiddleWallH) } + pub fn icon_name(&self) -> Option { + match self.role { + LeftWall => Some(str!("geo_wall_left")), + BackWall => Some(str!("geo_wall_back")), + _ => None, + } + } + pub fn description(&self) -> String { match &self.role { AddHeight => str!("Add height to the ground tile (height map)."), RemoveHeight => str!("Remove height from the ground tile (height map)."), SetHeight => str!("Set the height of the ground tile (height map)."), LeftWall => str!("A wall on the left side of the tile."), - TopWall => str!("A wall on the top side of the tile."), + BackWall => str!("A wall on the back side of the tile."), RightWall => str!("A wall on the right side of the tile."), - BottomWall => str!("A wall on the bottom side of the tile."), + FrontWall => str!("A wall on the front side of the tile."), MiddleWallH => str!("A horizontal wall in the middle of the tile."), MiddleWallV => str!("A vertical wall in the middle of the tile."), // BendWallNW => str!("A rounded wall from the left to the top side of the tile."), @@ -629,14 +637,14 @@ impl GeoFXNode { ctx.material_id = Some(format!("material_{}", ctx.id_counter)); ctx.id_counter += 1; } - LeftWall | MiddleWallV | RightWall | TopWall | MiddleWallH | BottomWall => { + LeftWall | MiddleWallV | RightWall | BackWall | MiddleWallH | FrontWall => { let face_type = match &self.role { LeftWall => "Left", MiddleWallV => "MiddleY", RightWall => "Right", - TopWall => "Top", + BackWall => "Back", MiddleWallH => "MiddleX", - BottomWall => "Bottom", + FrontWall => "Front", _ => "", }; @@ -719,7 +727,7 @@ impl GeoFXNode { return sdf_box2d(p, pos, thick, len); } - TopWall => { + BackWall => { let t = if coll.get_i32_default("2D Mode", 0) == 1 { 1.0 } else { @@ -751,7 +759,7 @@ impl GeoFXNode { return sdf_box2d(p, pos, thick, len); } - BottomWall => { + FrontWall => { let t = if coll.get_i32_default("2D Mode", 0) == 1 { 1.0 } else { @@ -971,7 +979,7 @@ impl GeoFXNode { d } - TopWall => { + BackWall => { let thick = params[2] / 2.0; let len = params[3]; let mut height = params[4]; @@ -1030,7 +1038,7 @@ impl GeoFXNode { d } - BottomWall => { + FrontWall => { let thick = params[2] / 2.0; let len = params[3]; let mut height = params[4]; @@ -1363,7 +1371,7 @@ impl GeoFXNode { area.push(Vec2i::new(pos.x, pos.y + i)); } } - TopWall | BottomWall | MiddleWallH => { + BackWall | FrontWall | MiddleWallH => { let pos = Vec2i::from(self.position(&coll)); let length = self.length().ceil() as i32; for i in 0..length { @@ -1513,7 +1521,7 @@ impl GeoFXNode { pub fn inputs(&self) -> Vec { match self.role { - LeftWall | TopWall | RightWall | BottomWall | MiddleWallH | MiddleWallV => { + LeftWall | BackWall | RightWall | FrontWall | MiddleWallH | MiddleWallV => { vec![] } Bricks | Box | Disc | Material | Repeat | Stack | Group => { @@ -1545,7 +1553,7 @@ impl GeoFXNode { highest_output_terminal += 1; match self.role { - LeftWall | TopWall | RightWall | BottomWall | MiddleWallH | MiddleWallV => { + LeftWall | BackWall | RightWall | FrontWall | MiddleWallH | MiddleWallV => { let mut terminals = vec![]; for i in 1..=highest_output_terminal { terminals.push(TheNodeTerminal { diff --git a/shared/src/geofxobject.rs b/shared/src/geofxobject.rs index e8adde7f..c07a0869 100644 --- a/shared/src/geofxobject.rs +++ b/shared/src/geofxobject.rs @@ -148,7 +148,7 @@ impl GeoFXObject { } ctx.geometry = geometry; } - LeftWall | MiddleWallV | RightWall | TopWall | MiddleWallH | BottomWall => { + LeftWall | MiddleWallV | RightWall | BackWall | MiddleWallH | FrontWall => { let mut geometry = vec![]; for terminal in 0..6 { if let Some((n, _)) = self.find_connected_input_node(node, terminal) { @@ -276,7 +276,7 @@ impl GeoFXObject { role = geo.role.clone(); } match &role { - LeftWall | TopWall | RightWall | BottomWall | MiddleWallH | MiddleWallV => { + LeftWall | BackWall | RightWall | FrontWall | MiddleWallH | MiddleWallV => { let mut bricks = GeoFXNode::new(Box); bricks.position = vec2i(200, 40); self.nodes.push(bricks);