Skip to content

Instantly share code, notes, and snippets.

View todashuta's full-sized avatar
👋
(  ̄ ♢  ̄ )

todashuta todashuta

👋
(  ̄ ♢  ̄ )
View GitHub Profile
@todashuta
todashuta / select_similar_normal.py
Last active November 6, 2022 09:02
ノーマルでの類似選択をbpyで自前でやってみた
import bpy
import bmesh
import numpy as np
obj = bpy.context.active_object
bpy.ops.object.mode_set(mode='EDIT')
bm = bmesh.from_edit_mesh(obj.data)
bm.faces.ensure_lookup_table()
@todashuta
todashuta / black2alpha0.py
Created September 23, 2022 08:09
画像の#000をアルファ0に変えるやつ
from PIL import Image
import numpy as np
img = Image.open("./testdata.bmp").convert("RGBA")
arr = np.array(img)
R = arr[:,:,0]
G = arr[:,:,1]
B = arr[:,:,2]
A = arr[:,:,3]
import bpy
import timeit
import numpy as np
def test01(n):
'''image.pixelsにそのままアクセスして超遅いパターン'''
img = bpy.data.images.new("test01-"+(str(n).zfill(4)), n, n, alpha=True)
img.generated_type = "COLOR_GRID"
for i in range(0, n*n*4, 4):
@todashuta
todashuta / show_num_of_selected_objects.py
Created June 26, 2022 09:06
Show Number of Selected Objects
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@todashuta
todashuta / run_usdview.bat
Last active May 26, 2022 16:17
USD portable? (NVIDIA USD Pre-built Libraries and Tools with Embeddable Python 3.6.8 )
@set SCRIPTDIR=%~dp0
@set PATH=%SCRIPTDIR%\python-3.6.8-embed-amd64;%PATH%
@set USDROOT=%SCRIPTDIR%\USD_NV
@set PATH=%USDROOT%\bin;%USDROOT%\lib;%PATH%
@rem Appended ..\USD_NV\lib\python to pth instead of
@rem set PYTHONPATH=%USDROOT%\lib\python
@rem See: python-3.6.8-embed-amd64\python36._pth
package main
import (
"flag"
"net"
"net/http"
"net/http/fcgi"
"os"
"github.com/labstack/echo/v4"
package main
import (
"flag"
"fmt"
"log"
"net"
"net/http"
"net/http/fcgi"
"os"
@todashuta
todashuta / gltf_export_name.py
Last active January 30, 2022 07:56
https://github.com/todashuta/blender-addon-gltf-export-custom-node-name/ に移行 BlenderのglTF出力で重複した名前のオブジェクト(ノード)も出力可能にする試み
import bpy
bpy.types.Object.gltf_export_name = bpy.props.StringProperty(
name="Name", default="",
description="glTF出力時のオブジェクト名(ノード名)\n空のときはオブジェクト名を使用\n他と重複してもよい")
def __gather_name(blender_object, export_settings):
#print(">>>", blender_object)
#!/bin/sh
if [ "$(tmux show-options -gv mouse)" = "off" ]; then
tmux set-option -g mouse on && echo "mouse ON"
else
tmux set-option -g mouse off && echo "mouse OFF"
fi
@todashuta
todashuta / .tmux.conf
Created October 23, 2021 15:32
minimalist tmux conf
# minimalist tmux conf
set-window-option -g mode-keys vi
#set-option -g escape-time 100
set-option -g base-index 1
set-option -g pane-base-index 1
set-option -g renumber-windows on
set-option -g status-interval 1