• 追加された行はこの色です。
  • 削除された行はこの色です。
[[SprBlender]]

* Installation [#s5c13679]

+ 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
-- from http://springhead.info/spr2/Springhead2/trunk/bin/win64/ (or win32)
-- place in "c:\Program Files\Blender Foundation\Blender\2.63\scripts\modules"



* User Inteface [#x4cc3e5d]

- About Blender : See tutorial. http://www.cgradproject.com/Blender_Tutorial/tutorial_Blender_tute_menu.html

- SprBlender UI
-- Scene panel in "3D view"
-- some tabs in "Properties"
--- "Object"
--- "Material"
--- "Scene"
-- "Text Editor"


* Solids & Shapes [#tab491fb]

- 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 [#f7a4fed1]

- Scene settings, right-side in "3D view"
-- if hidden, find "+" mark and click

- Set Scene
-- Build springhead scene-graph internally, from Blender objects

- Physics Steps Enable
-- Start Simulation

- 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"? [#cf0ec2f5]

(see figure)


* Joints & IK [#g03f8684]

- Blender object <=> ( solid & joint to parent object )
-- (see figure)

** Create Joint [#g618eeb3]

- 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 [#c495f175]

- see Springhead Document.
-- (some types of joint limits seems to have some bugs... sorry.)

** Joint Actuation [#p75ba3db]

- Spring / Damper is embedded on each joints.
-- set Spring / Damper parameters in SprJointPanel

** Joint Actuation with IK [#h086d352]

- 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 [#e514507a]

- 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 [#s1fa494b]

- "cr_0_0_Basic" script runs on each step.
-- write sensor -> action cycle here



** Advanced Scripting [#gd7c62b8]

- see SprPyBlender\scripts\modules\spr_op\creature.py





* Skin mesh & Creature [#rcda554a]

- Use parent-child relations
-- Springhead actuate parent object -> blender render related mesh