Example #1
0
/*===========================================================================*\
 |	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);
}
Example #2
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);
}
Example #3
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;
}
Example #4
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;
}
Example #5
0
/*===========================================================================*\
 |	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;
}
Example #6
0
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;
}
Example #7
0
static SExp subr_get_raw_value(int s, int argnum) {
	SExp buf = vm_stack_ref(s, 0);
	SFixnum ofs = S2FIXNUM(type_check(vm_stack_ref(s, 1), &TFixnum));
	SExp type = type_check(vm_stack_ref(s, 2), &TSymbol);
	char* ptr;
	if (s2ptr((char*)&ptr, buf) == NULL) {
		return error("Illegal type");
	} else {
		if (eq(type, intern("int"))) {
			return fixnum2s(*(int*)(ptr + ofs));
		} else if (eq(type, intern("int32"))) {
			return fixnum2s(*(int*)(ptr + ofs));
		} else if (eq(type, intern("int16"))) {
			return fixnum2s(*(short*)(ptr + ofs));
		} else if (eq(type, intern("int8"))) {
			return fixnum2s(*(char*)(ptr + ofs));
		} else if (eq(type, intern("uint32"))) {
			return fixnum2s(*(unsigned int*)(ptr + ofs));
		} else if (eq(type, intern("uint16"))) {
			return fixnum2s(*(unsigned short*)(ptr + ofs));
		} else if (eq(type, intern("uint8"))) {
			return fixnum2s(*(unsigned char*)(ptr + ofs));
		} else {
			return error("Illegal type");
		}
	}
}
Example #8
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);
}
Example #9
0
static SExp subr_make_c_function(int s, int argnum) {
	SExp ret_type = type_check(vm_stack_ref(s, 0), &TSymbol);
	SExp sproc = type_check(vm_stack_ref(s, 1), &TCPtr);
	SExp arg_types = vm_stack_ref(s, 2);
	void* proc = ((CPtr*)S2PTR(sproc))->ptr;

	return make_cfunc(proc, ret_type, arg_types);
}
Example #10
0
/*===========================================================================*\
 |	Returns the the  progressive morph weight
 |  
\*===========================================================================*/
Value*
wm3_SetProgressiveMorphWeight_cf(Value** arg_list, int count)
{
	check_arg_count(WM3_SetProgressiveMorphWeight_cf, 4, count);
	type_check(arg_list[0], MAXModifier, _T("WM3_SetProgressiveMorphWeight [Morpher Modifier] [Morph Index] [Progressive Node] [Weight]"));
	type_check(arg_list[1], Integer, _T("WM3_SetProgressiveMorphWeight [Morpher Modifier] [Morph Index]  [Progressive Node] [Weight]"));
	type_check(arg_list[2], MAXNode, _T("WM3_SetProgressiveMorphWeight [Morpher Modifier] [Morph Index]  [Progressive Node] [Weight]"));
	type_check(arg_list[3], Float, _T("WM3_SetProgressiveMorphWeight [Morpher Modifier] [Morph Index]  [Progressive Node] [Weight]"));

	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;

	INode *node = NULL;	
	node = arg_list[2]->to_node(); 

	float weight = arg_list[3]->to_float(); 

	if (node == NULL) return &false_value;
	
	MaxMorphModifier maxMorpher(mp);
	int pMorphCount = maxMorpher.GetMorphChannel(morphIndex).NumProgressiveMorphTargets();	

	int pMorphIndex = -1;
	if (node == (INode*)mp->GetReference(101+morphIndex))
	{
		pMorphIndex = 0;
	}
	else
	{
		for (int i = 1; i < (pMorphCount); i++)
		{
			int refnum = 200+i+morphIndex*MAX_PROGRESSIVE_TARGETS;
			if (node == (INode*)mp->GetReference(refnum))
			{
				pMorphIndex = i ;
				break;
			}
		}
	}

	bool res = maxMorpher.GetMorphChannel(morphIndex).SetProgressiveMorphWeight(pMorphIndex, weight);
	if (res)	
	{
		mp->Update_channelFULL();
		mp->Update_channelParams();
	}
	return (res ? &true_value : &false_value);
}
Example #11
0
static SExp subr_get_proc_adr(int s, int argnum) {
	SExp h = type_check(vm_stack_ref(s, 0), &TCPtr);
	SExp proc_name = type_check(vm_stack_ref(s, 1), &TString);
	HDLL_MODULE hDll = (HDLL_MODULE)((CPtr*)S2PTR(h))->ptr;
	void* proc_adr = get_proc_adr(hDll, S2CSTR(proc_name));
	if (proc_adr == NULL) {
		return sFALSE;
	} else {
		return gen_cptr(proc_adr);
	}
}
Example #12
0
File: terms.c Project: danr/jbofihe
/*}}}*/
static void process_subsentence(TreeNode *ss, TermVector *pre, TermVector *post)/*{{{*/
{
  struct nonterm *nt, *ntc;
  int nc;
  TreeNode *sss;
  TreeNode *c;
  TermVector head_terms, new_pre;
  TreeNode *terms, *btail;

  sss = ss;
  do {
    type_check(ss, SUBSENTENCE);

    nt = &sss->data.nonterm;
    nc = nt->nchildren;

    if (nc == 2) {
      /* Pick the 'subsentence' following the 'prenex' out of the 2 child version */
      sss = child_ref(sss, 1);
    } else {
      /* Pick 'sentence' out of the 1 child version */
      sss = child_ref(sss, 0);
    }
  } while (nc == 2);

  type_check(sss, SENTENCE);
  nt = &sss->data.nonterm;

  if (nt->nchildren == 1) {
    c = nt->children[0];
    if (c->type == N_NONTERM) {
      ntc = & c->data.nonterm;
      if ((ntc->type == NO_CU_SENTENCE) || (ntc->type == OBSERVATIVE_SENTENCE)) {
        sss = c;
        nt = ntc;
      }
    }
  }

  /* Now looking at the '[terms [CU #]] bridi_tail' node. */
  terms = find_nth_child(sss, 1, TERMS);
  btail = find_nth_child(sss, 1, BRIDI_TAIL);
  assert(btail); /* Every sentence has one of these! */

  if (terms) {
    tv_build(&head_terms, terms);
    tv_catenate(pre, &head_terms, &new_pre);
    process_bridi_tail(btail, &new_pre, post);
  } else {
    process_bridi_tail(btail, pre, post);
  }
}
Example #13
0
/*===========================================================================*\
 |	Returns the the  progressive morph weight
 |  
\*===========================================================================*/
Value*
wm3_GetProgressiveMorphWeight_cf(Value** arg_list, int count)
{
	check_arg_count(wm3_GetProgressiveMorphWeight_cf, 3, count);
	type_check(arg_list[0], MAXModifier, _T("WM3_GetProgressiveMorphWeight [Morpher Modifier] [Morph Index] [Progressive Node]"));
	type_check(arg_list[1], Integer, _T("WM3_GetProgressiveMorphWeight [Morpher Modifier] [Morph Index]  [Progressive Node]"));
	type_check(arg_list[2], MAXNode, _T("WM3_GetProgressiveMorphWeight [Morpher Modifier] [Morph Index]  [Progressive Node]"));

	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;

	INode *node = NULL;	
	node = arg_list[2]->to_node(); 

	float weight = 0.0f;

	if (node == NULL) return Float::intern(weight);	
	
	MaxMorphModifier maxMorpher(mp);
	int pMorphCount = maxMorpher.GetMorphChannel(morphIndex).NumMaxProgressiveTargets();		
		
	int pMorphIndex = -1;
	if (node == (INode*)mp->GetReference(101+morphIndex))
	{
		pMorphIndex = 0;
	}
	else
	{
		for (int i = 1; i < (pMorphCount); i++)
		{
			int refnum = 200+i+morphIndex*MAX_PROGRESSIVE_TARGETS;
			if (node == (INode*)mp->GetReference(refnum))
			{
					pMorphIndex = i ;
					break;
			}
		}
	}
	weight = maxMorpher.GetMorphChannel(morphIndex).GetProgressiveMorphWeight(pMorphIndex);
	return Float::intern(weight);	
}
Example #14
0
Value* ExportCalSkel_cf(Value** arg_list, int count)
{	
	int			i;
	INodeTab	tabnode;
	std::tstring fullpathfilename;
	int			ArraySize		;
	bool		bShowUI			;

	check_arg_count(ExportCalSkel, 3, count);
	type_check(arg_list[0], String, _T("[The first argument of ExportCalSkel should be a string that is a full path name of the file to export]"));
	type_check(arg_list[1], Array , _T("[The 2nd argument of ExportCalSkel should be an array of nodes]"));
	type_check(arg_list[2], Boolean,_T("[The 3rd argument of ExportCalSkel should be a boolean that tells if you want to use the UI or not to select nodes of skeleton]"));
	
	try
	{
		fullpathfilename	= arg_list[0]->to_string();

		//Get Array
		Array* BonesArray	= static_cast<Array*>(arg_list[1]);
		ArraySize			= BonesArray->size;	

		bShowUI				= !!(arg_list[2]->to_bool());

		if (fullpathfilename.length() == 0) return new Integer (1);
		if (! ArraySize)		return new Integer (2);
 
		for (i=0;i<ArraySize;i++)
		{
			if (BonesArray->data[i]->is_kind_of(class_tag(MAXNode)) )
			{
				INode* _node	= 	BonesArray->data[i]->to_node();
				if (! _node)return new Integer (3);

				tabnode.Append(1,&_node);
			}
		}

		//Call the exporter from Maxscript
		if (CMaxSkeletonExport::ExportSkeletonFromMaxscriptCall(fullpathfilename.c_str(), tabnode, bShowUI) )
			return new Integer (0);

		return new Integer (-1);
	}
	catch(...)
	{	
		//MessageBox(NULL,"Exception catched in ExportCalSkel C++ function","Error",MB_OK);
		return new Integer (-2);
	}
}
Example #15
0
Value*
wm3_setscrollpos_cf(Value** arg_list, int count)
{
	check_arg_count(wm3_setscrollpos, 2, count);
	type_check(arg_list[0], MAXModifier, "WM3_SetChannelPos [Morpher Modifier] [NewPos]");
	type_check(arg_list[1], Integer, "WM3_SetChannelPos [Morpher Modifier] [NewPos]");

	ReferenceTarget* obj = arg_list[0]->to_modifier();	
	if( !check_ValidMorpher(obj,arg_list) ) return &false_value;

	MorphR3 *mp = (MorphR3*)arg_list[0]->to_modifier();
	mp->VScroll(SB_THUMBPOSITION,(arg_list[1]->to_int()-1));

	return &true_value;
}
Example #16
0
 /** create from Py functions.
  * in most of cases, need not to inc ref.
  * please read python doc carefully
  */
 set(PyObject* p, bool borrowed = false)
 {
     type_check(p);
     _p = p;
     if(borrowed)
         Py_XINCREF(_p);
 }
