Majik Primer: MoI's Lighting Options and You!
 1-10  11-30  31-50  51-69

Previous
Next
 From:  dinos
5222.31 In reply to 5222.29 
Hi Mike.
Yup, Oil Slick is a very fitting name for my defaults!

The script that i did is based on the LightingOptions.htm, so you are absolutely right in merging it back to it.
Your modified file also works in V2.52 as the original file is the same for both versions. I don't have anything older installed so i cant check if it can be used with it.

It would be nice to have an option to add a new theme or edit an existing directly from this ui. That would require a major change, as we will have to move the presets into moi.ini. Maybe during the first time it is run.

It might be possible using setOption/getOption and loading/saving the data using JSON, but i'll need to check it in more detail.

Thanks to everyone for their feedback!

Dinos
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5222.32 In reply to 5222.31 
Hi dinos, yes even though I don't think there's anything that uses it currently, a script can save something to the moi.ini file by passing true for the 3rd parameter value in setOption(), like: moi.command.setOption( 'name', value, true ) - that will save it under a [Commands] section of moi.ini . Then when you read it back in use moi.command.getOption( 'name', true ); , and also be aware that getOption will throw an exception if the value does not exist so you usually need to put it in a try / catch block.

For the name it's good to make sure it's not too generic to avoid future collisions, usually sticking the name of the .htm file or command at the start of the name is a good idea, like 'LightingOptions.htm_value', rather than just plain 'value' for the name.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  dinos
5222.33 In reply to 5222.32 
Hi Michael.
Thats exactly what i was thinking. I did some preliminary tests and it works as expected.

I meant to ask you about naming, to avoid polluting the ini file, so thanks for clearing this up.
An option to disable cashing would definitely help script development a lot.

I will give it a shot when i have some free time, hopefully soon.

Dinos
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Mike K4ICY (MAJIKMIKE)
5222.34 In reply to 5222.33 
WOW! I can't wait to see what you come up with.


So maybe, not only will you be able to pick a preset and tweak it on the fly, but be able to save the result to choose at a later time.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  dinos
5222.35 In reply to 5222.34 
ok. This what we might call V2.0 BUT please note that there might still be a few bugs left. I will stop for tonight and fix/finalize by monday.

Mike, thanks for merging the original version of this script back to LightingOptions.htm. That was the basis for this version.

As far as i've tested it there is definitely one error, but you can safely ignore it. When you choose Add you will see an exception. Press ok and the script will continue working correctly and Add the new theme.

Michael: I'm using: var dialog = moi.ui.createDialog('EditNameDialog.htm', '', moiWindow); to request the name for the new theme, but i can find a way to pass nameval as a global variable for this script. Can you help?


Here is the basic functionality of this version.



Installation:
Just copy the script in the zip file to your ui folder. Rememer to backup the existing file, just in case. No need to create a preset for your current settings. A "My favorite" preset will be created automatically for you.

Usage:
Add will create a new preset from the current settings below.
Delete will delete the selected preset.
Update will update the selected preset to the settings below.

Thats it. Everything should be saved and restored correctly between sessions.

Please post any bugs you might find.

Dinos

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5222.36 In reply to 5222.35 
Hi Dinos - re: edit name dialog, when you create the dialog it doesn't finish loading until after that so you can set global variables on the dialog's script environment by using the htmlWindow property off the returned dialog.

Then after you set it you probably want to call doModal() on it to get a result back, here's an example:

script:var dialog = moi.ui.createDialog('EditNameDialog.htm'); dialog.htmlWindow.nameval = 'test'; var result = dialog.window.doModal(); moi.ui.alert(result);

At some point this sequence should get bundled up into some kind of EditName() function in a script support library.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  dinos
5222.37 In reply to 5222.36 
Thanks Michael. That was quick!

But i'm getting an Unsafe javascript attempt exception accessing the frame.

Here is the code section:

code:
function AddClicked() {
	var dialog = moi.ui.createDialog('EditNameDialog.htm', '', moiWindow);
	dialog.htmlWindow.nameval = '';
	if (dialog.window.doModal() != -1) {
		if (dialog.window.dialogReturnValue != '') {
			var name = dialog.window.dialogReturnValue;
			themeData.themes[name] = themeGetCurrent();
			g_select.add(new Option(name, name, false, true), null);
			themeSaveThemes(name);
		}
	}
}


Any suggestions?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Mike K4ICY (MAJIKMIKE)
5222.38 
Now I'm starting to feel all happy inside! =-)

I like it!!!

Dino, best of luck on knocking out the kinks.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5222.39 In reply to 5222.37 
Hi dinos - re unsafe javascript error - I haven't happened to run across that one before, it looks like some security measure for anti-cross-site script usage that only kicks in for the script engines that have been created by an HTML page and not the other script contexts that are created when you run a shortcut key or command script for example.

