Combine 2 string arrays in one string arrays
Hallo.
I am new on 3d max script and I have an idea to do a quick layer creator script.
My purpose is to create a few defined layer by base name entered in edittext. My script was half completed but I was stuck on other half of the codes. If someone could tell me how can I combine two different arrays by string variables into one array string I will be thankful to answerer.
This is my script written through me for the purpose.
------------------------------------
----- LayerCreator 0.1 -----
----- Global Varibles ------
global crtNewLayer ----- varable to create new layer
global lyrDefNames ----- string array for
global lyrNames
global bsNames
----- Definition of Global Variables --------
lyrDefNames= # ("_Mesh","_Controller","_Hiden") ------- layer names was defined in array
lyrNames=
(
fn cmbLyrNames=
if bsNames != undefined then
(
for n = 1 to lyrDefNames.count do
(
i= n
x=bsNames
append x lyrNames [i]
)
)
)
crtNewLayer =
(
---- The function for Create New Layers button ------
fn realiseLayers=
(
for n = 1 to lyrDefNames.count do -------- a loop to create each layer
(
i= n
x= lyrDefNames
y= layermanager.getlayerfromname x [i]
z= layermanager.newlayerfromname x [i]
if y != undefined then
z
)
)
)
rollout LayerCreator "LayerCreator 0.1" width:280 height:112
(
button crtLayers "Create New Layers" pos:[0,56] width:280 height:37 enabled:true toolTip:""
editText lyrBsName " Base Name of Layers" pos:[4,24] width:270 enabled:true
on lyrBsName entered txt do
(
if lyrBsName.text != "" then
(
bsNames = # (lyrBsName.text as string)
)
)
on crtLayers pressed do
(
crtNewLayer ()
lyrNames()
)
)
createdialog LayerCreator
----------------------------------------------------
Comments
............................
I can add afew more options on the script.
...
It's difficult to understand what do you want to achive here.
Just tell me this.
If I type word in textbox let say "NewObjects" and press the "Create New Layers" button what should look final layer name string?
bga
.........
Thanks for answer.
The final layer name will be the word in textbox plus every given layer name in the script. Such as " textbox" plus "_Mesh" after they had been combined will be "textbox_Mesh". The script will be an easy way to create specific layer names in complex scenes.
...
Ok. But U have array with predefined names (prefix)
lyrDefNames= # ("_Mesh","_Controller","_Hiden")
How can script know when need to use one of this items in combination with textbox text?
bga
.....
The script is not ready yet completely. Predefined array is necessary for its purpose.
...
This is the simple concept
bga
..........
Your idea is good but it's not what I am looking for.
Here it is my last codes for my idea, I want to add a few more things before publishing final result of script.
----- LayerCreator 0.1 -----
----- Global Varibles ------
global crtNewLayer ----- varable to create new layer
global lyrDefNames ----- string array for
global lyrNames
global bsName
lyrDefNames= #()
lyrNames= #()
fn cmbNames=
(
if bsName != "" then
(
for i= 1 to lyrDefNames.count collect
append lyrNames (bsName + lyrDefNames [i])
)
)
crtNewLayer =
(
---- The function for Create New Layers button ------
fn realiseLayers=
(
for n = 1 to lyrNames.count do -------- a loop to create each layer
(
i= n
x= lyrNames
y= layermanager.getlayerfromname x [i]
z= layermanager.newlayerfromname x [i]
if y != undefined then
z
)
)
)
rollout LayerCreator "LayerCreator 0.1" width:280 height:208
(
edittext lyrBsName " Base Name of Layers" pos:[13,7] width:254 height:17 enabled:true
button crtLayers "Create New Layers" pos:[8,160] width:264 height:37 enabled:true toolTip:""
groupBox Layers "Select Layers for Scene Objects" pos:[8,40] width:264 height:112
checkbox _Controller "Controller Objects" pos:[16,88] width:120 height:24
checkbox _Cameras "Cameras" pos:[144,88] width:120 height:24
checkbox _Mesh "Mesh Objects" pos:[16,56] width:128 height:24
checkbox _Hiden "Hiden Objects" pos:[16,120] width:120 height:24
checkbox _Lights "Light Objects" pos:[144,56] width:120 height:24
checkbox _Particles "Particles" pos:[144,120] width:120 height:24
on _Controller theState do
(
objController= "_Controller"
append lyrDefNames objController
)
on _Cameras changed theState do
(
objCameras="_Cameras"
append lyrDefNames objCameras
)
on _Mesh changed theState do
(
objMesh="_Mesh"
append lyrDefNames objMesh
)
on _Hiden changed theState do
(
objHiden="_Hiden"
append lyrDefNames objHiden
)
on _Lights changed theState do
(
objLights="_Lights"
append lyrDefNames objLights
)
on _Particles changed theState do
(
objParticles="_Particles"
append lyrDefNames objParticles
)
on lyrBsName entered txt do
(
bsName = lyrBsName.text
cmbNames ()
)
on crtLayers pressed do crtNewLayer ()
)
createdialog LayerCreator
.
Post your code inside(without the quotes) to make it readable.
[""code""]
{""/code""}
Tools and Scripts for Autodesk 3dsMax
FORUM RULE
http://www.scriptspot.com/forums/3ds-max/general-scripting/kredka-strike...
bga