XSI ログ削除ツール

C言語で自作してみた。

クラッシュした際に下記ディレクトリに書き出されるログファイル
を一括して削除してしまおうという試み。
たぶん、クラッシュするたびにログが溜まっていくので、
HDDスペースを開けたい場合などなど。
> C:\Users\(USER_NAME)\Softimage\XSI\7.01

削除対象ファイルは以下の2つ。
1. [****].ScriptLog.txt
2. [****].dmp

※ コンパイラはMinGWを使ってます。
適当に改変して使いやすいようにしください:p

ソース
// >gcc xsi_clean.c -o xsi_clean -std=gnu99

■ Githubに置いてみた
https://github.com/mikan56/delLog

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>


int main(int argc, char **argv) {
char *base_dir;
DIR *dir;
struct dirent *dp;
char *c;

base_dir = "C:\\Users\\[xxxx]\\Softimage\\XSI_7.01";

if(NULL == (dir = opendir(base_dir))) {
printf("Can not open directory.\n->%s\n", base_dir);
scanf("%c", &c);
exit(1);
}
char tmp_str[256] = {0};
strcpy(tmp_str, base_dir);
char *d = "\\";
char *b_dir;
b_dir = strcat(tmp_str, d);
//printf("%s\n", b_dir);

char *r1;
char *r2;
for(int i = 0; NULL != (dp = readdir(dir)); ++i) {
r1 = strstr(dp->d_name, ".ScriptLog.txt");
if(r1 != NULL) {
char tmp[256] = {0};
strcpy(tmp, b_dir);
strcat(tmp, dp->d_name);
#ifdef DEVELOPMENT
if(tmp != 0) printf("remove success:%s\n", tmp);
else printf("remove failed:%s\n", i, tmp);
#else
if(remove(tmp) == 0) printf("remove success:%s\n", tmp);
else printf("remove failed:%s\n", i, tmp);
#endif
}
r2 = strstr(dp->d_name, ".dmp");
if(r2 != NULL) {
char tmp2[256] = {0};
strcpy(tmp2, b_dir);
strcat(tmp2, dp->d_name);
#ifdef DEVELOPMENT
if(tmp2 != 0) printf("remove success:%s\n", tmp2);
else printf("remove failed:%s\n", i, tmp2);
#else
if(remove(tmp2) == 0) printf("remove success:%s\n", tmp2);
else printf("remove failed:%s\n", i, tmp2);
#endif
}
}
closedir(dir);

scanf("%c", &c);
return 1;
}

Normal Map - memo

Zbrush

ZBrushでキューブを作成。
適当にコネる。
















サブディビジョンのレベルを上げる。
Normal Mapを作る前にサブディビジョンレベルを1にしておく。























ツールからNormal Map作成























ローモデルとハイモデルをobjに書き出し。

XSI

ZBrushから書き出した2つのモデルをインポート。
Ultimapperを実行する





















最終的なレンダーツリー












レンダリング結果

[XSI] PPGLayout UI Demo with Cpp

毎度コードを貼逃げ

これコマンドが実行されないのよね。。。

XSILoadPluginでコマンド、プロパティ、メニューを登録します。
(1) [PluginRegister].RegisterCommand(); // _Execute()
(2) [PluginRegister].RegisterProperty(); // _Define(), _DefineLayout(), _PPGEvent()
(3) [PluginRegister].RegisterMenu(); // _Menu_Init()

◆ソース(229行目は無視してください)
// UpdatedOpPlugin
// Initial code generated by XSI SDK Wizard
// Executed Tue Jan 3 21:53:38 UTC+0900 2012 by xxxx
// 
// Tip: You need to compile the generated code before you can load the plug-in.
// After you compile the plug-in, you can load it by clicking Update All in the Plugin Manager.
#include 
#include    // Factory
#include 
#include 
#include 
#include 
#include 
#include 
#include   // CustomProperty
#include    // Selection
#include    // Parameter
#include    // PPGLayout
#include  // PPGEventContext
using namespace XSI;

static Application app;
static Factory factory = app.GetFactory();
static CustomProperty prop(factory.CreateObject(L"CustomProperty"));

XSIPLUGINCALLBACK CStatus XSILoadPlugin( PluginRegistrar& in_reg )
{
 in_reg.PutAuthor(L"xxxx");
 in_reg.PutName(L"UpdatedOpPlugin");
 in_reg.PutEmail(L"");
 in_reg.PutURL(L"");
 in_reg.PutVersion(1,0);
 in_reg.RegisterCommand(L"UpdatedOp",L"UpdatedOp");
 in_reg.RegisterProperty(L"UpdatedOpProp");
 in_reg.RegisterMenu(siMenuTbGetPropertyID,L"UpdatedOp_Menu",false,false);
 //RegistrationInsertionPoint - do not remove this line

 return CStatus::OK;
}

