Value* IsPerspView_cf(Value** arg_list, int count) { check_arg_count(IsPerspView, 0, count); Value* ret = MAXScript_interface->GetActiveViewExp().IsPerspView() ? &true_value : &false_value; return ret; }
Value* wm3_CreateMarker_cf(Value** arg_list, int count) { check_arg_count(wm3_CreateMarker_cf, 3, count); type_check(arg_list[0], MAXModifier, _T("wm3_CreateMarker [Morpher Modifier] [Morph Index] [Marker Name]")); type_check(arg_list[1], Integer, _T("wm3_CreateMarker [Morpher Modifier] [Morph Index] [Marker Name]")); type_check(arg_list[2], String, _T("wm3_CreateMarker [Morpher Modifier] [Morph Index] [Marker Name]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int sel = arg_list[1]->to_int(); sel -= 1; const TCHAR *name = arg_list[2]->to_string(); if (sel >= 0) { #pragma warning (push) #pragma warning (disable: 4996) IMorphClass imp; imp.HoldMarkers(mp); #pragma warning (pop) mp->markerName.AddName(name); mp->markerIndex.Append(1,&sel,0); mp->Update_channelMarkers(); return &true_value; } return &false_value; }
/*===========================================================================*\ | This swaps the position of 2 morphs in the channel list | \*===========================================================================*/ Value* wm3_MoveMorph_cf(Value** arg_list, int count) { check_arg_count(wm3_MoveMorph_cf, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_MoveMorph [Morpher Modifier] [Morph Source Index] [Morph Destination Index]")); type_check(arg_list[1], Integer, _T("WM3_MoveMorph [Morpher Modifier] [Morph Source Index] [Morph Destination Index]")); type_check(arg_list[2], Integer, _T("WM3_MoveMorph [Morpher Modifier] [Morph Source Index] [Morph Destination Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int morphIndexA = arg_list[2]->to_int(); morphIndexA--; if(morphIndexA>=100) morphIndexA = 99; if(morphIndexA<0) morphIndexA = 0; int morphIndexB = arg_list[1]->to_int(); morphIndexB--; if(morphIndexB>=100) morphIndexB = 99; if(morphIndexB<0) morphIndexB = 0; MaxMorphModifier maxMorpher(mp); bool res = maxMorpher.MoveMorphChannel(morphIndexA, morphIndexB); maxMorpher.RefreshChannelsUI(); return (res ? &true_value : &false_value); }
// python.import function: import a python module to maxscript Value* import_cf( Value** arg_list, int count ) { // Step 1: make sure the arguments supplied are correct check_arg_count( python.import, 1, count ); // Step 2: protect the maxscript memory MXS_PROTECT( two_value_locals( mxs_check, mxs_return ) ); // Step 3: convert the maxscript value MXS_EVAL( arg_list[0], vl.mxs_check ); // Step 4: calculate the python module name to import const MCHAR* module_name = NULL; try { module_name = vl.mxs_check->to_string(); } MXS_CATCHERRORS(); // Step 5: import the module if ( module_name ) { MCharToPyString pys(module_name); if( pys.pyString() ) { PyObject* module = PyImport_Import( pys.pyString() ); vl.mxs_return = ( module ) ? ObjectWrapper::intern( module ) : &undefined; } PY_ERROR_PROPAGATE_MXS_CLEANUP(); } else { mprintf( _T("python.import() error: importing modules must be done with a string value\n") ); vl.mxs_return = &undefined; } MXS_RETURN( vl.mxs_return ); }
/*===========================================================================*\ | Returns the the progressive morph Node | \*===========================================================================*/ Value* wm3_GetProgressiveMorphNode_cf(Value** arg_list, int count) { check_arg_count(wm3_GetProgressiveMorphNode_cf, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_GetProgressiveMorphNode [Morpher Modifier] [Morph Index] [Progressive Morph Index]")); type_check(arg_list[1], Integer, _T("WM3_GetProgressiveMorphNode [Morpher Modifier] [Morph Index] [Progressive Morph Index]")); type_check(arg_list[2], Integer, _T("WM3_GetProgressiveMorphNode [Morpher Modifier] [Morph Index] [Progressive Morph Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int morphIndex = arg_list[1]->to_int(); morphIndex--; if(morphIndex>=100) morphIndex = 99; if(morphIndex<0) morphIndex = 0; int pMorphIndex = arg_list[2]->to_int(); pMorphIndex--; MaxMorphModifier maxMorpher(mp); INode *node = maxMorpher.GetMorphChannel(morphIndex).GetProgressiveMorphTarget(pMorphIndex); if (node != NULL) { return MAXNode::intern(node); } return &undefined; }
static void st_collection_page_items_item_style(void) { check_arg_count(1); current_item->style = parse_str(0); }
static void st_collection_page_items_item_bool_default(void) { check_arg_count(1); current_item->spec.b.def = parse_bool(0); }
static void st_collection_page_items_item_date_min(void) { check_min_arg_count(1); if (params_min_check(1)) { check_arg_count(3); current_item->spec.d.min.y = parse_int_range(0, 1900, 10000); current_item->spec.d.min.m = parse_int_range(1, 1, 12); current_item->spec.d.min.d = parse_int_range(2, 1, 31); } else { const char *date = parse_str(0); if (!strcasecmp(date, "today")) { time_t t = time(NULL); struct tm *lt = localtime(&t); current_item->spec.d.min.y = lt->tm_year + 1900; current_item->spec.d.min.m = lt->tm_mon + 1; current_item->spec.d.min.d = lt->tm_mday; } free((void *)date); } }
static void st_collection_page_items_item_string_placeholder(void) { check_arg_count(1); current_item->spec.s.placeholder = parse_str(0); }
static void st_collection_page_items_item_int_max(void) { check_arg_count(1); current_item->spec.i.max = parse_int(0); }
static void st_collection_page_items_item_float_min(void) { check_arg_count(1); current_item->spec.f.min = parse_float(0); }
Value* wRect_cf(Value** arg_list, int count) { check_arg_count(wRect, 2, count); Box2 &rect = arg_list[0]->to_box2(); Point3 color = arg_list[1]->to_point3()/255.f; GraphicsWindow *gw = MAXScript_interface->GetActiveViewExp().getGW(); if (MaxSDK::Graphics::IsRetainedModeEnabled() && gw->querySupport(GW_SPT_NUM_LIGHTS) == 0) { return &undefined; } Point3* col = NULL; // new Point3[2]; IPoint3* pts = new IPoint3[2]; // col[0]=col[1]=color; pts[0]=IPoint3((int)(rect.left),0.f,0.f); pts[1]=IPoint3((int)(rect.right),0.f,0.f); gw->setColor(LINE_COLOR, color); for (int j = rect.top; j <= rect.bottom; j++) { pts[0].y=pts[1].y=j; gw->wPolyline(2, pts, col, FALSE, NULL); } delete [] pts; // delete [] col; return &ok; }
Value* getWinSizeY_cf(Value** arg_list, int count) { check_arg_count(getWinSizeY, 0, count); int sizeY = MAXScript_interface->GetActiveViewExp().getGW()->getWinSizeY(); return Integer::intern(sizeY); }
Value* GetFocalDist_cf(Value** arg_list, int count) { check_arg_count(GetFocalDist, 0, count); float ret = MAXScript_interface->GetActiveViewExp().GetFocalDist(); return Float::intern(ret); }
static void st_collection_page_items_item_persistent(void) { check_arg_count(1); current_item->persistent = parse_bool(0); }
static void st_collection_page_items_item_string_default(void) { check_arg_count(1); current_item->spec.s.def = parse_str(0); }
static void st_collection_page_items_item_visible(void) { check_arg_count(1); current_item->visible = parse_bool(0); }
static void st_collection_page_items_item_string_min(void) { check_arg_count(1); current_item->spec.s.length.min = parse_int(0); }
static void st_collection_page_items_item_widget(void) { check_arg_count(1); current_item->widget = parse_str(0); }
static void st_collection_page_version(void) { check_arg_count(1); current_page->version = parse_int(0); }
// python.exec function: execute a python command through a maxscript string Value* exec_cf( Value** arg_list, int count ) { // Step 1: make sure the arguments supplied are correct in count check_arg_count( python.exec, 1, count ); // Step 2: protect the maxscript memory MXS_PROTECT(one_value_local(mxs_command)); MXS_EVAL( arg_list[0], vl.mxs_command ); // Step 2: create a python file based on the filename const MCHAR* command = NULL; try { command = vl.mxs_command->to_string(); } MXS_CATCHERRORS(); // Step 3: check to make sure the command is valid if ( !command ) { MXS_CLEANUP(); return &false_value; } { MCharToPyString ascii(command); if( ascii.pyString() ) PyRun_SimpleString( ascii.data() ); PY_ERROR_PROPAGATE_MXS_CLEANUP(); } // Step 5: cleanup the memory MXS_CLEANUP(); return &ok; }
static void st_collection_page_subtitle(void) { check_arg_count(1); current_page->sub_title = parse_str(0); }
/*===========================================================================*\ | Sets the the progressive morph tension | \*===========================================================================*/ Value* wm3_SetProgressiveMorphTension_cf(Value** arg_list, int count) { check_arg_count(wm3_SetProgressiveMorphTension_cf, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_SetProgressiveMorphTension [Morpher Modifier] [Morph Index] [Tension]")); type_check(arg_list[1], Integer, _T("WM3_SetProgressiveMorphTension [Morpher Modifier] [Morph Index] [Tension]")); type_check(arg_list[2], Float, _T("WM3_SetProgressiveMorphTension [Morpher Modifier] [Morph Index] [Tension]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int morphIndex = arg_list[1]->to_int(); morphIndex--; if(morphIndex>=100) morphIndex = 99; if(morphIndex<0) morphIndex = 0; float tension = arg_list[2]->to_float(); INode *node = NULL; MaxMorphModifier maxMorpher(mp); bool res = maxMorpher.GetMorphChannel(morphIndex).SetProgressiveMorphTension(tension); mp->Update_channelParams(); return (res ? &true_value : &false_value); }
static void st_collection_page_icon(void) { check_arg_count(1); current_page->icon = parse_str(0); }
/*===========================================================================*\ | Deletes a progressives Morph | \*===========================================================================*/ Value* wm3_DeleteProgressiveMorphNode_cf(Value** arg_list, int count) { check_arg_count(wm3_DeleteProgressiveMorphNode, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_DeleteProgressiveMorphNode [Morpher Modifier] [Morph Index] [Progressive Morph Index]")); type_check(arg_list[1], Integer, _T("WM3_DeleteProgressiveMorphNode [Morpher Modifier] [Morph Index] [Progressive Morph Index]")) type_check(arg_list[2], Integer, _T("WM3_DeleteProgressiveMorphNode [Morpher Modifier] [Morph Index] [Progressive Morph Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int morphIndex = arg_list[1]->to_int(); morphIndex--; if(morphIndex>=100) morphIndex = 99; if(morphIndex<0) morphIndex = 0; int pMorphIndex = arg_list[2]->to_int(); pMorphIndex--; MaxMorphModifier maxMorpher(mp); bool res = maxMorpher.GetMorphChannel(morphIndex).DeleteProgressiveMorphTarget(pMorphIndex); return (res ? &true_value : &false_value); }
static void st_collection_page_autosave(void) { check_arg_count(1); current_page->autosave = parse_bool(0); }
Value* wm3_DeleteMarker_cf(Value** arg_list, int count) { check_arg_count(wm3_DeleteMarker_cf, 2, count); type_check(arg_list[0], MAXModifier, _T("wm3_DeletMarker [Morpher Modifier] [Morph Index]")); type_check(arg_list[1], Integer, _T("wm3_DeletMarker [Morpher Modifier] [Morph Index]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); int sel = arg_list[1]->to_int(); sel -= 1; if ( (sel >= 0) && (sel < mp->markerName.Count())) { #pragma warning (push) #pragma warning (disable: 4996) IMorphClass imp; imp.HoldMarkers(mp); #pragma warning (pop) mp->markerName.Delete(sel,1); mp->markerIndex.Delete(sel,1); mp->Update_channelMarkers(); return &true_value; } return &false_value; }
static void st_collection_page_items_item_label(void) { check_arg_count(1); current_item->label = parse_str(0); }
Value* wm3_mc_settarget_cf(Value** arg_list, int count) { check_arg_count(wm3_mc_settarget, 3, count); type_check(arg_list[0], MAXModifier, _T("WM3_MC_SetTarget [Morpher Modifier] [Channel Index] [Node]")); type_check(arg_list[1], Integer, _T("WM3_MC_SetTarget [Morpher Modifier] [Channel Index] [Node]")); type_check(arg_list[2], MAXNode, _T("WM3_MC_SetTarget [Morpher Modifier] [Channel Index] [Node]")); ReferenceTarget* obj = arg_list[0]->to_modifier(); if( !check_ValidMorpher(obj,arg_list) ) return &false_value; int sel = arg_list[1]->to_int(); sel -= 1; if(sel>=100) sel = 99; if(sel<0) sel = 0; MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier(); INode *node = NULL; node = arg_list[2]->to_node(); if (node == NULL) return &false_value; MaxMorphModifier maxMorpher(mp); MaxMorphChannel maxMorphChannel = maxMorpher.GetMorphChannel(sel); if (NULL != maxMorphChannel.GetMorphTarget()) return &false_value; if (maxMorphChannel.SetMorphTarget(node, MAXScript_time())) { return &true_value; } return &false_value; }
Value* NonScalingObjectSize_cf(Value** arg_list, int count) { check_arg_count(NonScalingObjectSize, 0, count); float ret = MAXScript_interface->GetActiveViewExp().NonScalingObjectSize(); return Float::intern(ret); }