Re: Swap instance master

2013-10-24 Thread XSICGI
hehe !


On Thu, Oct 24, 2013 at 5:43 PM, David Saber  wrote:

> On 2013-10-17 13:45, David Saber wrote:
>
>> Thank you Nono
>> After a search in the mailing list archive, I have already tried this,
>> but it didn't work... I'm sure I did something wrong.
>> I guess both master models must have the same name? If that's possible.
>> I'll test this again.
>> Greetings,
>> David
>>
>>  OK with Peter's help, I found what was the problem:
> When you add the models to the instance group, DRAG AND DROP does not
> work!!! You really have to select the model, don't select the group, right
> click on the group then "add to group"!!
> will purchase a brain on Ebay...
>


Re: Swap instance master

2013-10-24 Thread David Saber

On 2013-10-17 13:45, David Saber wrote:

Thank you Nono
After a search in the mailing list archive, I have already tried this, 
but it didn't work... I'm sure I did something wrong.

I guess both master models must have the same name? If that's possible.
I'll test this again.
Greetings,
David


OK with Peter's help, I found what was the problem:
When you add the models to the instance group, DRAG AND DROP does not 
work!!! You really have to select the model, don't select the group, 
right click on the group then "add to group"!!

will purchase a brain on Ebay...


Re: Swap instance master

2013-10-18 Thread Thomas Volkmann
Giving it another thought why not just simply change the content of the
model?


> pete...@skynet.be hat am 18. Oktober 2013 um 11:30 geschrieben:
>
>
> tried it in a simple scene and it definitely works.
> Remove instances from old instance group - they just become empty models -
> add to the new masters' instance group.
> (create one instance first to make the group, then delete that instance).
> it works immediately - but in the past I remember having to save and reload
> the scene - so you might give that a go.
>
>
> -Original Message-
> From: David Saber
> Sent: Thursday, October 17, 2013 1:45 PM
> To: softimage@listproc.autodesk.com
> Subject: Re: Swap instance master
>
> Thank you Nono
> After a search in the mailing list archive, I have already tried this,
> but it didn't work... I'm sure I did something wrong.
> I guess both master models must have the same name? If that's possible.
> I'll test this again.
> Greetings,
> David
>
>

Re: Swap instance master

2013-10-18 Thread peter_b

tried it in a simple scene and it definitely works.
Remove instances from old instance group - they just become empty models - 
add to the new masters' instance group.

(create one instance first to make the group, then delete that instance).
it works immediately - but in the past I remember having to save and reload 
the scene - so you might give that a go.



-Original Message- 
From: David Saber

Sent: Thursday, October 17, 2013 1:45 PM
To: softimage@listproc.autodesk.com
Subject: Re: Swap instance master

Thank you Nono
After a search in the mailing list archive, I have already tried this,
but it didn't work... I'm sure I did something wrong.
I guess both master models must have the same name? If that's possible.
I'll test this again.
Greetings,
David 



Re: Swap instance master

2013-10-18 Thread David Saber

Thanks a lot, Thomas!


Re: Swap instance master

2013-10-17 Thread Thomas Volkmann
You could try running the attached script (but don't look at it, it's rather
old).
Just select the instances you want to replace, run the script, and pick the new
master model. Doesn't work if you have animations on your instances though.

cheers,
Thomas

> David Saber  hat am 17. Oktober 2013 um 13:45 geschrieben:
>
>
> Thank you Nono
> After a search in the mailing list archive, I have already tried this,
> but it didn't work... I'm sure I did something wrong.
> I guess both master models must have the same name? If that's possible.
> I'll test this again.
> Greetings,
> David
>import win32com.client
from win32com.client import constants as c
null = None
false = 0
true = 1
TRUE = True
FALSE = False
xsi = Application
log = xsi.LogMessage


def 
doIt(mode,move2p,type,matchAll,matchTrans,matchRot,matchScale,move2part,makeChild,matchGrp):
#Target Objects
liste = xsi.Selection
sel = []
for i in liste:
sel.append(i)
pick = xsi.PickElement('','Pick Object')
#Object to be copied
pickedObj = pick.Value("PickedElement")
pickParent = pickedObj.Parent

for target in sel:
parent = target.Parent

#Copy, Clone or Instance
if type.Value == 1:
source = xsi.Duplicate(pickedObj, "", 2, 1, 1, 0, 0, 1, 0, 1, "", 
"", "", "", "", "", "", "", "", "", 0)
elif type.Value == 2:
source = xsi.Clone(pickedObj, "", 1, 1, 0, 0, 1, 0, 1, "", "", "", 
"", "", "", "", "", "", "")
elif type.Value == 3:
source = xsi.Instantiate(pickedObj, "", 1, 1, 0, 1, "", "", "", "", 
"", "", "", "", "", "")

#Move to parent
if move2p.Value == True:
if str(pickParent) != str(parent):
xsi.CopyPaste(str(source), "", str(parent), 1)

#Make Child
if makeChild.Value == True:
xsi.CopyPaste(str(source), "", str(target), 1)

