try to use callbutton() to apply optimal mapping
-
On 01/08/2016 at 16:29, xxxxxxxx wrote:
hi there,
I'm really new to python for C4D, so maybe this is a stupid question, but I struggled in the documentation and didn't find my answer...
I was trying to create a small python script to automate the Optimal Cubic Mapping tool, and get stuck.
The idea is to apply the cubic mapping to the selected object.my code is like this:
> def main() :
>
> c4d.CallCommand(17039) # UV Polygons
>
> c4d.CallCommand(c4d.ID_OPTIMAL_MAPPING)
>
> tool = c4d.plugins.FindPlugin(doc.GetAction(), c4d.PLUGINTYPE_TOOL)
>
> c4d.CallButton(tool, c4d.BAKETEXTURE_MAPPING_CUBIC )
>
>
>
>
> if __name__=='__main__':
>
> main()
>
>
>
Somehow I only reached the step of showing UV Polygons, but the optimal mapping is not applied.Would be really thankful for any hint!!
Bo
-
On 02/08/2016 at 02:55, xxxxxxxx wrote:
Hi Bo,
welcome to the Plugin Café forums
I'm not quite sure I understand what you are actually looking for. From the text I thought of the Optimal Mapping tab in the UV Tools. But then you are happily mixing IDs from the BakeTexture tag, so maybe you are after that one?
Just in case you are after the UV Tools, then I have bad news. You currently can't make proper use of the UV Tools as CallUVCommand() (link to C++ docs) is currently not available in Python. This will change with R18.
-
On 02/08/2016 at 05:13, xxxxxxxx wrote:
Hello Andreas,
Thanks for the answer! Yeah you are right What I really want to use is the Optimal Mapping tab, but I didn't it in the SDK so I was kind of trying to insert anything that seems to be related, sorry for misleading.
So is there maybe a work around solution for this? Or is c++ the only way to do that? : (
Some more information that might help : I'm currently using C4D as a tool to get the geometries from Archicad and remap the UV, then export as FBX for Unreal Engine, since the geometries have a uv map but not properly lay outed and have a lot of unwanted overlapping, I want to quickly orgnize them using the Optimal Mapping as said. So maybe there are also other ways to get the result, for example to generate a new uvw map in C4D which doesn't have overlapping. Do you think such a solution exist?
Thanks a lot!
Bo -
On 03/08/2016 at 08:48, xxxxxxxx wrote:
Hi Bo,
no, there's currently no workaround I know of, to make the UV tools work from Python. But as I said, this will change with R18. For all other versions C++ is the only option.
You could do it manually working directly on the UVWTag.