Skip to content

Instantly share code, notes, and snippets.

@dskjal
dskjal / make_normal.py
Last active February 18, 2018 05:21
Create a normal texture from in Blender image.
# ##### 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
@dskjal
dskjal / blender_duplicate_spirally.py
Last active February 14, 2018 16:26 — forked from jabe0958/blender_duplicate_spirally.py
Blenderで対象のメッシュを螺旋状に複製して統合するPythonスクリプト
import bpy
import math
src_name = 'Cube'
loop = 10
split = 32
width_init = 1
width_incr = 0.01
height_init = 0
height_loop = 0.8
@dskjal
dskjal / gif2jpg.cs
Last active November 26, 2017 07:49
アニメーションGIFをjpgに変換するC#プログラム
// BEGIN MIT LICENSE BLOCK //
//
// Copyright (c) 2017 dskjal
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
//
// END MIT LICENSE BLOCK //
/*
* 使い方
* GIF2JPG gifのファイルパス 出力ディレクトリ(option) ファイルフォーマット(option)
@dskjal
dskjal / RubyText.cs
Last active January 15, 2018 06:54
Unity の uGUI を使ってルビを配置する
// BEGIN MIT LICENSE BLOCK //
//
// Copyright (c) 2017 dskjal
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
//
// END MIT LICENSE BLOCK //
/*
* *注意*
* 改行の処理はしてない.ルビを必要とする部分が途中で改行されないよう処理する必要がある.
@dskjal
dskjal / CSVLoader.cs
Last active October 24, 2017 04:23
Unity で CSV をロードするスクリプト
// BEGIN MIT LICENSE BLOCK //
//
// Copyright (c) 2016 dskjal
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
//
// END MIT LICENSE BLOCK //
// ******************************使い方*************************************
// csv のロード(Resources/test.csv を読み込む場合)
@dskjal
dskjal / ikfk_snap_easy.py
Last active October 26, 2021 21:47
Blender で IK/FK スナップスクリプト簡易版
# ##### 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
@dskjal
dskjal / share_variables.py
Last active June 7, 2021 12:48
Blender で変数の共有
import bpy
# UI クラスで変数を定義
class UI(bpy.types.Panel):
bl_label = "test"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_category = "Tools"
#プロパティ
@dskjal
dskjal / keyframe_bone.py
Last active April 16, 2022 13:39
Blender でスクリプトからボーンにキーフレームを打つ
#ボーンを選択していなくてもできる
bpy.context.active_object.pose.bones['hand.ik.L'].keyframe_insert(data_path='location',group='hand.ik.L')
#ボーンを選択して以下のコマンドでも可能(ただし遅い)
bpy.ops.anim.keyframe_insert_menu(type='LocRotScale')
#ボーンを選択
bpy.ops.pose.select_all(action="DESELECT")
bpy.context.active_object.data.bones['hand.ik.L'].select = True
#ボーンに設定されたプロパティにキーを打つ
@dskjal
dskjal / remove_modifier.py
Last active March 27, 2018 07:14
不要なモディフィアを削除するスクリプト
import bpy
#アクティブなアーマチュアのすべてが対象
for bone in bpy.context.active_object.pose.bones:
for c in bone.constraints:
#Constraint の名前で削除
if c.name == 'Limit Location':
bone.constraints.remove(c)
break
#Constraint の型で削除
@dskjal
dskjal / generate.py
Last active December 25, 2016 07:43
Rigify show additional layer in picker
''' old code
# Create list of layer name/row pairs
layer_layout = []
for l in metarig.data.rigify_layers:
print( l.name )
layer_layout += [(l.name, l.row)]
end old code'''
# new code
# Create list of layer name/row pairs