Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. indexofrefraction
    • Profile
    • Following 0
    • Followers 0
    • Topics 35
    • Posts 133
    • Best 7
    • Controversial 0
    • Groups 0

    indexofrefraction

    @indexofrefraction

    7
    Reputation
    167
    Profile views
    133
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    indexofrefraction Unfollow Follow

    Best posts made by indexofrefraction

    • RE: Check for missing textures

      ok! finally, it is imporant to use the doc to get the irs !
      now it works.

      irs = c4d.modules.render.InitRenderStruct(doc)
      

      but question:
      is this the only / best way to check if textures are missing?

      an alternative would be to actually check if the file is existing somewhere in the given paths

      posted in Cinema 4D SDK
      indexofrefractionI
      indexofrefraction
    • RE: incorrect specular channel property ids

      tx, i just wanted to report it...

      posted in Bugs
      indexofrefractionI
      indexofrefraction
    • RE: The layer material ID is the same as the node material ID.

      I also just ran into this...
      < R24 you dont have BaseList2D.IsNodeBased, but as a small hack you can do:

      def isNodeMaterial(op):
        return True if op.GetType == c4d.Mmaterial and '[Node]' in op.GetBubbleHelp() else False
      
      posted in General Talk
      indexofrefractionI
      indexofrefraction
    • RE: Check for missing textures

      hi and thanks Maxime !

      GetAllAssetsNew() is S22 only,
      and I had problems with InitRender() and Vray Bitmaps

      so I decided to manually check for the files...
      I had it already, but GenerateTexturePath() shortens the code quite a bit, because I dont have to check all possible paths.

      It seem GenerateTexturePath() returns the absolute path, if the file is found somewhere in the texture paths, otherwise it returns None.

      needs some testing, but until now it seems to work well.

      best, index

      posted in Cinema 4D SDK
      indexofrefractionI
      indexofrefraction
    • Quicktab Radio UserData change results in 2 Messages (Mini-Bug?)

      Hi,

      Just FYI ...
      I just noticed, that a Quicktab Radio UserData change results in two Messages (with the same UserData ID)
      If I change the interface to Cycle, I get only one Message as expected for an UserData change.

      This might be a tiny miny Bug (?) 🙂

      index

      posted in Bugs
      indexofrefractionI
      indexofrefraction
    • CommandData Plugin with Submenu

      Hi,

      below is a simple CommandData plugin with a submenu to invoke different actions.

      This works fine if more than one of these plugins (with unique Plugin Ids ofc) are in one plugin folder.
      But there is no menu if there is only one plugin present in the folder.

      Is there a way to create such a menu with one plugin, while not registering each menu point as separate command?

      best index

      # encoding: utf-8
      
      ''' CommandData Plugin with Menu '''
      
      import c4d 
      
      PLUGIN_ID = 12345678  # Unique Plugin Id
      
      MENUID_CMD0 = 1000
      MENUID_CMD1 = 1001
      
      class MenuHandler(c4d.plugins.CommandData):
      
      	def Register(self):
      		return c4d.plugins.RegisterCommandPlugin(
      			id=PLUGIN_ID, str="Test", info=c4d.PLUGINFLAG_COMMAND_HOTKEY, icon=None, help=None, dat=MenuHandler())
      
      	def GetSubContainer(self, doc, submenu):
      		bc = c4d.BaseContainer()
      		bc.SetString(1, "Test")
      		bc.SetString(MENUID_CMD0, "Command 0")
      		bc.SetString(MENUID_CMD1, "Command 1")
      		submenu.InsData(0, bc)
      		return True
      
      	def ExecuteSubID(self, doc, id):
      		if id == MENUID_CMD0:
      			pass
      		if id == MENUID_CMD1:
      			pass
      		return True
      
      	def Execute(self, doc):
      		return True
      
      if __name__ == "__main__":
      	MenuHandler().Register()
      
      posted in Cinema 4D SDK python
      indexofrefractionI
      indexofrefraction
    • RE: find out if generator object? (in case of a Field object)

      hi, i came up with this now...

      def hasGenFlag(op):
      	description = op.GetDescription(c4d.DESCFLAGS_DESC_NONE)		
      	bc = description.GetParameter(c4d.ID_BASEOBJECT_GENERATOR_FLAG)
      	return not bc[c4d.DESC_HIDE] if bc else False
      

      also its clear that "Generator" is a wide definition which doesn't match the Green Checkmark / Enabled GUI Element.
      in this sense the topic title is wrong bc i was just searching for a way to distinct objects having this GUI element from others which don't.
      (i can't change the topic title, i guess)

      posted in Cinema 4D SDK
      indexofrefractionI
      indexofrefraction

    Latest posts made by indexofrefraction

    • Debug Scene / Generators (Scene heat map)

      Hi,

      is there any possibility to debug a slow scene?
      see which generators or other things use what processing time on scene refresh?
      i saw there is a "heat map" for nodes...
      something like this for the scene.

      best, index

      posted in Cinema 4D SDK windows macos
      indexofrefractionI
      indexofrefraction
    • RE: find out if generator object? (in case of a Field object)

      hi, i came up with this now...

      def hasGenFlag(op):
      	description = op.GetDescription(c4d.DESCFLAGS_DESC_NONE)		
      	bc = description.GetParameter(c4d.ID_BASEOBJECT_GENERATOR_FLAG)
      	return not bc[c4d.DESC_HIDE] if bc else False
      

      also its clear that "Generator" is a wide definition which doesn't match the Green Checkmark / Enabled GUI Element.
      in this sense the topic title is wrong bc i was just searching for a way to distinct objects having this GUI element from others which don't.
      (i can't change the topic title, i guess)

      posted in Cinema 4D SDK
      indexofrefractionI
      indexofrefraction
    • RE: find out if generator object? (in case of a Field object)

      hey thanks for taking so much time for this ...

      for me it is only important to know if the gui element exists on the object...
      and its kind of awkward to have to change its state to figure that out.
      i fear that will trigger lots of stuff and slow down scenes even more
      (i have to check for many objects in complex scenes, and i can't know what obj types that are)

      is there no other way than disabling and re-enabling the object?

      in my experience c4d is very sensitive to object status changes and its easy to hog it down and make a scene unresponsive.

      EDIT : searching the objects Descriptions it is possible to find "Enable", but as mentioned Null Object has it too, it is just hidden.
      It would be very nice to be able to check if it is the right "Enabled" (there could be more) and if it is visible in the GUI.

      posted in Cinema 4D SDK
      indexofrefractionI
      indexofrefraction
    • find out if generator object? (in case of a Field object)

      hi,
      there is an old thread about this question:
      https://developers.maxon.net/forum/topic/6722/7354_find-out-if-generator-object
      with this conclusion :

      if obj.GetInfo() & c4d.OBJECT_GENERATOR:   
          print "a generator"   
      else:   
          print "not a generator"
      

      now i stumbled onto that Fields (eg. a Linear Field) do NOT qualify as generators in this test,
      but they DO have the green (enabled) checkmark that can be ticked on and off.

      is this a bug in the field objects ?
      or how can one find out if an object has the green checkmark or not ?

      best, index

      posted in Cinema 4D SDK python
      indexofrefractionI
      indexofrefraction
    • RE: How to Use GetConnectionValue/s() or GetConnection()?

      @ferdinand
      first of all, I understand your frustration, we just yesterday talked about the state of the Nodes API and are well aware of its hurdles for anything but super-experts.

      you can say that aloud!
      the whole system is very hard to understand. the only thing i got is all we know about traditional materials and even shaders is for the bin. node support evolved over time and most node examples do not work for people still using older c4d versions. also there are misc 3rd-party renderers that use different kinds of nodes / node systems. Drag & drop of attributes to the console doesn't work anymore, as well. the days of easy scripting are gone.. 😵

      posted in Cinema 4D SDK
      indexofrefractionI
      indexofrefraction
    • RE: Insert a shader into a shader hierarchy

      Thanks a lot kbar.. i'll watch and learn!
      still... the hurdles to compile a c++ plugin are extremely high nowadays. 😕
      it would be great if the sdk plugins would be downloadable ready compiled as well

      posted in Cinema 4D SDK
      indexofrefractionI
      indexofrefraction
    • RE: Insert a shader into a shader hierarchy

      this "Active Object Dialog" plugin looks very interesting
      if it would be understandably described how to compile it / the c++ sdk, we could check it out
      but sadly this got so complicated that you need a degree in IT to do it. .-)

      posted in Cinema 4D SDK
      indexofrefractionI
      indexofrefraction
    • developers.maxon.net - offline

      FYI, developers.maxon.net is down since about 24 hours....

      posted in General Talk
      indexofrefractionI
      indexofrefraction
    • RE: Gimbal Lock Safe Target Expression

      I have found another way to do this, which is maybe better (?)
      because it seems to work around tackling with parallel vectors....

      LookAtCamera::Execute() translated to python ... 🙂
      https://github.com/PluginCafe/cinema4d_cpp_sdk_extended/blob/master/plugins/cinema4dsdk/source/tag/lookatcamera.cpp

      def lookat(op, target, pitch=True):
        ''' orient op to look at target '''
        local = (~(op.GetUpMg() * op.GetFrozenMln())) * target.GetMg().off - op.GetRelPos()
        hpb = c4d.utils.VectorToHPB(local)
        if not pitch: hpb.y = op.GetRelRot().y
        hpb.z = op.GetRelRot().z
        op.SetRelRot(hpb)
        c4d.EventAdd()
      

      It seems to work fine... but for clarity... after checking the Matrix Manual (see end of the page) ...
      https://developers.maxon.net/docs/py/2023_2/manuals/data_algorithms/classic_api/matrix.html?highlight=matrix

      Is this correct / covers all cases to get the targets position in local space?
      (~(op.GetUpMg() * op.GetFrozenMln())) * target.GetMg().off
      specifically.. what is
      m = utils.MatrixMove(op.GetAbsPos()) * utils.HPBToMatrix(op.GetAbsRot()) * utils.MatrixScale(op.GetAbsScale())
      in this context? (ps. GetAbsScale misses the brackets in the docs)

      and... is this the real code of the Target Tag ?

      posted in Cinema 4D SDK
      indexofrefractionI
      indexofrefraction
    • RE: Gimbal Lock Safe Target Expression

      Hi Ferdinand, yes all solved
      and sorry if the gimbal lock was a false interpretation of what was happening.
      From reading the old threads I thought the quaternion solution was mandatory to solve this.

      for clarity and as an example I'm including a comparison of
      your solution (working) and riccardos solution (showing the flip)

      spotLight.c4d

      but for me the case is closed...
      Thanks a lot for helping with this !

      posted in Cinema 4D SDK
      indexofrefractionI
      indexofrefraction