XSIPLUGINCALLBACK CStatus XSIUnloadPlugin( const PluginRegistrar& in_reg )
{
 CString strPluginName;
 strPluginName = in_reg.GetName();
 Application().LogMessage(strPluginName + L" has been unloaded.",siVerboseMsg);
 return CStatus::OK;
}

XSIPLUGINCALLBACK CStatus UpdatedOp_Init( CRef& in_ctxt )
{
 app.LogMessage(L"on called for UpdatedOp_Init");
 Context ctxt( in_ctxt );
 Command oCmd;
 oCmd = ctxt.GetSource();
 oCmd.PutDescription(L"");
 oCmd.EnableReturnValue(true);

 return CStatus::OK;
}

XSIPLUGINCALLBACK CStatus UpdatedOpProp_Define(const CRef &in_ctxt) {
 Context ctxt( in_ctxt );
 //CustomProperty prop;
 Parameter oParam;
 prop = ctxt.GetSource();
 prop.AddParameter(L"numCount", CValue::siInt2, siPersistable | siAnimatable, L"", L"", 0, oParam);
 return CStatus::OK;
}

XSIPLUGINCALLBACK CStatus UpdatedOpProp_DefineLayout(const CRef &in_ctxt) {
 Context ctxt( in_ctxt );
 PPGLayout oLayout;
 PPGItem item;

 oLayout = ctxt.GetSource();
 oLayout.Clear();
 oLayout.AddGroup(L"General");
 item = oLayout.AddItem(L"numCount", L"Count", siControlNumber);
 oLayout.EndGroup();

 oLayout.AddButton(L"btn_OK", L"Done");
 return CStatus::OK;
}

XSIPLUGINCALLBACK CStatus UpdatedOp_Execute( CRef& in_ctxt )
{
 Context ctxt( in_ctxt );
 CValueArray args = ctxt.GetAttribute(L"Arguments");

 Application().LogMessage(L"UpdatedOp_Execute called",siVerboseMsg);
 // 
 // TODO: Put your command implementation here.
 prop.PutName(L"Update Op");
 Selection oSel = app.GetSelection().GetItem(0);
 app.LogMessage(oSel.GetAsText(), XSI::siInfoMsg);

 Parameter oParam;
 Parameter txtParam;
 Parameter btnParam;
 prop.AddParameter(L"Instance", CValue::siString, siReadOnly | siPersistable, L"", L"", L"Instance Here", txtParam);
 prop.AddParameter(L"Count", CValue::siInt2, siAnimatable | siPersistable | siKeyable, L"", L"", 0, oParam);
 prop.AddParameter(L"Position", CValue::siInt1, siPersistable, L"", L"", 0, btnParam);
 
 PPGLayout oLayout = prop.GetPPGLayout();
 oLayout.Clear();
 oLayout.AddGroup(L"Update Content");
 oLayout.AddItem(L"Instance", L"Target");
 oLayout.AddItem(L"Count", 0);
 oLayout.EndGroup();

 CValueArray radio(6);
 radio[0] = L"Left"; radio[1] = 0;
 radio[2] = L"Center"; radio[3] = 1;
 radio[4] = L"Right"; radio[5] = 2;
 oLayout.AddGroup(L"Position");
 oLayout.AddEnumControl(L"Position", radio, L"Change", siControlRadio);
 oLayout.EndGroup();

 oLayout.AddButton(L"done", L"");

 CValueArray wParam(5);
 wParam[0] = prop;
 wParam[1] = L"Update Op";
 wParam[2] = (LONG)siModal;
 wParam[3] = false;
 CValue ret;
 app.ExecuteCommand(L"InspectObj", wParam, ret);

 // 
 // Return a value by setting this attribute:
 ctxt.PutAttribute( L"ReturnValue", true );

 // Return CStatus::Fail if you want to raise a script error
 return CStatus::OK;
}


