SprBlender
Installation
- Download & Install Blender (newer than 2.5)
- Download SprBlender
- SVN Checkout : svn+ssh://springhead.info/home/svn/lab/Experiments/trunk/SprPyBlender
- (please rewrite "springhead.info" according to your PuTTY settings)
- copy "SprPyBlender\scripts\modules\spr_op" to "c:\Program Files\Blender Foundation\Blender\2.63\scripts\modules\spr_op"
- Get Spr.pyd
User Inteface
- SprBlender UI
- Scene panel in "3D view"
- some tabs in "Properties"
- "Object"
- "Material"
- "Scene"
- "Text Editor"
Solids & Shapes
- SprObjectPanel, in "Object" tab
- Set Dynamical
- or Static (= fixed objects). (e.g. Floor)
- specify Shape -> added as simulated entity
- i.e. You can't create solid WITHOUT any shape
- Real-time Editing
- if Available (green check-marked parameters)
- if Enabled : changes is applied in real time (while simulation)
- if Disabled : push "Apply Parameters"
- Otherwise
- push "Set Scene" or "Set Objects" to apply
- Object with Complex shape
- -> Multiple blender-objects to construct One Solid
- "Object" tab, "Relations" panel
- base object as parent, additional shape objects as child
- set shape type "Convex" for Child object (in SprObjectPanel)
- enable "Compound Child" check
Execute Simulation
- Scene settings, right-side in "3D view"
- if hidden, find "+" mark and click
- Set Scene
- Build springhead scene-graph internally, from Blender objects
- Set Objects
- Apply changes on selected blender objects, into springhead scene
- "Scene" tab in "Properties"
- also has some settings on simulation
What's "Set Scene" or "Set Objects"?
(see figure)
Joints & IK
- Blender object <=> ( solid & joint to parent object )
Create Joint
- SprJointPanel
- Select Joint Child Object
- Set Joint Type
- some joint types : see Springhead Document.
- Set Joint Target : Joint will be connected to this object
- Plug Handle Mode
- Edit position of joint
- push "Apply" after edit
Joint Limit
- see Springhead Document.
- (some types of joint limits seems to have some bugs... sorry.)
Joint Actuation
- Spring / Damper is embedded on each joints.
- set Spring / Damper parameters in SprJointPanel
Joint Actuation with IK
- for Arm-like objects
- Goal position/orientation of end-point object is given
- Arm objects will automatically controlled
- for each arm object
- SprIKPanel : check "IK Enabled"
- for each end-point object
- SprIKPanel : check "IK EndEffector"
- to see how it works
- in Spr IK Control Panel
- Enable "IK Real-time Control"
- Check "Enable Target Object"
- Set target object name
- Joint Parameters
- IK use "joint damper" for actuation
- set large value as damper for arm joints
Creature
- if the object is a part of creature body :
- check "Creature Body" in SprCreaturePanel
- to use default scripts : set Labels as follows
- Head Object : CRIKSolid label "Head", CRIKJoint label "Neck"
- Hand Object : CRIKSolid label "RightHand", CRIKJoint label "RightElbow" (or Left)
- Waist Object : CRIKSolid label "Waist", CRIKJoint label "Waist"
- Base Object : CRIKSolid label "Base", CRIKJoint label "None"
- check "Creature Core" for "Base" object
- in "Text editor" : add text with name "cr_0_0_Basic"
- type followings
#cr_0_0_Basic
#This is Basic Rule for cr_0
#To Use Multi Rules, Create Rule-Name-List as "cr_0_rules"
#------------------------------
#Rule Properties
p = [1,1,1,1,1,1]
import bpy
if "Base" in bpy.data.objects:
p[0] = bpy.data.objects["Base"].spr_creature_rule_parameter_0
p[1] = bpy.data.objects["Base"].spr_creature_rule_parameter_0
p[2] = bpy.data.objects["Base"].spr_creature_rule_parameter_0
p[3] = bpy.data.objects["Base"].spr_creature_rule_parameter_0
p[4] = bpy.data.objects["Base"].spr_creature_rule_parameter_0
p[5] = bpy.data.objects["Base"].spr_creature_rule_parameter_0
#------------------------------
currentModel = self.models["current"]
maxAttvSo = currentModel.maxAttvSo
maxAtttSo = currentModel.maxAtttSo
maxAttSo = currentModel.maxAttSo
if maxAttSo:
self.HeadController.LookAt(maxAttSo.phSolid.GetFramePosition(),Spr.Vec3d(),1)
#self.LeftHand.SetTargetPos(maxAttSo.phSolid.GetFramePosition())
#self.RightHand.SetTargetPos(maxAttSo.phSolid.GetFramePosition())
#self.LeftHand.Start()
#self.RightHand.Start()
- Start Simulation (in Spr Operator Panel)
- Enable IK
- Enable Creature
- Physics Step Enable
Scripting
- "cr_0_0_Basic" script runs on each step.
- write sensor -> action cycle here
Advanced Scripting
- see SprPyBlender\scripts\modules\spr_op\creature.py
Skin mesh & Creature
- Use parent-child relations
- Springhead actuate parent object -> blender render related mesh