Skip to content

Commit

Permalink
Merge branch 'master' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
JannisX11 committed Aug 30, 2023
2 parents cf7cbca + 4a9fd44 commit 734f280
Show file tree
Hide file tree
Showing 12 changed files with 141 additions and 74 deletions.
3 changes: 3 additions & 0 deletions css/general.css
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,9 @@
background-color: var(--color-accent);
color: var(--color-accent_text);
}
.contextMenu .menu_more_button > * {
pointer-events: none;
}
li.menu_separator {
height: 2px;
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion js/animations/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ Interface.definePanels(() => {
let height = this.graph_offset - this.graph_size * value;
lines.push({
position: height,
label: value,
label: Math.round(value),
path: `M0 ${height} L10000 ${height}`
});
})
Expand Down
11 changes: 11 additions & 0 deletions js/boot_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ if (Blockbench.startup_count == 1) {
console.error(err);
}
}
if (Blockbench.startup_count == 3) {
try {
jQuery.ajax({
url: 'https://blckbn.ch/api/event/recurring_user',
type: 'POST',
data: {}
})
} catch (err) {
console.error(err);
}
}

Blockbench.on('before_closing', (event) => {
if (!Blockbench.hasFlag('no_localstorage_saving')) {
Expand Down
66 changes: 65 additions & 1 deletion js/modeling/mirror_modeling.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,70 @@ const MirrorModeling = {
preview_controller.updateFaces(mesh);
preview_controller.updateUV(mesh);
},
getMirrorElement(element) {
let center = Format.centered_grid ? 0 : 8;
let e = 0.01;
let symmetry_axes = [0];
let off_axes = [ 1, 2];
function getElementParents(el) {
let list = [];
let subject = el;
while (subject.parent instanceof Group) {
subject = subject.parent;
list.push(subject)
}
return list;
}
if (element instanceof Cube) {
if (
symmetry_axes.find((axis) => !Math.epsilon(element.from[axis]-center, center-element.to[axis], e)) == undefined &&
off_axes.find(axis => element.rotation[axis]) == undefined &&
getElementParents(element).allAre(group => off_axes.find(axis => group.rotation[axis]) == undefined)
) {
return element;
} else {
for (var element2 of Cube.all) {
if (
element2 != element &&
Math.epsilon(element.inflate, element2.inflate, e) &&
off_axes.find(axis => !Math.epsilon(element.from[axis], element2.from[axis], e)) == undefined &&
off_axes.find(axis => !Math.epsilon(element.to[axis], element2.to[axis], e)) == undefined &&
symmetry_axes.find(axis => !Math.epsilon(element.size(axis), element2.size(axis), e)) == undefined &&
symmetry_axes.find(axis => !Math.epsilon(element.to[axis]-center, center-element2.from[axis], e)) == undefined &&
symmetry_axes.find(axis => !Math.epsilon(element.rotation[axis], element2.rotation[axis], e)) == undefined
) {
return element2;
}
}
}
return false;
} else if (element instanceof Mesh) {
let ep = 0.5;
let this_center = element.getCenter(true);
if (
symmetry_axes.find((axis) => !Math.epsilon(element.origin[axis], center, e)) == undefined &&
symmetry_axes.find((axis) => !Math.epsilon(this_center[axis], center, ep)) == undefined &&
off_axes.find(axis => element.rotation[axis]) == undefined
) {
return element;
} else {
for (var element2 of Mesh.all) {
let other_center = element2.getCenter(true);
if (Object.keys(element.vertices).length !== Object.keys(element2.vertices).length) continue;
if (
element2 != element &&
symmetry_axes.find(axis => !Math.epsilon(element.origin[axis]-center, center-element2.origin[axis], e)) == undefined &&
symmetry_axes.find(axis => !Math.epsilon(this_center[axis]-center, center-other_center[axis], ep)) == undefined &&
off_axes.find(axis => !Math.epsilon(element.origin[axis], element2.origin[axis], e)) == undefined &&
off_axes.find(axis => !Math.epsilon(this_center[axis], other_center[axis], ep)) == undefined
) {
return element2;
}
}
}
return element;
}
},
insertElementIntoUndo(element, undo_aspects, element_before_snapshot) {
// pre
if (element_before_snapshot) {
Expand Down Expand Up @@ -263,7 +327,7 @@ Blockbench.on('init_edit', ({aspects}) => {
let data = MirrorModeling.cached_elements[element.uuid] = {is_centered};
if (!is_centered) {
data.is_copy = Math.sign(element.getWorldCenter().x) != edit_side;
data.counterpart = Painter.getMirrorElement(element, [1, 0, 0]);
data.counterpart = MirrorModeling.getMirrorElement(element);
if (!data.counterpart) data.is_copy = false;
} else {
data.is_copy = false;
Expand Down
14 changes: 1 addition & 13 deletions js/texturing/painter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1172,26 +1172,15 @@ const Painter = {
let e = 0.01;
symmetry_axes = symmetry_axes.map((v, i) => v ? i : false).filter(v => v !== false);
let off_axes = [0, 1, 2].filter(i => !symmetry_axes.includes(i));
function getElementParents(el) {
let list = [];
let subject = el;
while (subject.parent instanceof Group) {
subject = subject.parent;
list.push(subject)
}
return list;
}
if (element instanceof Cube) {
if (
symmetry_axes.find((axis) => !Math.epsilon(element.from[axis]-center, center-element.to[axis], e)) == undefined &&
off_axes.find(axis => element.rotation[axis]) == undefined &&
getElementParents(element).allEqual(group => off_axes.find(axis => group.rotation[axis]) == undefined)
off_axes.find(axis => element.rotation[axis]) == undefined
) {
return element;
} else {
for (var element2 of Cube.all) {
if (
element2 != element &&
Math.epsilon(element.inflate, element2.inflate, e) &&
off_axes.find(axis => !Math.epsilon(element.from[axis], element2.from[axis], e)) == undefined &&
off_axes.find(axis => !Math.epsilon(element.to[axis], element2.to[axis], e)) == undefined &&
Expand All @@ -1218,7 +1207,6 @@ const Painter = {
let other_center = element2.getCenter(true);
if (Object.keys(element.vertices).length !== Object.keys(element2.vertices).length) continue;
if (
element2 != element &&
symmetry_axes.find(axis => !Math.epsilon(element.origin[axis]-center, center-element2.origin[axis], e)) == undefined &&
symmetry_axes.find(axis => !Math.epsilon(this_center[axis]-center, center-other_center[axis], ep)) == undefined &&
off_axes.find(axis => !Math.epsilon(element.origin[axis], element2.origin[axis], e)) == undefined &&
Expand Down
5 changes: 3 additions & 2 deletions js/texturing/textures.js
Original file line number Diff line number Diff line change
Expand Up @@ -1275,10 +1275,11 @@ class Texture {

if (isApp) {
//overwrite path
let image;
if (scope.mode === 'link') {
var image = nativeImage.createFromPath(scope.source.replace(/\?\d+$/, '')).toPNG()
image = nativeImage.createFromPath(scope.path).toPNG()
} else {
var image = nativeImage.createFromDataURL(scope.source).toPNG()
image = nativeImage.createFromDataURL(scope.source).toPNG()
}
tex_version++;

Expand Down
2 changes: 1 addition & 1 deletion js/webpack/bundle.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lang/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"data.preview": "Xem trước",
"data.toolbar": "Thanh công cụ",
"data.image": "Hình ảnh",
"keys.ctrl": "Control",
"keys.ctrl": "Ctrl",
"keys.shift": "Shift",
"keys.alt": "Alt",
"keys.meta": "Cmd",
Expand Down Expand Up @@ -1963,6 +1963,6 @@
"settings.brush_cursor_2d.desc": "Hiển thị đường viền xung quanh cọ vẽ trong môi trường 2D",
"settings.brush_cursor_3d": "Con trỏ cọ vẽ 3D",
"settings.brush_cursor_3d.desc": "Hiển thị đường viền xung quanh cọ vẽ trong môi trường 3D",
"settings.cdn_mirror": "Use CDN Mirror",
"settings.cdn_mirror.desc": "Use the mirror CDN to download plugins. The mirror receives updates faster and works in some regions where the default does not work."
"settings.cdn_mirror": "Dùng bản sao CDN",
"settings.cdn_mirror.desc": "Dùng bản sao CDN để tải xuống các plugin. Máy bản sao nhận cập nhật nhanh hơn và hoạt động ở một số vùng mà mặc định không hoạt động."
}
68 changes: 34 additions & 34 deletions lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1706,15 +1706,15 @@
"dialog.settings.create_profile": "创建配置...",
"settings_profile.confirm_delete": "确定删除此配置?",
"settings_profile.condition.type.selectable": "Manually Selectable",
"settings.interface_mode": "UI Mode",
"settings.interface_mode.desc": "用戶界面模式。重新启动Bench以更改",
"settings.interface_mode": "用户界面模式",
"settings.interface_mode.desc": "用户界面模式。重新启动 Blockbench 以应用改动",
"settings.interface_mode.auto": "自动",
"settings.interface_mode.desktop": "桌面",
"settings.interface_mode.mobile": "Mobile",
"settings.interface_mode.mobile": "移动设备",
"settings.paint_through_transparency": "透明绘画穿透",
"settings.paint_through_transparency.desc": "当 Alpha 通道锁定时,笔刷将穿透透明的区域",
"action.tab_overview": "Tab Overview",
"action.tab_overview.desc": "View all open tabs in a grid and jump to one",
"action.tab_overview": "标签页总览",
"action.tab_overview.desc": "查看网格中所有打开的标签页并跳转至其中一个",
"action.slider_color_red": "红色",
"action.slider_color_green": "绿色",
"action.slider_color_blue": "蓝色",
Expand All @@ -1729,8 +1729,8 @@
"action.keyframe_bezier_linked.desc": "Connect the right and left keyframe bézier handle",
"action.reset_keyframe_handles": "Reset Keyframe Handles",
"action.reset_keyframe_handles.desc": "Reset the bézier handles of the selected keyframes",
"action.looped_animation_playback": "Looped Playback",
"action.looped_animation_playback.desc": "Preview animations in an infinite loop",
"action.looped_animation_playback": "循环播放",
"action.looped_animation_playback.desc": "无限循环预览动画",
"timeline.bind_to_actor": "Bind to Actor",
"animation_controllers.select_preset": "Select a controller preset...",
"animation_controllers.state.animations": "Animations",
Expand Down Expand Up @@ -1772,11 +1772,11 @@
"settings.embed_textures.desc": "嵌入纹理到 .bbmodel 工程文件",
"action.selection_mode.cluster": "Cluster",
"dialog.copied_to_clipboard": "Copied to clipboard",
"data.reference_image": "Reference Image",
"message.delete_reference_image": "Are you sure you want to delete this reference image? This cannot be undone.",
"message.add_reference_image.message": "Select where to load the reference image",
"message.add_reference_image.project": "Add to this project",
"message.add_reference_image.app": "Add to all projects",
"data.reference_image": "参考图像",
"message.delete_reference_image": "您确定要删除该参考图吗?此操作无法撤销。",
"message.add_reference_image.message": "选择参考图要加载的位置",
"message.add_reference_image.project": "添加至当前项目",
"message.add_reference_image.app": "添加至所有项目",
"message.import_particle_texture.import": "Import Particle Texture",
"message.import_particle_texture.message": "Would you like to import a texture file to be used for your particle?",
"message.save_codec_selector.title": "Save Model Format",
Expand All @@ -1802,19 +1802,19 @@
"dialog.settings.reset_to_default": "重置至原值",
"keybindings.item.num_slider.increase": "Increase",
"keybindings.item.num_slider.decrease": "Decrease",
"settings.always_show_splash_art": "Always Show Splash Art",
"settings.always_show_splash_art.desc": "Always display the splash art on the start screen",
"settings.always_show_splash_art": "始终显示 Splash Art",
"settings.always_show_splash_art.desc": "始终显示开始界面的 Splash Art",
"action.slider_palette_color": "Switch Palette Color",
"action.slider_palette_color.desc": "Cycle between the colors in the palette",
"action.proportional_editing": "Proportional Editing",
"action.proportional_editing.desc": "Proportionally affect surrounding vertices when editing parts of a mesh",
"action.limit_to_palette": "Limit to Palette",
"action.limit_to_palette.desc": "Limits the colors of the texture to those in the currently loaded palette",
"action.edit_reference_images": "Edit Reference Images",
"action.edit_reference_images.desc": "Turn on reference image mode to add or edit reference images and blueprints",
"action.add_reference_image": "Add Reference Image",
"action.reference_image_from_clipboard": "Reference Image from Clipboard",
"action.reference_image_list": "Reference Images",
"action.edit_reference_images": "编辑参考图像",
"action.edit_reference_images.desc": "打开参考图像模式以添加或编辑参考图和蓝图",
"action.add_reference_image": "添加参考图像",
"action.reference_image_from_clipboard": "从剪贴板读取参考图像",
"action.reference_image_list": "参考图像",
"action.connect_uv_faces": "Connect UV Faces",
"action.connect_uv_faces.desc": "Connect the selected UV faces to the last selected UV face",
"action.merge_uv_vertices": "Merge UV Vertices",
Expand All @@ -1832,18 +1832,18 @@
"menu.uv.flip_y": "Mirror Y",
"menu.mirror_painting.enabled": "Enabled",
"menu.mirror_painting.configure_texture_center": "Configure Texture Center...",
"reference_image.position": "Position",
"reference_image.size": "型号",
"reference_image.rotation": "Rotation",
"reference_image.opacity": "Opacity",
"reference_image.visibility": "Visibility",
"reference_image.position": "位置",
"reference_image.size": "尺寸",
"reference_image.rotation": "旋转",
"reference_image.opacity": "透明度",
"reference_image.visibility": "可见",
"reference_image.clear_mode": "Clear Mode",
"reference_image.layer": "Layer",
"reference_image.layer.background": "Behind Model",
"reference_image.layer.viewport": "Above Model",
"reference_image.layer.float": "Above Interface",
"reference_image.layer": "层级",
"reference_image.layer.background": "置于模型下方",
"reference_image.layer.viewport": "置于模型上方",
"reference_image.layer.float": "置于界面上方",
"reference_image.layer.blueprint": "Locked Blueprint",
"reference_image.scope": "Scope",
"reference_image.scope": "范围",
"reference_image.scope.project": "Just this project",
"reference_image.scope.global": "All projects",
"reference_image.enabled_modes": "Enabled in Modes",
Expand Down Expand Up @@ -1890,7 +1890,7 @@
"dialog.plugins.disable": "Disable",
"dialog.plugins.enable": "Enable",
"dialog.plugins.dependencies": "Depends on:",
"dialog.view_backups.open_folder": "Open Folder",
"dialog.view_backups.open_folder": "打开文件夹",
"dialog.share_model.reference_images": "Include Reference Images",
"dialog.share_model.too_large": "Failed to upload: Model is too large",
"dialog.share_model.too_large_references": "Failed to upload: Model is too large. Try without reference images.",
Expand All @@ -1909,8 +1909,8 @@
"settings.json_indentation.spaces_2": "Spaces: 2",
"action.slider_stretch": "Stretch",
"action.slider_stretch.desc": "Stretches cubes multiplicatively on the %0 axis without changing the UV",
"action.view_backups": "View Backups",
"action.view_backups.desc": "Browse the list of auto-saved project backups",
"action.view_backups": "查看备份",
"action.view_backups.desc": "浏览自动保存的项目备份列表",
"action.search_outliner": "Search Outliner",
"action.search_outliner.desc": "Search for specific element names in the outliner",
"action.mirror_modeling": "Mirror Modeling",
Expand Down Expand Up @@ -1963,6 +1963,6 @@
"settings.brush_cursor_2d.desc": "Display an outline around the brush in the 2D workspace",
"settings.brush_cursor_3d": "3D Brush Cursor",
"settings.brush_cursor_3d.desc": "Display an outline around the brush in the 3D workspace",
"settings.cdn_mirror": "Use CDN Mirror",
"settings.cdn_mirror.desc": "Use the mirror CDN to download plugins. The mirror receives updates faster and works in some regions where the default does not work."
"settings.cdn_mirror": "使用 CDN 镜像",
"settings.cdn_mirror.desc": "使用镜像 CDN 下载插件。镜像接收更新的速度更快,并且可以在默认设置失效的某些地区中使用。"
}
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 734f280

Please sign in to comment.