XSIPLUGINCALLBACK CStatus UpdatedOpProp_PPGEvent(const CRef &in_ctxt) {
 PPGEventContext ctxt(in_ctxt);
 PPGEventContext::PPGEvent eventID = ctxt.GetEventID();

 switch(eventID) {
 case (PPGEventContext::siOnInit):
  {
   //CustomProperty prop = ctxt.GetSource();
   app.LogMessage(L"OnInit called for " + prop.GetFullName());
  }
  break;
 case (PPGEventContext::siButtonClicked):
  {
   CValue btnPressed = ctxt.GetAttribute(L"Button");
   app.LogMessage(L"Button Pressed: " + btnPressed.GetAsText());
  }
  break;
 case (PPGEventContext::siTabChange):
  break;
 case (PPGEventContext::siParameterChange):
  {
   Parameter param = ctxt.GetSource();
   //CustomProperty prop = param.GetParent();
   CString name = param.GetScriptName();
   app.LogMessage(L"Parameter Changed: " + name);
  }
  break;
 case (PPGEventContext::siOnClosed):
  {
   //CustomProperty prop = ctxt.GetSource();
   app.LogMessage(L"OnClosed called for " + prop.GetFullName());
  }
  break;
 }


 return CStatus::OK;
}

XSIPLUGINCALLBACK CStatus UpdatedOp_Menu_Init( CRef& in_ctxt )
{
 Context ctxt( in_ctxt );
 Menu oMenu;
 oMenu = ctxt.GetSource();
 MenuItem oNewItem;
 //oMenu.AddCommandItem(L"UpdatedOp",L"UpdatedOp",oNewItem);
 CStatus st = oMenu.AddCallbackItem(L"UpdatedOp Sample", L"OnUpdatedOpPropClicked", oNewItem);
 return st;
}



XSIPLUGINCALLBACK CStatus OnUpdatedOpPropClicked(const CRef &) {
 // We use the AddProp command rather than the C++ API
 // because it logs in the script history and it
 // automatically takes care of different selection possibilities.
 
 Application app;
 //CustomProperty prop;

 CValueArray addpropArgs(5) ;
 addpropArgs[0] = L"UpdatedOpProp"; // Type of Property
 addpropArgs[3] = L"UpdatedOpProp"; // Name for the Property

 // At this point you might want to validate what objects
 // are selected to make sure they make sense for your
 // property

 if ( app.GetSelection().GetCount() == 0 )
 {  
  // No selection so create the object at the scene root
  addpropArgs[1] = L"Scene_Root";
 }

 CValue retVal ;
 CStatus st = app.ExecuteCommand( L"SIAddProp", addpropArgs, retVal ) ;

 if ( st.Succeeded() )
 {
  // Inspect newly created Property or Properties
  //(there could be more than one if the selection
  // contains multiple items)
  CValueArray resultArray( (CValueArray&)addpropArgs[4] );
  CValueArray inspectobjArgs(5) ;
  inspectobjArgs[0] = resultArray[0] ;
        
  app.ExecuteCommand( L"InspectObj", inspectobjArgs, retVal ) ;
 }

 return st ;
}

[XSI] Add null an object to parent from selected an object. [JScript]

選択されたオブジェクトの親にnullオブジェクトを追加します。
nullオブジェクトは選択されたオブジェクトのローカル座標と同じ座標へ配置されます。

try {
 var oRoot = ActiveProject.ActiveScene.Root;
 var oObj = Selection(0);
 var oNull = oRoot.AddNull(oObj.Name + "_null");
 var oObjLcl = oObj.Kinematics.Local;
 var x = oObjLcl.Parameters("posx").Value;
 var y = oObjLcl.Parameters("posy").Value;
 var z = oObjLcl.Parameters("posz").Value;
 var oLocalTrans = XSIMath.CreateTransform();
 oLocalTrans.SetTranslationFromValues(x, y, z);
 oNull.Kinematics.Local.Transform = oLocalTrans;
 CopyPaste(oObj, null, oNull, 1);
 SelectObj(oNull, null, null);
 ToggleVisibility(null, null, null);
 SelectObj(oObj, null, null);
} catch(err) {
 logmessage(err.message);
}

[mat5] emFluid3

Visual Effect Material

Comp5.mp4 Watch on Posterous

そろそろ変化球も身につけたい。

Posted via email from cep3d

[C4D] Tracer Test

課題:エミッターのマテリアル適用方法
   水面に当たると波紋かスプラッシュを発生させる。
