stringTab limitation?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 04 April 2013   #1
stringTab limitation?

I'm using a stringTab to store some settings and the array itself contains 26 items and it's return and error. I know the bug comes from max's arrays ending the array at after 20 with ... and I'm guessing that is where the bug is.



MAXScript Scripted Plugin Handler Exception
---------------------------
-- Syntax error: at .., expected <factor>
--  In line: #("", 6, 6, 0, 12, 4, 0, 10.0, 0, 10.0, 0.0, 0.0, 0.0, 0, 0.0, 10.0, 0.0, 0.0, 0.0, 1, ...
---------------------------


I'm running this function to read in the data from the string tab..

fn getArrayFromString stg = -- Updated --returns an array containing all the sections information/data
(
	local tmpArr = #()
	if stg.count >= 1 do 
	(
		for p = 1 to stg.count do
		(
			part = execute (substring stg[p] 1 (stg[p].count))
			append tmpArr part
		)
	)
	tmpArr
)


It someone needs me to post a sample script to test with let me know.
Thank you guys.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 04 April 2013   #2
Test Script

Here is a test script for anyone who may have a solution to this problem.


plugin simpleObject StringBugs 
name:"String Bugs"
category:"Standard Primitives"
classID:#(0x503dde09, 0x1cd52e63)
(
	parameters main rollout:main
	(
		sectionsData type:#stringTab tabSize:0 tabSizeVariable:true	
		sectionCounter type:#integer default:0 ui:uiCounter
		
		on sectionsData tabChanged change tabIndex tabCount do 
		(
			this.UpdateUI()
		)
	)
	rollout main "Sections"
	(
		button uiNewSection "New" height:24 width:51 align:#left offset:[-9,0]
		label uiCount "Count:" across:2
		spinner uiCounter "" type:#integer fieldwidth:50 enabled:false
		
		on uiNewSection pressed do 
		(
			local newSection = #(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,  20,21,22,23,24,25,26,27,28,29,30) as string
			append sectionsData newSection
		)
	)
	
	
	fn getArrayFromString stg = -- Updated --returns an array containing all the sections information/data
	(
		local tmpArr = #()
		if stg.count >= 1 do 
		(
			for p = 1 to stg.count do
			(
				part = execute (substring stg[p] 1 (stg[p].count))
				append tmpArr part
			)
		)
		tmpArr
	)
	
	fn UpdateUI =
	(
		sectionCounter = sectionsData.count
	)
	
	
	on buildMesh do 
	(
 		for s in sectionsData do
		(
			local sectionsArr = getArrayFromString sectionsData
			print sectionsArr
		)
	)
	
	tool create
	(
		local first_pos
		
		on mousePoint click do case click of
		(
			1: #stop
		)
	)
)
clearlistener()
m = StringBugs()
select m
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 04 April 2013   #3
Use PrintAllElements.

http://docs.autodesk.com/3DSMAX/15/...92EE135E085.htm


To clarify, use PrintAllElements when converting to string. Not when converting back to array.
__________________
Juan Martinez | Blog | Animator
 
Old 04 April 2013   #4
Fixed

In case anyone ever comes across this. Here is a solution.


plugin simpleObject StringBugs 
name:"String Bugs"
category:"Standard Primitives"
classID:#(0x503dde09, 0x1cd52e63)
(
	parameters main rollout:main
	(
		sectionsData type:#stringTab tabSize:0 tabSizeVariable:true	
		sectionCounter type:#integer default:0 ui:uiCounter
		
		on sectionsData tabChanged change tabIndex tabCount do 
		(
			this.UpdateUI()
		)
	)
	rollout main "Sections"
	(
		button uiNewSection "New" height:24 width:51 align:#left offset:[-9,0]
		label uiCount "Count:" across:2
		spinner uiCounter "" type:#integer fieldwidth:50 enabled:false
		
		on uiNewSection pressed do 
		(
			local newSection = #(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,  20,21,22,23)
			
			--//Recreated array with supplied times (bug:array limits to 20 then adds "...)"
			str = "#("
			for n in newSection do str += (n as string) + ", "
			str = substring str 1 (str.count - 2) + ")" --remove last comma
			append sectionsData str
		)
	)
	
	
	fn getArrayFromString stg = -- Updated --returns an array containing all the sections information/data
	(
		local tmpArr = #()
		if stg.count >= 1 do 
		(
			for p = 1 to stg.count do
			(
				part = execute (substring stg[p] 1 (stg[p].count))
				append tmpArr part
			)
		)
		tmpArr
	)
	
	fn UpdateUI =
	(
		sectionCounter = sectionsData.count
	)
	
	
	on buildMesh do 
	(
 		for s in sectionsData do
		(
 			local sectionsArr = getArrayFromString sectionsData
			
			for s in sectionsArr do
			(
				print s
			)
		)
	)
	
	tool create
	(
		local first_pos
		
		on mousePoint click do case click of
		(
			1: #stop
		)
	)
)
clearlistener()
m = StringBugs()
select m
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 04 April 2013   #5
Originally Posted by martinez: Use PrintAllElements.

this is the right solution.
 
Old 04 April 2013   #6
thanks guys
.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 04 April 2013   #7
Your first posts suggests you have mixed data, but you may be able to just use #floatTab or #intTab. What I need in Max is a TabTab.
__________________
Juan Martinez | Blog | Animator
 
Old 04 April 2013   #8
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:18 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.