Example #17
0
Value*
triangle_cf(Value** arg_list, int count)
{
	check_arg_count(triangle, 2, count);
	for (int i=0; i < count; i++)
		type_check(arg_list[i], Array, _T("triangle"));

	Array			*pts_val = (Array*)arg_list[0], 
	*col_val = (Array*)arg_list[1];
	GraphicsWindow	*gw		 = MAXScript_interface->GetActiveViewExp().getGW();	
	
	if (MaxSDK::Graphics::IsRetainedModeEnabled() && gw->querySupport(GW_SPT_NUM_LIGHTS) == 0)
	{
		return &undefined;
	}

	if (col_val->size != 3)
		throw RuntimeError(MaxSDK::GetResourceStringAsMSTR(IDS_RK_RGB_ARRAY_SIZE_NOT_3));
	if (pts_val->size != 3)
		throw RuntimeError(MaxSDK::GetResourceStringAsMSTR(IDS_RK_VERT_ARRAY_SIZE_NOT_3));

	Point3* pts = new Point3[3]; 
	Point3*	 col = new Point3[3]; 
	for (int i=0; i < 3; i++) {
		pts[i] = pts_val->data[i]->to_point3();
		col[i] = col_val->data[i]->to_point3()/255.f;
	}	

	//	virtual void	triangle(Point3 *xyz, Point3 *rgb) = 0;
	gw->triangle(pts, col);

	delete [] pts;
	delete [] col;
	return &ok;
}
Example #18
0
ConditionalNode::ConditionalNode(const std::shared_ptr<AstNode> &condition_,
                                 const std::shared_ptr<AstNode> &then_part_,
                                 const std::shared_ptr<AstNode> &else_part_)
    : condition(condition_), then_part(then_part_), else_part(else_part_) {
  type_check(condition, BOOL);
  type_check_match(then_part, else_part);
}
Example #19
0
Value*
my_file_in_cf(Value** arg_list, int count)
{
	// myFileIn "filename" [quiet:true]

	// pick up arguments
	check_arg_count_with_keys(myFileIn, 1, count);
	two_typed_value_locals(ReadonlyTextFileStream* file, Value* result);
	Value* quiet = key_arg_or_default(quiet, &true_value);
	type_check(quiet, Boolean, _T("myFileIn quiet:"));

	// open a fileStream instance on the file
	vl.file = new ReadonlyTextFileStream();
	vl.file = vl.file->open(arg_list[0]->to_string());
	if (vl.file == (CharStream*)&undefined)
		throw RuntimeError (_T("fileIn cannot open file: "), arg_list[0]);

	// pass it to the stream-based fileIn utility function
	try
	{
		vl.result = file_in(vl.file, (quiet == &true_value));
	}
	catch (...)
	{
		// catch any errors and close the temp filestream
		vl.file->close();
		throw;
	}

	// pop value locals & return fileIn result
	return_value(vl.result);
}
Example #20
0
File: terms.c Project: danr/jbofihe
    /* All arguments apply to the selbri_3 */
    process_selbri_3_args(s3, pre, post, lc);
  }
}/*}}}*/
static void process_main_selbri(TreeNode *ms, TermVector *pre, TermVector *post)/*{{{*/
{
  /* Handle each main selbri after it has been located.  */

  TermVector *cpre, *cpost;
  XTermVectors *xtv;
  TreeNode *s;
  LinkConv lc;

  type_check(ms, MAIN_SELBRI);

  cpre = new(TermVector);
  cpost = new(TermVector);
  *cpre = *pre;
  *cpost = *post;
  /* Do we really need to store this property???!!! We do all the
     processing on these vectors below! */
  xtv = prop_term_vectors(ms, YES);
  xtv->pre = cpre;
  xtv->post = cpost;

  lc_init(&lc);

  /*

    Roll up the sleeves ..., this is where the real grunge starts.

   */

  s = child_ref(ms, 0); /* selbri */

  process_selbri_args(s, pre, post, &lc);

}/*}}}*/
Example #21
0
int hash_table_exists(SExp h, SExp key) {
	SHash* p;
	HashEntry* e;
	type_check(h, &TSHash);
	p = h.hash;
	e = ht_find(&p->ht, key.p);
	return e != NULL;
}
Value* ExportCalMat_cf(Value** arg_list, int count)
{	
	int i = 0;
	char* fullpathfilename;

	check_arg_count(ExportCalMat, 2, count);
	type_check(arg_list[0], String, "[The first argument of ExportCalMat should be a string]");
	type_check(arg_list[1], MAXMaterial , "[The 2nd argument of ExportCalMat should be a standard material]");
	
	try
	{
		fullpathfilename		= arg_list[0]->to_string();
		StdMat* stdmat;

		if (! strcmp(fullpathfilename,"")) return new Integer(1);

		//Get material
		Value* val;
		val = arg_list[1];
		if (! val)return new Integer(2);

		if (val->is_kind_of(class_tag(MAXMaterial)) )
		{
			MtlBase* _mtl;
			_mtl = 	val->to_mtlbase();
			if (! _mtl)return new Integer(3);

			stdmat = static_cast<StdMat*>(_mtl);
		}
		else
		{
			return new Integer(3);
		}

		if ( CMaxMaterialExport::ExportMaterialFromMaxscriptCall(fullpathfilename, stdmat) )
			return new Integer(0);
		
		return new Integer(-1);
	}
	catch(...)
	{	
		//MessageBox(NULL,"Exception catched in ExportCalMat C++ function","Error",MB_OK);
		return new Integer(-2);
	}
}
Example #23
0
 tuple& operator=(const obj& o)noexcept(!PY11_ENFORCE)
 {
     if(o.p()!=_p){
         type_check(o);
         release();
         enter(o.p());
     }
     return *this;
 }