I'll have to dig into that to see how to enable script access between 2 HTML script contexts like that.

In the meantime I guess you would have to make your own edit name dialog that might take the name in the URL query string rather than as a global script variable if you want to make an edit name dialog that would work off of a dialog right now.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5222.40 In reply to 5222.37 
Hi dinos, I've attached an updated version of EditNameDialog.htm that might work better for you.

This version fixes a bug where it was actually supposed to be possible to not initialize the name at all, that was not working before, and also now there is an alternate way to initialize the name by passing nameval=somename in the query string of the URL as well, like this:

code:
function AddClicked() {

	var name = 'This is the name';

	var dialog = moi.ui.createDialog('EditNameDialog.htm?nameval=' + encodeURIComponent(name), '', moiWindow);
	if (dialog.window.doModal() != -1) {
		if (dialog.window.dialogReturnValue != '') {
			var name = dialog.window.dialogReturnValue;
			moi.ui.alert( name );
		}
	}
}


This should hopefully work for you for the moment until the cross-page script permission thing is fixed up.

- Michael
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5222.41 In reply to 5222.37 
Hi dinos, so that cross-domain security error was a timing issue related thing, the same access would work later on once the page had proceeded loading a bit and had it's base URL updated to a moi:// one.

Anyway for the next v3 beta I've got the cross-domain security checking mechanism turned off completely now and that should prevent this kind of inter-page script exception from happening anymore after that.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Rich_Art
5222.42 In reply to 5222.41 
I really like this script... thanks...


Peace,
Rich_Art. ;-)

| C4DLounge.eu | Our Dutch/Belgium C4D forum. |
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  dinos
5222.43 In reply to 5222.40 
Thanks Michael. This version of EditNameDialog.htm definitely fixes the issue. I will include it with the script, until it the next beta/release version of Moi.
Even after that it might be useful for people using an older version of Moi.



So, here is the fully working version. I will include the instructions again for consistency.




Installation:
Just copy EditNameDialog.htm and LightingOptions.htm included in the zip file to your ui folder. Remember to rename/backup the existing files, just in case.
No need to create a preset for your current settings. A "My favorite" preset will be created automatically for you.
You can add a shortcut, if you like :
code:
script: /* Opens Lighting Options Dialog */ moi.ui.createDialog( 'moi://ui/LightingOptions.htm' );


Usage:
Add will create a new preset from the current settings below.
Delete will delete the selected preset.
Update will update the selected preset to the settings below.

Thats it. Everything is saved and restored correctly between sessions in moi.ini.

Please post any bugs you might find.

EDITED: 12 Nov 2012 by DINOS


  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  SurlyBird
5222.44 
Holy cow! Thank you, Mike!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Mike K4ICY (MAJIKMIKE)
5222.45 
No no... thank Dinos!

Dinos - Great job on this useful script! It's absolutely what I envisioned when I came up with this Lighting Options primer!
And thanks Michael for helping Dinos - I've enjoyed seeing this process of script development work out. Most of it is over my head, but intriguing none the less.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  dinos
5222.46 In reply to 5222.45 
Thanks Mike!
The lighting options are a really nice feature of Moi, and i wouldn't have noticed it if it wasn't for your post.

This was my first attempt at writing a script for Moi. The javascript API is very complete and easy to use and made the process a pleasure.
I will definitely do more scripting for Moi in the future.

Dinos
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Mike K4ICY (MAJIKMIKE)
5222.47 
Hi all!

I just added 7 additional Lighting Option experiments:
After a while, there is only so much you can do, until we get environment mapping and additional lights, but here I show how you can use (-) negative values for Key Fills, and values greater than the default slider's. Please let me know of any errors.

Just look near the start of this thread...
http://moi3d.com/forum/index.php?webtag=MOI&msg=5222.6


[Dinos, if you see this, please update the Lighting Options script, thanks!]

Here are a few dark and evil creations: Onyx, Velvet Night, Ornament


A couple of glossy options: Enamel, Clear Coat, Hi-Gloss Plastic


And here it is (I wish), Zebra Stipes... well, one curvy one: Should be useful.


Enjoy.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  dinos
5222.48 In reply to 5222.47 
Hi Mike!

I love the new options!
Velvet Night is my personal favorite :-)

I've added the new Lighting Options to the script.
I've also updated the script to merge any new options (themes) defined in it with the existing/saved options. Makes it a lot easier to add new options.
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Mike K4ICY (MAJIKMIKE)
5222.49 
Thanks Dinos, great work on the script!

Yes, just when I thought I found most of the major combinations, I discovered you could go below zero on the Key fill attributes.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
5222.50 
Moon's lights!
---
Pilou
Is beautiful that please without concept!
My Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
Show messages:  1-10  11-30  31-50  51-69