[Maya-Python] Re: Nearest Point On Mesh in Maya

2017-05-05 Thread Robert White
` is usually referred to as the backtick.

On Thursday, May 4, 2017 at 4:09:37 PM UTC-5, Michael Boon wrote:
>
> The little apostrophe character you're using should be `, not '
> On a US keyboard, that's the key above Tab. I don't know what it's called 
> (and I've never seen it used for anything other than MEL).
>
>
> On Thursday, 4 May 2017 18:04:24 UTC+10, Junaid Iqbal wrote:
>>
>> Hey guys, 
>> I need some help with the script. I have no idea about scripting. I am 
>> watching a tutorial for making grass in Maya 2016. I am at the point where 
>> I am trying to write the script where the grass faces the normals so the 
>> grass goes with the uneven surface of the land. Below is the code that is 
>> there in the script. Kindly let me know what is wrong as I keep getting the 
>> error "//Error: 4.15: Syntax error" 
>> the code I am writing is " vector $nrm = 'nearestPointOnMesh -1p ($p.x) 
>> ($p.y) ($p.z) -normal -q pPlane'; " 
>>
>> I am using nparticles and have added few expressions, everything else is 
>> working fine but when I add the above line the error appears. Is there 
>> another way to do this? please you can suggest and tutorial as well if 
>> anything available. 
>> Regards 
>> Junaid.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4693d98c-62c4-4599-9618-f871c2850967%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Nearest Point On Mesh in Maya

2017-05-05 Thread Alok Gandhi
The little apostrophe character you're using should be `, not '
On a US keyboard, that's the key above Tab. I don't know what it's called
(and I've never seen it used for anything other than MEL).
Use of backticks (``) is rare in python, but they are legal in python 2.x
(deprecated in python 3) and are an equivalent of the special method
__repr__(). Other than python 2.x they mean different things in other
programming languages. For example, they are freely used in a bash script. The
text between backticks is executed and replaced by the output of the
command (minus the trailing newline characters), in Perl, they are almost
used same as in bash script (to execute a statement but never return).

On Fri, May 5, 2017 at 8:03 PM, Robert White 
wrote:

> ` is usually referred to as the backtick.
>
> On Thursday, May 4, 2017 at 4:09:37 PM UTC-5, Michael Boon wrote:
>>
>> The little apostrophe character you're using should be `, not '
>> On a US keyboard, that's the key above Tab. I don't know what it's called
>> (and I've never seen it used for anything other than MEL).
>>
>>
>> On Thursday, 4 May 2017 18:04:24 UTC+10, Junaid Iqbal wrote:
>>>
>>> Hey guys,
>>> I need some help with the script. I have no idea about scripting. I am
>>> watching a tutorial for making grass in Maya 2016. I am at the point where
>>> I am trying to write the script where the grass faces the normals so the
>>> grass goes with the uneven surface of the land. Below is the code that is
>>> there in the script. Kindly let me know what is wrong as I keep getting the
>>> error "//Error: 4.15: Syntax error"
>>> the code I am writing is " vector $nrm = 'nearestPointOnMesh -1p ($p.x)
>>> ($p.y) ($p.z) -normal -q pPlane'; "
>>>
>>> I am using nparticles and have added few expressions, everything else is
>>> working fine but when I add the above line the error appears. Is there
>>> another way to do this? please you can suggest and tutorial as well if
>>> anything available.
>>> Regards
>>> Junaid.
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/4693d98c-62c4-4599-9618-
> f871c2850967%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



--

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPaTLMQiCak11j3kPTqjp4w3bwrH3kKtBrGAvx3qka%3DxA%3Db5Uw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] How to create a node editor and display a list of nodes in it?

2017-05-05 Thread Chad_Fox
Hi all

I'm trying to write a script to display a node editor, populate it with a 
given list of nodes and frame them. Unfortunately when running in python, 
maya mostly only completes the first step of displaying the scriptedPanel 
node editor I'm making. Occasionally when running this code I do get a node 
editor with the nodes added, but not framed. 

Even though I have the name of said editor, the commands to add nodes and 
frame them do nothing when everything is run in one execution. If I run 
them separately and individually it works great!

I've tried using evalDeferred and utils.executeInMainThreadWithResult() to 
create the window first then run the nodeEditor commands, but no luck 
there. 

Any thoughts on how to approach this problem?

Thanks!

Enter code here...

nodes_to_display = cmds.ls(sl=True)


title = 'Custom Node Editor Window'
h = 700
w = 950
window_name = cmds.window(title, height=h, width=w)

form_layout = cmds.formLayout()
custom_node_editor = cmds.scriptedPanel(type="nodeEditorPanel", label="My 
Node Editor")
cmds.formLayout(form_layout, e=True, af=[(custom_node_editor, s, 0) for s 
in ("top", "bottom", "left", "right")])
cmds.showWindow(window_name)

editor_name = custom_node_editor + "NodeEditorEd"


print "Clear node editor"
cmds.nodeEditor(editor_name, e=True, rootNode='')  

print "adding nodes"
for node in nodes_to_display: 
cmds.nodeEditor(editor_name, e=True, addNode=node)

print "layout nodes"
cmds.nodeEditor(editor_name, e=True, layout=True)

print "frame nodes"
cmds.nodeEditor(editor_name, e=True, frameAll=True)




-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/5af628e9-65f8-44ff-9c38-e1bbfeb4176d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: Finding and selecting fliiped (red-colored) UVs

2017-05-05 Thread likage
Alright, I have misunderstand. 

Yes I think I will stick to the cmds command as it is faster and easier to 
maintain like you have mentioned.
Appreciate for the information on the API and PyMel etc. :)

Cheers!

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4550aa2a-ea0f-4f95-a5be-36651048cde9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Use AbcExport plugin externally to convert obj to abc

2017-05-05 Thread likage
Hi all, I am trying to convert objects (.obj) into alembics (.abc)

While I am able to perform this by importing my objs into a maya scene and 
export it as alembic, is there a way in which I can run it externally out 
of Maya session? 
Such that I can try running it as a command line or somewhat, by making use 
of the AbcExport plugin within Maya?

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/2c21c9fc-eb98-4482-91ba-c56e263bca09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Use AbcExport plugin externally to convert obj to abc

2017-05-05 Thread Paul Molodowitch
you can just use mayapy, then invoke the AbcExport plugin from there.


On Fri, May 5, 2017 at 4:38 PM likage  wrote:

> Hi all, I am trying to convert objects (.obj) into alembics (.abc)
>
> While I am able to perform this by importing my objs into a maya scene and
> export it as alembic, is there a way in which I can run it externally out
> of Maya session?
> Such that I can try running it as a command line or somewhat, by making
> use of the AbcExport plugin within Maya?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/2c21c9fc-eb98-4482-91ba-c56e263bca09%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAAssL7a_Aa7TRgPHPQ2CY3%3D6Nf_Hhdhu_XOWZRJq6O%3D5J%3DA3mw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] How to create a node editor and display a list of nodes in it?

2017-05-05 Thread Justin Israel
On Sat, May 6, 2017 at 10:11 AM Chad_Fox  wrote:

> Hi all
>
> I'm trying to write a script to display a node editor, populate it with a
> given list of nodes and frame them. Unfortunately when running in python,
> maya mostly only completes the first step of displaying the scriptedPanel
> node editor I'm making. Occasionally when running this code I do get a node
> editor with the nodes added, but not framed.
>
> Even though I have the name of said editor, the commands to add nodes and
> frame them do nothing when everything is run in one execution. If I run
> them separately and individually it works great!
>
> I've tried using evalDeferred and utils.executeInMainThreadWithResult() to
> create the window first then run the nodeEditor commands, but no luck
> there.
>
> Any thoughts on how to approach this problem?
>

It seems to work for me if I either put a cmds.refresh() between the
showWindow() and the layout/frame of the nodes, or you can use

cmds.evalDeferred(functools.partial(setupNodeEditor, editor_name))

and put the layout/frame into a setupNodeEditor(name) function.


>
> Thanks!
>
> Enter code here...
>
> nodes_to_display = cmds.ls(sl=True)
>
>
> title = 'Custom Node Editor Window'
> h = 700
> w = 950
> window_name = cmds.window(title, height=h, width=w)
>
> form_layout = cmds.formLayout()
> custom_node_editor = cmds.scriptedPanel(type="nodeEditorPanel", label="My
> Node Editor")
> cmds.formLayout(form_layout, e=True, af=[(custom_node_editor, s, 0) for s
> in ("top", "bottom", "left", "right")])
> cmds.showWindow(window_name)
>
> editor_name = custom_node_editor + "NodeEditorEd"
>
>
> print "Clear node editor"
> cmds.nodeEditor(editor_name, e=True, rootNode='')
>
> print "adding nodes"
> for node in nodes_to_display:
> cmds.nodeEditor(editor_name, e=True, addNode=node)
>
> print "layout nodes"
> cmds.nodeEditor(editor_name, e=True, layout=True)
>
> print "frame nodes"
> cmds.nodeEditor(editor_name, e=True, frameAll=True)
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/5af628e9-65f8-44ff-9c38-e1bbfeb4176d%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1jKsiwKEZbDE3LYeraqdP7MiFUcc0e465AHgGoSPXqTQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.