Example #24
0
 set& operator=(const obj& o)
 {
     if(o.p()!=_p){
         type_check(o);
         release();
         enter(o.p());
     }
     return *this;
 }
Example #25
0
 set& operator=(obj&& o)noexcept(!PY11_ENFORCE)
 {
     if(o.p()!=_p){
         type_check(o);
         release();
         _p = o.transfer();
     }
     return *this;
 }
Example #26
0
 set& operator=(PyObject* p)
 {
     if(p!=_p){
         type_check(p);
         release();
         _p = p;
     }
     return *this;
 }
Example #27
0
//=============================================================================
// subr
static void s_free_dll_module(SExp s) {
	CPtr* p;
	HDLL_MODULE hDll;
	s = type_check(s, &TString);
	p = (CPtr*)S2PTR(s);
	hDll = (HDLL_MODULE)p->ptr;
	free_dll_module(hDll);
	p->ptr = NULL;
}
Example #28
0
Value*
wm3_mc_getname_cf(Value** arg_list, int count)
{
	check_arg_count(wm3_mc_getname, 2, count);
	type_check(arg_list[0], MAXModifier, _T("WM3_MC_GetName [Morpher Modifier] [Channel Index]"));
	type_check(arg_list[1], Integer, _T("WM3_MC_GetName [Morpher Modifier] [Channel Index]"));

	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();
	MaxMorphModifier maxMorpher(mp);
	return new String(maxMorpher.GetMorphChannel(sel).GetName());
}
Example #29
0
Value*
wm3_mc_getlimitmin_cf(Value** arg_list, int count)
{
	check_arg_count(wm3_mc_getlimitmin, 2, count);
	type_check(arg_list[0], MAXModifier, _T("WM3_MC_GetLimitMIN [Morpher Modifier] [Channel Index]"));
	type_check(arg_list[1], Integer, _T("WM3_MC_GetLimitMIN [Morpher Modifier] [Channel Index]"));

	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();

	return Float::intern(mp->chanBank[sel].mSpinmin);
}
Example #30
0
Value*
wm3_mc_getnummpts_cf(Value** arg_list, int count)
{
	check_arg_count(wm3_mc_getnummpts, 2, count);
	type_check(arg_list[0], MAXModifier, _T("WM3_MC_NumMPts [Morpher Modifier] [Channel Index]"));
	type_check(arg_list[1], Integer, _T("WM3_MC_NumMPts [Morpher Modifier] [Channel Index]"));

	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();

	return Integer::intern(static_cast<int>(mp->chanBank[sel].mPoints.size()));	// SR DCAST64: Downcast to 2G limit.
}