※Broadcastでできるかしら:(


Particles Tracer Test from cephalos on Vimeo.

体育館モデリング2

スキマから光が漏れる...。
穴は空いてないのに~

体育館モデリング

C4Dで母校の記憶を元に体育館をちまちまモデリング中。
キャラもぼちぼちやらないとなー。

建築物はやりやすいと感じる今日この頃。
MoGraphマンセー

[C4D] Xpresso テスト

面白そうなのでやってみました。
ちまちま勉強していきます!










Zbrush練習 p1

男児のロマンを2日ほどで作ったもの。
zsketchおもしろす!

顔とかの作り方がいまいちわからないのでカオナシ状態。

XSI PPG for Cpp

うーむ、イベントよくわかんのぅ

PPGEventContext使わない?
というわけで中途半端にうp


#define READONLY (siReadOnly | siPersistable)
#define ANIMATABLE (siAnimatable | siPersistable | siKeyable)

static Application app;
static Factory factory = app.GetFactory();

... 他省略 ...

XSIPLUGINCALLBACK CStatus hoge_Execute( CRef& in_ctxt )
{
 Context ctxt( in_ctxt );
 CValueArray args = ctxt.GetAttribute(L"Arguments");

 // 
 // TODO: Put your command implementation here.
 CustomProperty oPSet = factory.CreateObject(L"CustomProperty");
 oPSet.PutName(L"hoge");
 oSel = app.GetSelection().GetItem(0);
 app.LogMessage(oSel.GetAsText());

 Parameter oParam;
 Parameter txtParam;
 Parameter btnParam;
 oPSet.AddParameter(L"Instance", CValue::siString, READONLY, L"", L"", L"instance here.", txtParam);
 oPSet.AddParameter(L"Count", CValue::siInt2, ANIMATABLE, L"", L"", 0, oParam);
 oPSet.AddParameter(L"Position", CValue::siInt1, siPersistable, L"", L"", 0, btnParam);

 PPGLayout oLayout = oPSet.GetPPGLayout();

 oLayout.Clear();
 oLayout.AddGroup(L"Duplicate");
 oLayout.AddItem(L"Instance", L"Target");
 oLayout.AddItem(L"Count", 0);
 oLayout.EndGroup();

 CValueArray radio(6);
 radio[0] = L"Left"; radio[1] = 0;
 radio[2] = L"Center"; radio[3] = 1;
 radio[4] = L"Right"; radio[5] = 2;
 oLayout.AddGroup(L"Position");
 oLayout.AddEnumControl(L"Position", radio, L"Change", siControlRadio);
 oLayout.EndGroup();

 // Logic
 oLayout.PutLanguage(L"JScript");
 oLayout.PutLogic(L"LogMessage(\"test\");");

 CValueArray wParam(5);
 wParam[0] = oPSet;
 wParam[1] = L"Duplicate Item";
 wParam[2] = (LONG)siRecycle;
 wParam[3] = false;
 CValue retval;
 app.ExecuteCommand(L"InspectObj", wParam, retval);

 // 
 // Return a value by setting this attribute:
 ctxt.PutAttribute( L"ReturnValue", true );

 // Return CStatus::Fail if you want to raise a script error
 return CStatus::OK;
}

XSI JScript - Get FCurve

アニメートされたオブジェクトからFカーブを取得するだけのもの

オブジェクトが選択されてない場合、ピックさせるようにする処理を追加

var HogeFCurve = function() { this.init(); }

/////////////////////////////////////////////////////////
// initialize class
/////////////////////////////////////////////////////////
HogeFCurve.prototype.init = function() {
 this.oPSet = XSIFactory.CreateObject("CustomProperty");
 this.oPSet.Name = "Test FCurve Param";
 this.oSel = Application.Selection(0);
 this.oParam = this.oPSet.AddFCurveParameter("TestFCurve");
 this.oFc = this.oParam.Value;
 this.oKey = this.oFc.Keys;
 try {
  this._checkSelection();
  var fcx = this.oSel.posx.Source;
  var fcy = this.oSel.posy.Source;
  var fcz = this.oSel.posz.Source;
  
  var datax = this.GetFCurveFromSource(fcx);
  var datay = this.GetFCurveFromSource(fcy);
  var dataz = this.GetFCurveFromSource(fcz);
  
  this.oFc.SetKeys(datax);
  
  LogMessage("x = " + datax + ", y = " + datay + ", z = " + dataz);
  
  //this.printInfo(fcx);
  //this.printInfo(fcy);
  //this.printInfo(fcz);
 } catch(err) {
  LogMessage(err.message);
  return false;
 }
}

HogeFCurve.prototype._checkSelection = function() {
 if(ClassName(this.oSel) != "X3DObject") {
  var oPick = PickObject("Select Object");
  var oRet = oPick.Value("ButtonPressed");
  LogMessage("Result = " + oRet);
  if(oRet) this.oSel = oPick.Value("PickedElement");
 }
 if(!this.oSel.IsClassOf(siX3DObjectID)) throw "Select or Pick Object.";
}

/////////////////////////////////////////////////////////
// show PPG
/////////////////////////////////////////////////////////
HogeFCurve.prototype.show = function() {
 try {
  this._checkSelection();
  InspectObj(this.oPSet, null, "", siRecycle, false);
 } catch(err) {
  LogMessage(err.message);
 }
 return this;
}

/////////////////////////////////////////////////////////
// 
// @param in_fc Parameter - Source property of KinematicState
// @return Array - 
/////////////////////////////////////////////////////////
HogeFCurve.prototype.GetFCurveFromSource = function(in_fc) {
 if(ClassName(in_fc) != "FCurve") throw "You passed me an a(n) " + ClassName(in_fc) + "istead of an FCurve.";
 data = []
 fckeys = in_fc.Keys;
 for(var i = 0, j = 0, k = 1; i < fckeys.Count; ++i, j+=2, k+=2) {
  data[j] = fckeys(i).Time;
  data[k] = fckeys(i).Value;
 }
 return data;
}

HogeFCurve.prototype.printInfo = function(in_fc) {
 if(ClassName(in_fc) != "FCurve") throw "You passed me an a(n) " + ClassName(in_fc) + "istead of an FCurve.";
 LogMessage("FCurve for parameter:" + in_fc.Parent);
 LogMessage("Number of keys:" + in_fc.GetNumKeys());
 LogMessage("Is the FCurve begin editing? ..." + in_fc.IsEditing());
 
 data = []
 fckeys = in_fc.Keys;
 for(var i = 0; i < fckeys.Count; ++i) {
  data[i] = fckeys(i).Value;
  LogMessage("Key[" + i + "] set at frame " + fckeys(i).Time + " = " + fckeys(i).Value);
 }
 LogMessage("data = " + data)
}

/////////////////////////////////////////////////////////
// Get current frame of scene.
// @return Double - current frame number.
/////////////////////////////////////////////////////////
HogeFCurve.prototype.currentFrame = function() {
 var remote = Dictionary.GetObject("PlayControl");
 var cur = remote.Parameters("Current");
 return cur.Value;
}

HogeFCurve.prototype.play = function(in_start, in_loop) {
 var is_start = in_start || false;
 var is_loop = in_loop || false;
 if(is_start) PlayForwardsFromStart();
 else PlayForwards();
 if(is_loop) SetValue("PlayControl.Loop", true, null);
 else SetValue("PlayControl.Loop", false, null);
 return this;
}

new HogeFCurve().show().play();

Softimage 7 - ICE

追記:シーン開き直したらアニメーションが外れたw これはダメってか

回してみた

初期化のツリーはvimeo.comを参考にしました。














iOS 4 - test

なぜかiOS弄ってます。
stringとか悩ましいですわ




どちらかってともでもでしたいですがねw

Model, UV, and Texture a Complete Anime Character in Blender

CgTuts+

参考に。
Blenderでキャラクター作成。
とりあえず、貼っておく。

body topology

ボディのトポロジを晒してみます。
まだ手と足と顔とかいろいろ残ってますw
Posted by Picasa

Softimage: Customize tool bar

update on 2010.3.10
ダイキンさんのところが参考になります。

カスタムツールバーを整理したい。

左図のようにラベル付きのセパレータをつけてみる。
※ラベルなしできるのかな?面倒くさいので試してませんw
スクリプトベースでやります。










  • 1. 新規ツールバー作成
    [View] -> [New Custom Tool Bar...]

  • 2. 登録する外部スクリプトを1.で作成したツールバーへドラッグドロップ。
    入力項目がいろいろでますが、とりあえずOKを押してツールバーへ登録します。
    [Ctrl + S]で名前を決めて保存します。

  • 3. xsitbファイルの確認
    下記ディレクトリ内に、保存されたファイルが格納されていると思います。
    C:\(User Name)\Softimage\(XSI_VERSION)\Application\toolbars


  • 4. xsitbファイルの編集
    2.で保存したファイル名をテキストエディタ等で開きます。
    中身はXML形式で記述されています。
    下記ノードを探します。

    <item type="script" name="****" cmdid="{****}"></item>
    そして、以下の一行を追加することでセパレータが表示されます。

    <item type="separator" mode="group_header" group_name=""></item>
    <item type="script" name="****" cmdid="{****}"></item>