Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
On 18/02/2016 at 11:05, xxxxxxxx wrote:
User Information: Cinema 4D Version: r17 Platform: Windows ; Language(s) : C++ ;
--------- I'm creating a kind of importer but I need to create the meshes (done), need to create the materials... that is only partially done since I managed to create the material but put the textures (nothing too sexy just diffuse, spec etc), and apply to meshes.
Obviously I feel a bit unconfortable comming here and spend your time replying questions and questions to me.
I've downloaded the .chm that is ok since documents the sdk but I didn't found more examples than the sdk ones that only cover some parts, are there tutorials about something similar?
Also a tip about creating materials and apply then to sub-meshes (sorry I came from other 3d package and it calls like that to parts of a mesh) is welcome.
On 19/02/2016 at 01:35, xxxxxxxx wrote:
Hi,
you don't need to feel uncomfortable about asking questions here. After all this is the sole purpose of this forum. Regarding tutorials, have a look at this thread. The SDK documentation can also be accessed online, no need to download the .chm.
In order to create materials, you will need to check a few things:
I hope, this helps.
On 21/02/2016 at 11:34, xxxxxxxx wrote:
I like the examples in the sdk. A very good start to begin your journey.
Another tip I can give you: Start in python and port it to c++. Python is easier and very good for prototyping.
-Pim
On 22/02/2016 at 04:52, xxxxxxxx wrote:
I've managed to create sub parts etc, unfortunatly I cannot assign materials to it.
Let's explaint a bit more:
- My object is a OBJECT_GENERATOR but it contains a PolygonObject that has all this data (further known as mObj) - Obviously I cannot see mOb properties until I make it editable, after that I see my Polygon Selection Tags, one UVW Tag, and each Texture Tag per Polygon Selection Tag, but no material assigned.
I tried to assign the material by:
texTag = (TextureTag* )mObject->MakeTag(Ttexture); gdata.SetInt32(TEXTURETAG_PROJECTION_UVW); texTag->SetParameter(DescLevel(TEXTURETAG_PROJECTION), gdata, DESCFLAGS_SET_0); gdata.SetString(name); texTag->SetParameter(DescLevel(TEXTURETAG_RESTRICTION), gdata, DESCFLAGS_SET_0); texTag->Message(MSG_CHANGE); texTag->SetMaterial(doc->SearchMaterial(matname));
But it didn't work, by the way doc->SearchMaterial(matname) is already tested and working.
Any idea?
On 26/02/2016 at 01:40, xxxxxxxx wrote:
Hello,
what exactly are you using as "name" value for TEXTURETAG_RESTRICTION? This should be the name of the polygon selection tag.
Best wishes, Sebastian
On 29/02/2016 at 00:58, xxxxxxxx wrote:
Yes restriction seems to be ok, let me share an image where you can see the problem:
The problem seems that Material is not applied on Texture Tag (I checked and it exists in the document at apply time), but if I make the object editable and apply the material manually it looks fine.
Regards, Víctor
On 29/02/2016 at 01:45, xxxxxxxx wrote:
I'm using this code in GetVirtualObjects() and it works fine here:
BaseObject* cube = BaseObject::Alloc(Ocube); if (!cube) return nullptr; TextureTag* ttag = static_cast<TextureTag*>(cube->MakeTag(Ttexture)); if(ttag) { BaseMaterial* material = hh->GetDocument()->SearchMaterial("green material"); ttag->SetMaterial(material); } return cube;
Does this code work for you?
On 29/02/2016 at 09:43, xxxxxxxx wrote:
It worked but I was creating my poly object in other part of the code and just return it at getvirtualobjects.
Fortunatly I think we are near to the end since I did this fast test:
ON CREATION _ _ BaseMaterial* bmat = doc- >SearchMaterial(mats[submesh->mMaterialIndex]->GetName()); texTag- >SetMaterial(bmat); texTag- >SetName(mats[submesh->mMaterialIndex]->GetName());
but the material was not applied, using your example I tried this hack and it worked
GETVIRTUALOBJECTS() int actTags = 0; while (m_actual_obj- >GetTag(Ttexture, actTags) != nullptr) { _ TextureTag* tTag = static_cast<TextureTag*>(m_actual_obj->GetTag(Ttexture, actTags));_ _ BaseMaterial *basemat=tTag->GetMaterial();_ _ if (basemat == nullptr)_ _ tTag->SetMaterial(hh->GetDocument()->SearchMaterial(tTag->GetName()));_ _ actTags++;_ }
So the problem was not the way to apply mats but when should I apply mats.
Obviously this works but not sure if it is the best way to work with this kind of issues.
On 01/03/2016 at 01:18, xxxxxxxx wrote:
why do you create the polygon object in "other part" and not in GetVirtualObjects()? Please notice that Cinema will take the ownership of the objects returned by GetVirtualObjects(). So be sure to handle the ownership correctly.
On 01/03/2016 at 04:02, xxxxxxxx wrote:
It is somethink like scatter a custom mesh.
I have a rootgenerator that makes some PolyObj* that are cloned into its children, is has no sense to generate that PolyObj for each children since it takes much more time.
Regards,