#Match Transforms
if matchAll.Value == True or (matchTrans.Value==True and 
matchRot.Value==True and matchScale.Value==True):
xsi.MatchTransform(source, target, "siSRT", "")
else:
if matchTrans.Value == True:
xsi.MatchTransform(source, target, "siTrn", "")
if matchRot.Value == True:
xsi.MatchTransform(source, target, "siRot", "")
if matchScale.Value == True:
xsi.MatchTransform(source, target, "siScl", "")

#Match Partitions
if move2part.Value == True:
owners = target.Owners
for owner in owners:
if str(owner.Parent.Type) == "Pass":
xsi.MoveToPartition(owner, source)

#Match Groups
if matchGrp.Value == True:
owners = target.Owners
for owner in owners:
if str(owner.Type) == "#Group":
xsi.SIAddToGroup(owner, source)


#Hide or Delete
if mode.Value == 2:
xsi.ToggleVisibility(target, "", "")
elif mode.Value == 3:
xsi.DeleteObj(target)



def gui():
oPSet = 
xsi.ActiveSceneRoot.AddProperty("CustomProperty",False,"tv_Replace") 
oLayout = oPSet.PPGLayout



#Hide Delete None
mode = oPSet.AddParameter3("Target", c.siInt4)
modus = ["no change",1,"hide",2,"delete",3]
oLayout.AddEnumControl("Target", modus,"Target", c.siControlRadio)
xsi.SetValue(mode, 3)

#Move to Parent
move2p = oPSet.AddParameter3("Move_to_parent",c.siBool)
merge = ["",1]
oLayout.AddEnumControl("Move_to_parent", merge,"", c.siControlBoolean)
xsi.SetValue(move2p, FALSE)

#Make Child
makeChild = oPSet.AddParameter3("Make_Child",c.siBool)
merge = ["",1]
oLayout.AddEnumControl("Make_Child", merge,"", c.siControlBoolean)
xsi.SetValue(makeChild, FALSE)

#Match Partition
move2part = oPSet.AddParameter3("Match_partitions",c.siBool)
oLayout.AddEnumControl("Match_partitions", merge,"", c.siControlBoolean)
xsi.SetValue(move2part, FALSE)

#Match Groups
matchGrp = oPSet.AddParameter3("Match_Groups",c.siBool)
oLayout.AddEnumControl("Match_Groups", merge,"", c.siControlBoolean)
xsi.SetValue(matchGrp, FALSE)

#Type select
type = oPSet.AddParameter3("Type", c.siInt4)
xyz = ["copy",1,"clone",2,"instanciate (Models only)",3]
oLayout.AddEnumControl("Type", xyz,"Type", c.siControlRadio)
xsi.SetValue(type,3)

#Match
matchAll = oPSet.AddParameter3("MatchAll",c.siBool)
tmp = ["",1]
oLayout.AddEnumControl("MatchAll", tmp,"", c.siControlBoolean)
xsi.SetValue(matchAll, TRUE)

matchTrans = oPSet.AddParameter3("MatchTranslation",c.siBool)
tmp = ["",1]
oLayout.AddEnumControl("MatchTranslation", tmp,"", c.siControlBoolean)
xsi.SetValue(matchTrans, False)

matchRot = oPSet.AddParameter3("MatchRotation",c.siBool)
tmp = ["",1]
oLayout.AddEnumControl("MatchRotation", tmp,"

Re: Swap instance master

2013-10-17 Thread David Saber

Thank you Nono
After a search in the mailing list archive, I have already tried this, 
but it didn't work... I'm sure I did something wrong.

I guess both master models must have the same name? If that's possible.
I'll test this again.
Greetings,
David


Re: Swap instance master

2013-10-16 Thread Nono
Hi david,
Maybe i misunderstood but you can swap the master easily without scripting:
- select the instances
- go to the master, and remove the instances from the instance group (right
clic remove from group), your instances are now nulls...
- keep your selection and go to the new master->instance group and right
clic "add to group", done

Hope this was your request ;-)


On Wed, Oct 16, 2013 at 6:16 PM, David Saber  wrote:

> Thanks Alok, that's fine. But perhaps someone has already written a script
> for that? That's why I was asking about searching "The Area"...
> is "The Area" the sole place for Softimage scripts now?
>


Re: Swap instance master

2013-10-16 Thread David Saber
Thanks Alok, that's fine. But perhaps someone has already written a 
script for that? That's why I was asking about searching "The Area"...

is "The Area" the sole place for Softimage scripts now?


Re: Swap instance master

2013-10-16 Thread Alok Gandhi
Not really, you have to write your own script.

Sent from my iPhone

> On Oct 16, 2013, at 12:00 PM, David Saber  wrote:
> 
> Hi all
> Is there a way to Swap the instances master?
> Also, how do i search scripts in the Area? I didn't see an "advanced search" 
> button...
> Thanks
> David



Swap instance master

2013-10-16 Thread David Saber

Hi all
Is there a way to Swap the instances master?
Also, how do i search scripts in the Area? I didn't see an "advanced 
search" button...

Thanks
David