Notifications
Clear all

[Closed] Simple questions difficult to me

Hi,not to waste the resource here,I tend to post my questions in one thread.As a new user,any suggestion will be helpful to me.Thanks to warmheated guys!

Q1:How to refresh scene materials count after assign a material to an object?
The case is:

 t=teapot()
m=standard name:"test1" color:red
t.material=m
scenematerials.count
--we get: 
--$Teapot:Teapot01 @ [0.000000,0.000000,0.000000]
--test1:Standard
--test1:Standard
--1

Then go on:

  n=standard name:"test2" color:green
t.material=n
scenematerials.count
--test2:Standard
--test2:Standard
--2

So it is clear: I reassigned a material to teapot but the scenematerials.count increased.When I did it in material editor ,it was correct.But not in script.Can you anybody tell me why?And how to solve it? Thank you!

3 Replies

Not that simple a question Thankfully, Bobo answered it previously; See:
http://forums.cgsociety.org/showpost.php?p=4774578&postcount=2

Hey,ZeBoxx2,thank you first! I had looked for it everywhere here,without any result.So BoBo had explained it, great!
Actually,I also have found a way to solve it ,that is run Views– Activate All Maps
which is in code:

 actionMan.executeAction 0 "40807"  -- Views: Activate All Maps 

As BoBo said,“if your scene is large, it would mean wasting time.” But this manipulation is not only wasting time,but also leading to crash. So I dare not to use it in my script.Expecting a much better method to solve it.

Q2:How to render anthoer scene in my scene and get the renderout bitmap?

 theFile = (GetDir #Scene + "[\	emp.max](file://	emp.max)") 
saveNode #(BOX()) theFile 
 
......
 
RenderOutMap = ......

Is there a method to realize this?Any help will be welcome, thank you first!