Itoo Software Forum

Author Topic: Maxscript convert objects to lights in RC  (Read 4048 times)

GT4505

  • Full Member
  • ***
  • Posts: 133
    • claar.be
Maxscript convert objects to lights in RC
« on: July 25, 2019, 01:36:03 PM »
Hi,

I've created a RC style to generate lights in my scenes.
At the moment I've got a style for the armature, and one as a dummy for a vray light.
As I'm encountering more noise when using the dummy (just a plane sweep on a line) than a regular vray Light.
My post on chaosgroup: https://forums.chaosgroup.com/forum/v-ray-for-3ds-max-forums/v-ray-for-3ds-max-general/1042906-reduce-noise-vray-mesh-light
To be able to use this process I would need to be able to implement in my maxscript the conversion from railclone to instances.

This way I can use the transform settings from the instances to setup the light position and rotation.
Can I use the instanciate tool or implement this in my script to make sure everything can be done in one convenient process?

Thank you
Pieter van Stee

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Maxscript convert objects to lights in RC
« Reply #1 on: July 25, 2019, 02:04:05 PM »
Using RailClone tools and istanciating it. Then using "Clone and Align" utility seems to do the job.
Maybe not as fast as one would expect but it is possible:

Rokas

GT4505

  • Full Member
  • ***
  • Posts: 133
    • claar.be
Re: Maxscript convert objects to lights in RC
« Reply #2 on: August 16, 2019, 10:54:59 AM »
Hi Rokas,

Thank you for your reply.
I have been using this workflow as you describe here.
However I'd like to create a script that duplicates the RC object, switches it to a dummy object (embedded within the RC style)
Then withing the script converts these dummy objs to instances and replacing those with lights.

It's important that this can happen in one step as we have to repeat this process hundreds of times.
So I 've got everything figured out, only the cenversion to instances is what I can't seem to get implemented into my script.

Thanks
Pieter van Stee

Michal Karmazín

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2772
Re: Maxscript convert objects to lights in RC
« Reply #3 on: August 16, 2019, 11:36:11 AM »
Hi Pieter,

First, let me confirm, that's already on our wishlist and we would like to implement the Maxscript access to this feature in future versions. Meanwhile, an option might be to use the UIAccessor Core Interface to get the button pressed. The corresponding utility can be opened by using UtilityPanel.OpenUtility RailClone_Tools and depending on the 3ds max version used, you should find the "windows handle" value (it changes) and by using the UIAccessor.PressButton or UIAccessor.PressButtonByName launch it.

Please feel free to get inspired by the following code:

UtilityPanel.OpenUtility RailClone_Tools
hwnd = windows.getchildhwnd #max "Instantiate"
UIAccessor.PressButton hwnd[1]


I hope that helps.

Best regards,

GT4505

  • Full Member
  • ***
  • Posts: 133
    • claar.be
Re: Maxscript convert objects to lights in RC
« Reply #4 on: September 17, 2019, 01:00:08 PM »
Great, that could help in the mean time.
Have been using this to generate multiple animated previews from the viewport but as it's sometimes a little complex I haven't tried this yet.
I'll try this solution and let you know how it goes.

Thanks!
Pieter van Stee

GT4505

  • Full Member
  • ***
  • Posts: 133
    • claar.be
Re: Maxscript convert objects to lights in RC
« Reply #5 on: October 07, 2019, 10:24:56 PM »
Hi Michal,

I've been testing with this piece of script, it does work but how can I keep it working when the command panel is undocked?
Then I get this error:

-- Error occurred in anonymous codeblock; filename: ; position: 236; line: 4
-- No ""get"" function for undefined
-- MAXScript callstack:
--   thread data: threadID:17620
--   ------------------------------------------------------
--   [stack level: 0]
--   In top-level

Thanks
Pieter van Stee

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Maxscript convert objects to lights in RC
« Reply #6 on: October 08, 2019, 01:04:34 PM »
Hi

That workflow is provided as a workaround. It is hard to provide a workaround for a workaround.

You can take a look at maxscript functions to dock command panel before executing mentioned script.

Rokas